refactor: concrete-numpy to concrete-python

This commit is contained in:
Umut
2023-03-16 10:26:03 +01:00
parent 1ed1f4321c
commit 4e7cbac264
153 changed files with 1124 additions and 7448 deletions

View File

@@ -27,6 +27,7 @@ declare_mlir_python_extension(
FHEModule.cpp
CompilerAPIModule.cpp
EMBED_CAPI_LINK_LIBS
MLIRCAPIRegisterEverything
CONCRETELANGCAPIFHE
CONCRETELANGCAPIFHELINALG
CONCRETELANGPySupport)

View File

@@ -10,7 +10,9 @@
#include "concretelang/Support/Constants.h"
#include "mlir-c/Bindings/Python/Interop.h"
#include "mlir-c/IR.h"
#include "mlir-c/RegisterEverything.h"
#include "mlir/Bindings/Python/PybindAdaptors.h"
#include "mlir/IR/DialectRegistry.h"
#include "llvm-c/ErrorHandling.h"
#include "llvm/Support/Signals.h"
@@ -28,15 +30,20 @@ PYBIND11_MODULE(_concretelang, m) {
[](py::object capsule) {
// Get the MlirContext capsule from PyMlirContext capsule.
auto wrappedCapsule = capsule.attr(MLIR_PYTHON_CAPI_PTR_ATTR);
MlirContext context = mlirPythonCapsuleToContext(wrappedCapsule.ptr());
const MlirContext context =
mlirPythonCapsuleToContext(wrappedCapsule.ptr());
// Collect Concretelang dialects to register.
MlirDialectHandle fhe = mlirGetDialectHandle__fhe__();
const MlirDialectRegistry registry = mlirDialectRegistryCreate();
mlirRegisterAllDialects(registry);
mlirContextAppendDialectRegistry(context, registry);
const MlirDialectHandle fhe = mlirGetDialectHandle__fhe__();
mlirDialectHandleRegisterDialect(fhe, context);
mlirDialectHandleLoadDialect(fhe, context);
MlirDialectHandle fhelinalg = mlirGetDialectHandle__fhelinalg__();
const MlirDialectHandle fhelinalg = mlirGetDialectHandle__fhelinalg__();
mlirDialectHandleRegisterDialect(fhelinalg, context);
mlirDialectHandleLoadDialect(fhelinalg, context);
mlirContextLoadAllAvailableDialects(context);
},
"Register Concretelang dialects on a PyMlirContext.");