Commit Graph

90 Commits

Author SHA1 Message Date
Mayeul@Zama
ca8d4fb110 feat(compiler): use engine concrete C API
remove ConcreteToConcreteCAPI and ConcreteUnparametrize passes
2022-03-15 18:14:35 +01:00
Umut
d06e0c0a59 feat: enhance matmul operation to support 1-D and N-D inputs 2022-03-01 18:06:40 +03:00
youben11
4f19dce899 fix: adapt dialect tests after recent pipeline changes
new passes have affected the order of appearance of constants, so they
just needed to be put at the top in the expected IR
2022-02-24 09:44:26 +01:00
youben11
6d2f853c07 feat: support Conv2d in MANP 2022-02-24 09:44:26 +01:00
youben11
3668b2d73a feat: add a Conv2d operation in FHELinalg 2022-02-24 09:44:26 +01:00
Quentin Bourgerie
b3368027d0 refactor(compiler): Move FHELinalg.zero to FHE.zero_tensor and add zero and sero_tensor in TFHE and Concrete dialects 2022-02-17 15:53:23 +01:00
Quentin Bourgerie
1f3944047f feature(compiler): Introduce the BConcrete Dialect 2022-02-17 15:53:23 +01:00
Umut
20a89b7b42 feat: implement concat operation 2022-02-15 16:52:07 +03:00
Umut
a1818a3fd9 feat: implement advanced sum operation 2022-02-08 17:49:58 +03:00
Umut
4203e86998 feat: implement basic sum operation 2022-02-01 12:18:56 +03:00
Quentin Bourgerie
4ecae140ca doc(compiler): Enhance FHE Dialect documentation 2022-01-06 18:07:19 +01:00
youben11
8ccfd8b634 chore: clean useless files 2022-01-06 12:40:10 +01:00
youben11
2009ee1c94 chore: changing ref to repo after its renaming
also formatting and update the check_license script to match that
2022-01-06 12:40:10 +01:00
youben11
940cb96be4 chore: rename dialects
HLFHE to FHE
MidLFHE to TFHE
LowLFHE to Concrete
2021-12-29 15:13:34 +01:00
youben11
e73291abdc chore: rename compiler to concrete-compiler
zamalang => concretelang
zamacompiler => concretecompiler
2021-12-29 15:13:34 +01:00
rudy
d8fee32cea feat(HLFHELinalg): add apply_mapped_table_lookup
Resolves #182
2021-12-27 15:34:33 +01:00
Andi Drebes
68e124964c test(compiler): Add tests for the HLFHELinalg tiling passes 2021-12-17 16:48:00 +01:00
Mayeul@Zama
f193fd71a2 fix(compiler): fix mixed-up (g)lwe dimension/size
add dimension -> size conversion
rename k -> glweDimension, polynomialSize -> logPolynomialSize
remove (in/out)putLweSize from KeySwitchLweOp
remove GlweSizeType from LowLFHE
2021-12-07 12:11:56 +01:00
Quentin Bourgerie
bb1add2a6f enhance(compiler): Remove the restriction of analysis on the HLFHELinalg.dot
While the manp analysis wasn't handle tensor the dot operation restrict the operands to come from a block argument. Since the tensor are handled in the manp pass this restriction has no more meaning.
2021-12-07 11:17:33 +01:00
Andi Drebes
bf9a831c3d test(compiler): Add unit tests for HLFHELinalg.zero
Add unit tests for `HLFHELinalg.zero`, including a test for the
integration into the MANP pass.
2021-12-01 11:24:27 +01:00
Quentin Bourgerie
b1e7a66b09 cleanup(compiler/lowlfhe): Remove useless LowLFHE ops and types
Some of these operators/types could be usefull but they are not yet use on the compiler pipeline it's preferable to remove them, and reintroduce if needed.
2021-11-30 16:11:33 +01:00
Mayeul@Zama
94b8070b3f tests(compiler): make FileCheck tests stricter 2021-11-24 14:18:38 +01:00
Quentin Bourgerie
ddbafd713d feat(compiler): Add the HLFHELinalg.matmul_int_eint operator 2021-11-24 09:19:25 +01:00
Quentin Bourgerie
100862e484 feat(compiler): Add the support of linalg.tensor_expand_shape and linalg.tensor_collapse_shape on encrypted tensors 2021-11-17 14:19:15 +01:00
youben11
36413235c5 feat(compiler): lower HLFHELinalg.apply_multi_lut
Support broadcasting
2021-11-15 11:25:44 +01:00
youben11
ac7f1f5a6b feat(compiler): add HLFHELinalg.apply_multi_lut
Apply a lookup table on the different elements of the encrypted tensors,
but using different lookup tables.

