Commit Graph

78 Commits

Author SHA1 Message Date
Quentin Bourgerie
1605551f1a feat(compiler): HLFHEToMidLFHE pass (#57) 2021-08-04 14:03:05 +02:00
Quentin Bourgerie
ed40b1ef91 feat(compiler): Add HLFHE.sub_int_eint (#54) 2021-08-03 09:23:11 +02:00
Quentin Bourgerie
143a2384fd enhance(compiler): Add verifier of HLFHE operators 2021-08-03 09:23:11 +02:00
Quentin Bourgerie
cb635f8a55 feat(compiler): HLFHE.apply_lookup_table (#54) 2021-08-03 09:23:11 +02:00
Quentin Bourgerie
ea77ee696a enhance(compiler): Add verify for HLFHE.eint, precision ]0;7] (#54) 2021-08-03 09:23:11 +02:00
Quentin Bourgerie
3c326c09d6 clean(compiler): Remove unecessary operators for compiler v0 (#54) 2021-08-03 09:23:11 +02:00
Quentin Bourgerie
be62755401 fix(compiler): Fixing MidLFHE Dialect for the compiler v0 2021-07-29 09:53:45 +02:00
Ayoub Benaissa
ab53ef71c6 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
2021-07-28 15:58:51 +01:00
Andi Drebes
9d1cdc6a0c feat(compiler): Add lowering pass from HLFHE.dot_eint_int to linalg.generic
This pass transforms any instance of `HLFHE.dot_eint_int` to an
instance of `linalg.generic` with an appropriate region using
`HLFHE.mul_eint_int` and `HLFHE.add_eint` operations and an
appropriate specification for the iteration dimensions.

Example:

  "HLFHE.dot_eint_int"(%arg0, %arg1, %arg2) :
    (memref<?x!HLFHE.eint<0>>, memref<?xi32>, memref<!HLFHE.eint<0>>) -> ()

becomes:

  linalg.generic {
    indexing_maps = [affine_map<(d0) -> (d0)>,
                     affine_map<(d0) -> (d0)>,
		     affine_map<(d0) -> ()>],
    iterator_types = ["reduction"]
  } ins(%arg0, %arg1 : memref<?x!HLFHE.eint<0>>, memref<?xi32>) outs(%arg2 : memref<!HLFHE.eint<0>>) {
    ^bb0(%arg3: !HLFHE.eint<0>, %arg4: i32, %arg5: !HLFHE.eint<0>):  // no predecessors
      %0 = "HLFHE.mul_eint_int"(%arg3, %arg4) : (!HLFHE.eint<0>, i32) -> !HLFHE.eint<0>
      %1 = "HLFHE.add_eint"(%0, %arg5) : (!HLFHE.eint<0>, !HLFHE.eint<0>) -> !HLFHE.eint<0>
      linalg.yield %1 : !HLFHE.eint<0>
  }
2021-07-16 18:03:49 +02:00
Andi Drebes
b433627821 feat(compiler): Add Dot operation to HLFHE dialect
Add a simple dot product between a vector of encrypted integers and a
vector of plaintext integers to the HLFHE dialect.

The operation takes two input operands and one output operand, all
modeled as memrefs. Example:

  "HLFHE.dot_eint_int"(%lhs, %rhs, %out) :
    (memref<?x!HLFHE.eint<0>>, memref<?xi32>, memref<!HLFHE.eint<0>>) -> ()
2021-07-16 18:03:49 +02:00
Andi Drebes
cef0e569d4 fix(compiler): Generate and include autogenerated dialect definitions (#52)
* fix(compiler): Generate and include autogenerated dialect definitions

Since commit 485cc55edfb875628e19bb6d9de4706af2865d3e in llvm-project,
dialects are now required to include a file with autogenerated
definitions. This commit generates the definition files and includes
them in appropriate dialect source files for MidLFHE and HLFHE.

* CI: update docker image ref

Co-authored-by: Andi Drebes <andi.drebes@zama.ai>
Co-authored-by: Ayoub Benaissa <ayoub.benaissa@zama.ai>
2021-07-08 15:54:10 +01:00
Andi Drebes
3bfda58eb8 feat(compiler): Make HLFHE.EncryptedInteger usable as memref element type
Make `HLFHE.EncryptedInteger` implement the
`MemRefElementTypeInterface` trait to allow the type to be used for
elements of memrefs.

The invocation of the `add_mlir_dialect` macro in
`include/zamalang/Dialect/HLFHE/IR/CMakeLists.txt` had to be broken
into its parts in order to pass `-typedefs-dialect=HLFHE` to
`mlir-tablegen`. This is required due to the inclusion of
`mlir/IR/BuiltinTypes.td` in
`include/zamalang/Dialect/HLFHE/IR/HLFHETypes.td`, resulting in
definitions from multiple dialects.

Add a small test actually using `HLFE.EncryptedInteger` in a `memref`.
2021-06-23 10:15:35 +02:00
Quentin Bourgerie
bdcf7ece05 enhance(compiler): Add verifier of MidLFHE.GLWE parameters 2021-06-23 10:10:31 +02:00
Quentin Bourgerie
efedf23e8d enhance(compiler): MidLFHE.add_plain introduce paddingBits verification 2021-06-23 10:10:31 +02:00
Quentin Bourgerie
38105b5f1c enhance(compiler): MidLFHE has now only one GLWE type that take all cryptographic parameters 2021-06-23 10:10:31 +02:00
Andi Drebes
428ba24807 style(compiler): Use header guards conforming to style from .clang-tidy 2021-06-11 10:46:03 +02:00
Ayoub Benaissa
eef82a4713 style(compiler): c++ formatting with github action (#22)
* style(compiler): c++ formatting with github action

* style(compiler): update format script
2021-06-04 09:18:14 +02:00
youben11
4e663df5af enhance(compiler): Add a region to the HLFHE.apply_univariate for the expression of the univariate closure 2021-05-28 12:08:42 +02:00
youben11
efae2a79d7 feat(compiler): h_add and h_mul 2021-05-28 12:08:42 +02:00
youben11
8edf4a358e feat(compiler): keyswitching types and ops 2021-05-28 12:08:42 +02:00
youben11
7104e2600c feat(compiler): parameterize pbs ops via attr 2021-05-28 12:08:42 +02:00
youben11
55043c24f1 feat(compiler): introduce mul_plain 2021-05-28 12:08:41 +02:00
Quentin Bourgerie
ccae801e5a feat(compiler): Introduce MidLFHE.add_plain and MidLFHE.pbs 2021-05-28 12:08:41 +02:00
Quentin Bourgerie
0b41018ade feat(compiler): Add !HLFHE.ciphertext 2021-05-28 12:08:41 +02:00
Quentin Bourgerie
ce69aab756 feat(compiler): Add !MidLFHE.ggsw<size,N,level,base_log> 2021-05-28 12:08:41 +02:00
Quentin Bourgerie
122759eabf feat(compiler): Introduce MidLFHEDialect (!MidLFHE.lwe<size>, !MidLFHE.glwe<size,n>) 2021-05-28 12:08:41 +02:00
Quentin Bourgerie
32340d3ec0 feat(compiler): Introduce HLFHEDialect 2021-05-28 12:02:18 +02:00
Quentin Bourgerie
f7c11a0c4e chore(compiler): Empty MLIR structure 2021-05-18 10:57:48 +02:00