mirror of
https://github.com/zama-ai/concrete.git
synced 2026-02-09 20:25:34 -05:00
feat(compiler): Python bindings (#53)
- feat(compiler): python bindings - build: update docker image for python bindings - pin pybind11 to 2.6.2, 2.7 is not having correct include_dirs set (still a question why?) - using generated parser/printer
This commit is contained in:
27
compiler/python/HLFHEModule.cpp
Normal file
27
compiler/python/HLFHEModule.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#include "DialectModules.h"
|
||||
|
||||
#include "zamalang-c/Dialect/HLFHE.h"
|
||||
|
||||
#include "mlir-c/BuiltinAttributes.h"
|
||||
#include "mlir/Bindings/Python/PybindAdaptors.h"
|
||||
#include "llvm/ADT/SmallString.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/pytypes.h>
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
using namespace zamalang;
|
||||
using namespace mlir::python::adaptors;
|
||||
|
||||
/// Populate the hlfhe python module.
|
||||
void zamalang::python::populateDialectHLFHESubmodule(pybind11::module &m) {
|
||||
m.doc() = "HLFHE dialect Python native extension";
|
||||
|
||||
mlir_type_subclass(m, "EncryptedIntegerType",
|
||||
hlfheTypeIsAnEncryptedIntegerType)
|
||||
.def_classmethod(
|
||||
"get", [](pybind11::object cls, MlirContext ctx, unsigned width) {
|
||||
return cls(hlfheEncryptedIntegerTypeGet(ctx, width));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user