MANP support as well as tests
2021-11-15 11:25:44 +01:00
Quentin Bourgerie
5df775a51b feat(compiler): MANP Analysis of HLFHELinalg.matmul (closes #178) 2021-11-12 16:50:29 +01:00
Quentin Bourgerie
12b4771405 feat(compiler/linalg): Definition of HLFHELinalg.matmul_eint_int (closes #176) 2021-11-12 16:50:29 +01:00
youben11
99d6d11616 feat(compiler): support HLFHELinalg.neg_eint in MANP 2021-11-10 15:24:31 +01:00
youben11
d9adbab036 feat(compiler): add HLFHELinalg.neg_eint op 2021-11-10 15:24:31 +01:00
youben11
efacd7d8a1 feat(compiler): support HLFHE.neg_eint in MANP 2021-11-10 15:24:31 +01:00
youben11
c1cd6bb380 feat(compiler): add MidLFHE.neg_glwe op 2021-11-10 15:24:06 +01:00
youben11
cc4e403e7a feat(compiler): add HLFHE.neg_eint op 2021-11-10 14:52:35 +01:00
rudy
97389a3b06 Move HLFHE.dot_eint_int to HLFHELinalg.
Resolves #183
2021-11-09 11:39:08 +01:00
youben11
03c1588db4 chore: update to LLVM 8b7cc93e
major changes:
- https://llvm.discourse.group/t/psa-removed-arithmetic-ops-from-standard/4455
- use add_mlir_public_c_api_library helper to correctly add a CAPI library
2021-10-29 16:08:41 +01:00
Quentin Bourgerie
5bb58453aa feat(compiler): MANP Analysis of HLFHELinalg.apply_lookup_table (close #175) 2021-10-29 13:47:38 +02:00
Quentin Bourgerie
2900c9a2a1 feat(compiler): Add support of HLFHELinalg binary operators in MANP pass (close #172) 2021-10-29 13:47:38 +02:00
Quentin Bourgerie
be92b4580d Merge branch 'master' into hlfhelinalg-binary-op-lowering 2021-10-29 13:47:35 +02:00
Quentin Bourgerie
85d102c9b2 refactor(compiler): Simplify the compiler flow and re enable --passes compiler option
No more need to compute the fhe context at high level
2021-10-29 13:44:34 +02:00
Andi Drebes
1187cfbd62 refactor(compiler): Refactor CompilerEngine and related classes
This commit contains several incremental improvements towards a clear
interface for lambdas:

  - Unification of static and JIT compilation by using the static
    compilation path of `CompilerEngine` within a new subclass
    `JitCompilerEngine`.

  - Clear ownership for compilation artefacts through
    `CompilationContext`, making it impossible to destroy objects used
    directly or indirectly before destruction of their users.

  - Clear interface for lambdas generated by the compiler through
    `JitCompilerEngine::Lambda` with a templated call operator,
    encapsulating otherwise manual orchestration of `CompilerEngine`,
    `JITLambda`, and `CompilerEngine::Argument`.

  - Improved error handling through `llvm::Expected<T>` and proper
    error checking following the conventions for `llvm::Expected<T>`
    and `llvm::Error`.

Co-authored-by: youben11 <ayoub.benaissa@zama.ai>
2021-10-29 13:44:34 +02:00
Quentin Bourgerie
dea1be9d52 feat(compiler): HLFHELinalg.apply_lookup_table definition 2021-10-29 12:17:38 +02:00
Quentin Bourgerie
f72d51d98d feat(compiler): HLFHELinalg.mul_eint_int 2021-10-29 12:17:38 +02:00
Quentin Bourgerie
64e327209f feat(compiler): HLFHELinalg.sub_int_eint 2021-10-29 12:17:32 +02:00
Quentin Bourgerie
3b02a16f7b feat(compiler): HLFHELinalg.add_eint definition 2021-10-29 12:16:41 +02:00
Quentin Bourgerie
0d4e10169b feat(compiler): Introduce the HLFHELinalg dialect and a first operator HLFHELinalg.add_eint_int 2021-10-29 12:16:41 +02:00
Quentin Bourgerie
1c202ebaff enhance(compiler): Support of tensor operators in MANP pass (close #169) 2021-10-20 16:21:52 +02:00
Quentin Bourgerie
966160bc2c fix(compiler): apply_lookup_table operators take tensor of i64
We decide to make this choice as they are issue to crate tensor of custom integer type in python.
+ we don't do the integer extension before convert to the concrete CAPI that requires i64
2021-10-13 10:28:35 +02:00
Andi Drebes
6a6fae96f6 test(compiler): Add tests for the Minimal Arithmetic Noise Padding analysis pass
This adds tests for the Minimal Arithmetic Noise Padding analysis pass
that is invoked with --debug-manp, testing both elementary operations
and DAGs of computations on encrypted integers.
2021-09-28 11:35:58 +02:00
Andi Drebes
30374ebb2c refactor(compiler): Introduce compilation pipeline with multiple entries / exits
This refactoring commit restructures the compilation pipeline of
`zamacompiler`, such that it is possible to enter and exit the
pipeline at different points, effectively defining the level of
abstraction at the input and the required level of abstraction for the
output.

The entry point is specified using the `--entry-dialect`
argument. Valid choices are:

  `--entry-dialect=hlfhe`:   Source contains HLFHE operations
  `--entry-dialect=midlfhe`: Source contains MidLFHE operations
  `--entry-dialect=lowlfhe`: Source contains LowLFHE operations
  `--entry-dialect=std`:     Source does not contain any FHE Operations
  `--entry-dialect=llvm`:    Source is in LLVM dialect

The exit point is defined by an action, specified using --action.

  `--action=roundtrip`:
     Parse the source file to in-memory representation and immediately
     dump as text without any processing

  `--action=dump-midlfhe`:
     Lower source to MidLFHE and dump result as text

  `--action=dump-lowlfhe`:
     Lower source to LowLFHE and dump result as text

  `--action=dump-std`:
     Lower source to only standard MLIR dialects (i.e., all FHE
     operations have already been lowered)

  `--action=dump-llvm-dialect`:
     Lower source to MLIR's LLVM dialect (i.e., the LLVM dialect, not
     LLVM IR)

  `--action=dump-llvm-ir`:
     Lower source to plain LLVM IR (i.e., not the LLVM dialect, but
     actual LLVM IR)

  `--action=dump-optimized-llvm-ir`:
     Lower source to plain LLVM IR (i.e., not the LLVM dialect, but
     actual LLVM IR), pass the result through the LLVM optimizer and
     print the result.

  `--action=dump-jit-invoke`:
     Execute the full lowering pipeline to optimized LLVM IR, JIT
     compile the result, invoke the function specified in
     `--jit-funcname` with the parameters from `--jit-args` and print
     the functions return value.
2021-09-28 11:35:58 +02:00
youben11
1e07733257 fix(lower-LUT): keep output size of KS during lowering
output size of keyswiting wasn't set properly. As this information must
come from the selected parameters, it should goes down from the MidLFHE
to the appropriate call to ciphertext allocation
2021-09-09 20:35:28 +02:00