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:
Ayoub Benaissa
2021-07-28 15:58:51 +01:00
committed by GitHub
parent 812268000c
commit ab53ef71c6
20 changed files with 337 additions and 14 deletions

25
compiler/test_python.py Executable file
View File

@@ -0,0 +1,25 @@
import zamalang
import zamalang.dialects.hlfhe as hlfhe
import mlir.dialects.builtin as builtin
import mlir.dialects.std as std
from mlir.ir import *
def main():
with Context() as ctx, Location.unknown():
# register zamalang's dialects
zamalang.register_dialects(ctx)
module = Module.create()
eint16 = hlfhe.EncryptedIntegerType.get(ctx, 16)
with InsertionPoint(module.body):
func_types = [RankedTensorType.get((10, 10), eint16) for _ in range(2)]
@builtin.FuncOp.from_py_func(*func_types)
def fhe_circuit(*arg):
return arg[0]
print(module)
if __name__ == "__main__":
main()