From 89553858ddc6c850ab683929da5fd43ed5b3ea13 Mon Sep 17 00:00:00 2001 From: rudy Date: Fri, 26 Jul 2024 12:32:31 +0200 Subject: [PATCH] feat(frontend-python): release GIL on run, encrypt, decrypt --- .../compiler/lib/Bindings/Python/CompilerAPIModule.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compilers/concrete-compiler/compiler/lib/Bindings/Python/CompilerAPIModule.cpp b/compilers/concrete-compiler/compiler/lib/Bindings/Python/CompilerAPIModule.cpp index 554ac8b587..332e6759f9 100644 --- a/compilers/concrete-compiler/compiler/lib/Bindings/Python/CompilerAPIModule.cpp +++ b/compilers/concrete-compiler/compiler/lib/Bindings/Python/CompilerAPIModule.cpp @@ -968,6 +968,7 @@ void mlir::concretelang::python::populateCompilerAPISubmodule( ::concretelang::serverlib::ServerLambda lambda, ::concretelang::clientlib::PublicArguments &publicArguments, ::concretelang::clientlib::EvaluationKeys &evaluationKeys) { + pybind11::gil_scoped_release release; SignalGuard signalGuard; return library_server_call(support, lambda, publicArguments, evaluationKeys); @@ -1249,6 +1250,7 @@ void mlir::concretelang::python::populateCompilerAPISubmodule( ::concretelang::clientlib::PublicArguments &publicArguments, ::concretelang::clientlib::EvaluationKeys &evaluationKeys) { SignalGuard signalGuard; + pybind11::gil_scoped_release release; auto keyset = evaluationKeys.keyset; auto values = publicArguments.values; GET_OR_THROW_RESULT(auto output, circuit.call(keyset, values)); @@ -1279,6 +1281,7 @@ void mlir::concretelang::python::populateCompilerAPISubmodule( [](::concretelang::clientlib::ValueExporter &exporter, size_t position, int64_t value) { SignalGuard signalGuard; + pybind11::gil_scoped_release release; auto info = exporter.circuit.getCircuitInfo() .asReader() @@ -1299,6 +1302,7 @@ void mlir::concretelang::python::populateCompilerAPISubmodule( size_t position, std::vector values, std::vector shape) { SignalGuard signalGuard; + pybind11::gil_scoped_release release; std::vector dimensions(shape.begin(), shape.end()); auto info = exporter.circuit.getCircuitInfo().asReader().getInputs()[position]; @@ -1374,6 +1378,7 @@ void mlir::concretelang::python::populateCompilerAPISubmodule( size_t position, ::concretelang::clientlib::SharedScalarOrTensorData &value) { SignalGuard signalGuard; + pybind11::gil_scoped_release release; auto result = decrypter.circuit.processOutput(value.value, position);