From 29016bc86aefeb3f251db206d38f208515485071 Mon Sep 17 00:00:00 2001 From: youben11 Date: Mon, 7 Aug 2023 15:20:22 +0100 Subject: [PATCH] feat(compiler/python): expose memory usage in bindings --- .../compiler/lib/Bindings/Python/CompilerAPIModule.cpp | 5 ++++- .../Python/concrete/compiler/compilation_feedback.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/compilers/concrete-compiler/compiler/lib/Bindings/Python/CompilerAPIModule.cpp b/compilers/concrete-compiler/compiler/lib/Bindings/Python/CompilerAPIModule.cpp index 19b744ccf2..7206a6f177 100644 --- a/compilers/concrete-compiler/compiler/lib/Bindings/Python/CompilerAPIModule.cpp +++ b/compilers/concrete-compiler/compiler/lib/Bindings/Python/CompilerAPIModule.cpp @@ -162,7 +162,10 @@ void mlir::concretelang::python::populateCompilerAPISubmodule( "crt_decompositions_of_outputs", &mlir::concretelang::CompilationFeedback::crtDecompositionsOfOutputs) .def_readonly("statistics", - &mlir::concretelang::CompilationFeedback::statistics); + &mlir::concretelang::CompilationFeedback::statistics) + .def_readonly( + "memory_usage_per_location", + &mlir::concretelang::CompilationFeedback::memoryUsagePerLoc); pybind11::class_( m, "JITCompilationResult"); diff --git a/compilers/concrete-compiler/compiler/lib/Bindings/Python/concrete/compiler/compilation_feedback.py b/compilers/concrete-compiler/compiler/lib/Bindings/Python/concrete/compiler/compilation_feedback.py index a3274fde22..f3b99b90bd 100644 --- a/compilers/concrete-compiler/compiler/lib/Bindings/Python/concrete/compiler/compilation_feedback.py +++ b/compilers/concrete-compiler/compiler/lib/Bindings/Python/concrete/compiler/compilation_feedback.py @@ -48,6 +48,7 @@ def __init__(self, compilation_feedback: _CompilationFeedback): compilation_feedback.crt_decompositions_of_outputs ) self.statistics = compilation_feedback.statistics + self.memory_usage_per_location = compilation_feedback.memory_usage_per_location super().__init__(compilation_feedback)