Commit Graph

45 Commits

Author SHA1 Message Date
rudy
1b70a38754 feat(optimizer): expose the p_error parameter
simplify the handling of options by relying more on CompilationOptions
2022-05-06 13:06:08 +02:00
rudy
923a1b58e1 feat(optimizer): plug online parameter estimation 2022-04-29 15:11:42 +02:00
youben11
af300055a7 fix(macos): update dependency after compiling dylib
when dellocate is used to include dependencies in python wheels, the
runtime library will have an id that is prefixed with /DLC, and that path
doesn't exist. So when generated libraries won't be able to find it
during load time. To solve this, we change the dep in the generated
library to be relative to the rpath which should be set correctly during
linking. This shouldn't have an impact when /DLC/concrete/.dylibs/* isn't
a dependecy in the first place (when not using python).

also set rpath when linking to RT lib
2022-04-12 13:56:18 +01:00
youben11
fafaa4c870 fix(macos): ignore undefined symbols for JIT compilation 2022-04-06 08:43:44 +01:00
youben11
2ded4b6f43 fix: set rpath when linking using extra args 2022-04-06 08:43:44 +01:00
youben11
01f6a334ff chore: remove macos workaround for linking runtimelib 2022-04-04 11:52:23 +01:00
youben11
ec7d1232f1 feat: add runtimeLib link for library compilation
runtime library will be linked to compiled library
2022-04-04 11:52:23 +01:00
Quentin Bourgerie
fc51b1d2ab fix(compiler): Activate the loop parallelism in ConcreteToBConcrete when the option is set 2022-03-28 09:41:27 +02:00
Quentin Bourgerie
f8968eb489 enhance(compiler/support): Refactor lambda support to have fatorized supoort for both lib and jit lambda 2022-03-24 11:00:36 +01:00
Mayeul@Zama
73bb1c03d8 enhance(compiler): fix warnings
remove unused signature, functions, variable
remove pessimizing-moves
add cast before comparison
2022-03-15 18:14:35 +01:00
Antoniu Pop
8ee456315e fix(compiler): fix code generated for library header. 2022-02-28 21:00:48 +00:00
rudy
8b71e9d476 feat(Clientlib): separate client encryption and server computation
Resolve #200
2022-02-24 15:50:18 +01:00
Quentin Bourgerie
626493dda7 enhance(compiler): Lower from Concrete to BConcrete and BConcrete to C API call 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
Antoniu Pop
dddad849c7 enhance(compiler): add --parallelize-loops and --parallelize-dataflow compile flags in addition to --parallelize which enables both. 2022-02-03 10:59:12 +00:00
Antoniu Pop
ec633d57f6 fix(compiler): predicate OpenMP loop parallelization of Linalg on the --parallelize flag. 2022-02-03 10:59:12 +00:00
Quentin Bourgerie
f52965e22f enhance(compiler): Lower linalg to parallel loops and instantiare parallel loops with openmp 2022-02-03 10:59:12 +00:00
youben11
71cccc6a89 fix(mac): add options for required libraries 2022-01-24 17:02:25 +00:00
youben11
faa0abea3e fix: use appropriate cmd for dynamic lib generation
macos and linux require a different cmd
2022-01-24 17:02:25 +00: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
rudy
b8bd38dd6c feat(compiler): Output client parameters when compile to a library
close #198
2022-01-03 17:57:16 +01:00
youben11
f1161f7f6d chore: formatting
Quick fix due to ordering of includes, had to add #include
<mlir/Transforms/DialectConversion.h> to include/concretelang/Conversion/Utils/GenericOpTypeConversionPattern.h
2022-01-03 09:29:19 +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
youben11
971cb56182 chore: licensing 2021-12-29 15:13:34 +01:00
Antoniu Pop
cdca7ca6f7 feat(compiler): add Dataflow/RT dialect and code generation for dataflow auto parallelization. 2021-12-23 15:57:53 +00:00
Quentin Bourgerie
db683f4a0e feat(compiler/runtime): Introduce a RT dialect 2021-12-23 15:57:53 +00:00
Andi Drebes
f319ba37d2 feat(compiler): Integrate HLFHELinalg tiling passes into compilation pipeline 2021-12-17 16:09:59 +01:00
rudy
74d52cb649 fix(clang): remove an error reported by clang 2021-12-08 11:31:23 +01:00
youben11
58f385b11b fix: move CompilationResult in return
old toolchain (gcc 6.x) was complaining about not being able to convert
CompilationResult to Expected<CompilationResult>
2021-12-07 16:14:44 +01:00
rudy
975ee86a5e feat(compiler): add --compile option
Resolves #196
2021-11-30 17:42:28 +01:00
rudy
ddca6840f1 fix(CompilerEngine): include mlir diagnostic in error message
Resolves #288

