mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 03:55:04 -05:00
fix: use new dfr api
This commit is contained in:
@@ -53,10 +53,7 @@ MLIR_CAPI_EXPORTED std::string roundTrip(const char *module);
|
||||
MLIR_CAPI_EXPORTED lambdaArgument invokeLambda(lambda l,
|
||||
executionArguments args);
|
||||
|
||||
// Initialize and terminate parallelization. Init can be called only once (later
|
||||
// calls might be ignored by the runtime). You shouldn't reinit after
|
||||
// termination.
|
||||
MLIR_CAPI_EXPORTED void initParallelization();
|
||||
// Terminate parallelization
|
||||
MLIR_CAPI_EXPORTED void terminateParallelization();
|
||||
|
||||
// Create a lambdaArgument from a tensor of different data types
|
||||
|
||||
@@ -39,7 +39,6 @@ void mlir::concretelang::python::populateCompilerAPISubmodule(
|
||||
return library(library_path, mlir_modules);
|
||||
});
|
||||
|
||||
m.def("init_parallelization", &initParallelization);
|
||||
m.def("terminate_parallelization", &terminateParallelization);
|
||||
|
||||
pybind11::class_<JitCompilerEngine>(m, "JitCompilerEngine")
|
||||
|
||||
@@ -9,7 +9,6 @@ from typing import List, Union
|
||||
|
||||
from mlir._mlir_libs._concretelang._compiler import (
|
||||
JitCompilerEngine as _JitCompilerEngine,
|
||||
init_parallelization as _init_parallelization,
|
||||
terminate_parallelization as _terminate_parallelization,
|
||||
)
|
||||
from mlir._mlir_libs._concretelang._compiler import LambdaArgument as _LambdaArgument
|
||||
@@ -185,9 +184,6 @@ class CompilerEngine:
|
||||
if not isinstance(unsecure_key_set_cache_path, str):
|
||||
raise TypeError("unsecure_key_set_cache_path must be a str")
|
||||
|
||||
if any([auto_parallelize, loop_parallelize, df_parallelize]):
|
||||
# Multiple calls should be guarded in the compiler and only result in a single init
|
||||
_init_parallelization()
|
||||
self._lambda = self._engine.build_lambda(
|
||||
mlir_str,
|
||||
func_name,
|
||||
|
||||
@@ -48,18 +48,9 @@ buildLambda(const char *module, const char *funcName,
|
||||
return std::move(*lambdaOrErr);
|
||||
}
|
||||
|
||||
void initParallelization() {
|
||||
#ifdef CONCRETELANG_PARALLEL_EXECUTION_ENABLED
|
||||
_dfr_pre_main();
|
||||
#else
|
||||
throw std::runtime_error(
|
||||
"This package was built without parallelization support");
|
||||
#endif
|
||||
}
|
||||
|
||||
void terminateParallelization() {
|
||||
#ifdef CONCRETELANG_PARALLEL_EXECUTION_ENABLED
|
||||
_dfr_post_main();
|
||||
_dfr_terminate();
|
||||
#else
|
||||
throw std::runtime_error(
|
||||
"This package was built without parallelization support");
|
||||
|
||||
Reference in New Issue
Block a user