enhance(python-bindings): Expose the option to set or not the v0 strategy of the optimizer.

This commit is contained in:
Quentin Bourgerie
2022-09-01 10:20:37 +02:00
parent 98a799f807
commit 30df69366d
2 changed files with 17 additions and 1 deletions

View File

@@ -62,8 +62,11 @@ void mlir::concretelang::python::populateCompilerAPISubmodule(
.def("set_display_optimizer_choice",
[](CompilationOptions &options, bool display) {
options.optimizerConfig.display = display;
})
.def("set_strategy_v0",
[](CompilationOptions &options, bool strategy_v0) {
options.optimizerConfig.strategy_v0 = strategy_v0;
});
;
pybind11::class_<mlir::concretelang::JitCompilationResult>(
m, "JITCompilationResult");

View File

@@ -164,3 +164,16 @@ class CompilationOptions(WrapperCpp):
if not isinstance(display, bool):
raise TypeError("display should be a bool")
self.cpp().set_display_optimizer_choice(display)
def set_strategy_v0(self, enable: bool):
"""Set the strategy of the optimizer to the v0 one.
Args:
enable (bool): if true the compiler use the V0 optimizer strategy.
Raises:
TypeError: if the value is not a bool
"""
if not isinstance(enable, bool):
raise TypeError("enable should be a bool")
self.cpp().set_strategy_v0(enable)