example
before:
Failed to lower to LLVM dialect

after:
Failed to lower to LLVM dialect
test.mlir:3:10: error: unexpected error: 'linalg.copy' op expected indexing_map #1 to have 2 dim(s) to match the number of loops
    %0 = tensor.extract_slice %arg0[0, 0] [3, 1] [1, 1] : tensor<3x2x!HLFHE.eint<3>> to tensor<3x!HLFHE.eint<3>>
         ^
2021-11-29 17:15:46 +01:00
Andi Drebes
5999d402ec enhance(compiler): CompilerEngine: Forward parse errors instead of printing them
By default, `mlir::SourceMgrDiagnosticVerifierHandler` used by
`CompilerEngine::compile()` prints parse errors to
`llvm::errs()`. This makes it impossible for a caller of
`CompilerEngine::compile()` to process parse errors or to suppress the
emission of error messages to the standard error stream altogether.

This change captures parse errors in a string via a string-backed
output stream and forwards the error message in the `llvm::Error`
instance of the return value.
2021-11-03 12:05:12 +01: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
Quentin Bourgerie
41cba63113 refactor(compiler): Move the keyset generation from CompilerEngine to JitCompilerEngine 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
ba54560680 feat(compiler): Lower HLFHELinalg binary operators 2021-10-29 12:17:38 +02:00
youben11
01757fa6d5 fix: forward errors instead of creating new ones
LLVM errors should be handled/consumed. Creating a new one and leaving
the previous one alive will crash the compiler. Whenever we don't want a
crash (e.g. logging the error is enough), but still wanna continue the
execution, we can just consume it.
2021-10-12 11:50:15 +01:00
Andi Drebes
2acfa63eb7 feat(compiler): Determine FHE circuit constraints instead of using default values
This replaces the default FHE circuit constrains (maximum encrypted
integer width of 7 bits and a Minimal Arithmetic Noise Padding of 10
with the results of the `MaxMANP` pass, which determines these values
automatically from the input program.

Since the maximum encrypted integer width and the maximum value for
the Minimal Arithmetic Noise Padding can only be derived from HLFHE
operations, the circuit constraints are determined automatically by
`zamacompiler` only if the option `--entry-dialect=hlfhe` was
specified.

For lower-level dialects, `zamacompiler` has been provided with the
options `--assume-max-eint-precision=...` and `--assume-max-manp=...`
that allow a user to specify the values for the maximum required
precision and maximum values for the Minimal Arithmetic Noise Padding.
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
Quentin Bourgerie
697d4033e1 fix(compiler): typo 2021-09-06 10:26:40 +02:00
Quentin Bourgerie
af0789f128 enhance(compiler/runtime): Add runtime tools to handle tensor inputs and outputs 2021-09-06 10:26:40 +02:00
Quentin Bourgerie
8057ee7553 refactor(compiler): Prepare the MidLFHE parameters injection 2021-08-24 16:21:31 +02:00
youben11
f948db1228 feat(python): CompilerEngine to compile and run 2021-08-18 17:38:46 +02:00