Commit Graph

398 Commits

Author SHA1 Message Date
Masato Tsutsumi
c838b7fdb6 fix(compiler): replace secret_seed with encryption_seed on client_support.py 2024-04-04 09:34:22 +02:00
rudy
15b22918df fix(optimizer): bad variance on zero noise input on levelled op 2024-04-03 14:34:46 +02:00
Bourgerie Quentin
406804609c fix(compiler): Handle tensor.empty in the pass that lower tfhe to the simulatation code 2024-03-25 15:32:27 +01:00
Umut
790d6ffa94 feat(compiler): remove p+1 requirement for clear values 2024-03-21 13:17:14 +03:00
Alexandre Péré
170002ff20 feat(frontend-python): add support for multi-circuits 2024-03-19 14:13:18 +01:00
Umut
d13b283f98 feat(frontend-python): disable and print tlu fusing 2024-03-19 09:39:06 +01:00
Antoniu Pop
312f505063 feat(ci): add distributed CI test run target 2024-03-18 13:39:03 +00:00
Andi Drebes
97292ed85f test(compiler): Add tests for type inference on IR with scf.forall operations 2024-03-14 06:45:53 +01:00
Andi Drebes
d79c76a872 feat(compiler): Add support for tiling of linalg.generic operations
This adds support for the tiling of `linalg.generic` operations that
have only parallel iterators or only parallel iterators and a single
reduction dimension via the linalg tiling infrastructure (i.e.,
`mlir::linalg::tileToForallOpUsingTileSizes()` and
`mlir::linalg::tileReductionUsingForall()`).

This allows for the tiling of FHELinalg operations by first replacing
them with appropriate `linalg.generic` oeprations and then invoking
the tiling pass in the pipeline. In order for the tiling to take
place, tile sizes must be specified using the `tile-sizes` operation
attribute, either directly for `linalg.generic` operations or
indirectly for the FHELinalg operation, e.g.,

  "FHELinalg.matmul_eint_int"(%a, %b) { "tile-sizes" = [0, 0, 7] } : ...

Tiling of operations with a reduction dimension is currently limited
to tiling of the reduction dimension, i.e., the tile sizes for the
parallel dimensions must be zero.
2024-03-14 06:45:53 +01:00
Andi Drebes
55a6041943 feat(compiler): Add support for tiled TFHE IR in TFHE parametrization pass
Add the required patterns for `tensor.empty` and `scf.forall` to the
TFHE circuit parametrization pass.
2024-03-14 06:32:19 +01:00
Andi Drebes
55d54a9c7f feat(compiler): Add pass replacing linalg.fill with linalg.generic 2024-03-14 06:32:19 +01:00
Andi Drebes
f89947a580 feat(compiler): Add support for scf.forall and associated ops in TFHE key normalization pass 2024-03-14 06:32:19 +01:00
Andi Drebes
d10c1ca576 feat(compiler): Add support for scf.forall and associated ops in FHE to TFHE passes 2024-03-14 06:32:19 +01:00
Andi Drebes
2cd06580ee feat(compiler): Add support for scf.forall and associated ops in TFHE parametrization 2024-03-14 06:32:19 +01:00
Andi Drebes
63e53ff200 feat(compiler): Add support for scf.forall and associated ops in TFHE to Concrete pass 2024-03-14 06:32:19 +01:00
Andi Drebes
64eaeb068e feat(compiler): Add reinstantiating rewrite patterns for scf.forall and scf.forall.in_parallel 2024-03-14 06:32:19 +01:00
Andi Drebes
ff20f88c44 feat(compiler): Run SCFForallToSCFFor pass before lowering to LLVM dialect
This adds an invocation of the `SCFForallToSCFFor` pass to the
compilation pipeline before lowering to the LLVM dialect as a
sequential fallback path to future passes exploiting the parallelism
of `scf.forall` further up in the pipeline.
2024-03-14 06:32:19 +01:00
Andi Drebes
5a7bf5aed2 feat(compiler): Add pass converting scf.forall loops to nested scf.for operations
This adds a new pass that converts `scf.forall` loops into nested
`scf.for` operations. The conversion carries parallel output tensors
from the original loop as dependencies through the loop nest and
replaces any occurrence of `tensor.parallel_insert_slice` operations
in the `scf.forall.in_parallel` terminator with equivalent
`tensor.insert_slice` operations.
2024-03-14 06:32:19 +01:00
Andi Drebes
7a295f89bd feat(compiler): Make trip counts and memory usage optional in statistics passes
This makes the trip counts of operations in the TFHE statistics pass
as well as the per-location memory usage statistics in the memory
usage statistics pass optional. These values are unset if the trip
count could not be determined statically.
2024-03-14 06:32:19 +01:00
Andi Drebes
e6e5db6f51 refactor(compiler): Use common static loop analysis in TFHE / memory statistics 2024-03-14 06:32:19 +01:00
Andi Drebes
14f39fefe7 refactor(compiler): Separate code for static loop analysis from batching 2024-03-14 06:32:19 +01:00
Andi Drebes
13a5dff4fb fix(ci): Disable levelled tests {signed_,}mul_eint_Xbits for X >= 10 on MacOS
The tests `end_to_end_leveled.jit.loop_dagmulti.mul_eint_10bits.0` and
`end_to_end_leveled.jit.loop_dagmulti.signed_mul_eint_10bits.0`
reproducibly fail on the mac2.metal instance used by the CI due to
insufficient memory. This change disables all instances of these tests
with 10 or more bits of precision on MacOS.
2024-03-14 06:32:19 +01:00
Benoit Chevallier-Mames
e37a840e7e docs(compiler): adding API doc 2024-03-13 17:10:00 +01:00
Bourgerie Quentin
5370fb3cf9 fix(compiler): Do not reinstantiate csprng each time in the simulation backend 2024-03-13 16:28:52 +01:00
Bourgerie Quentin
9dcf1c4b6f feat(frontend-python): Expose compress_input_ciphertexts as a compilation options and tests 2024-03-12 17:58:40 +01:00
Bourgerie Quentin
3043573922 refactor(compiler/tests): Move bug and boolean to specific yaml files 2024-03-12 16:57:06 +01:00
Bourgerie Quentin
e0a7aaa479 test(compiler): Run all tests only on default options and run random tests on several options to tests 2024-03-12 16:57:06 +01:00
Bourgerie Quentin
1804081064 refactor(compiler): Refactor options naming of the end-to-end-test tool 2024-03-12 16:57:06 +01:00
Bourgerie Quentin
d3cb43b517 fix(compiler): Put dag-multi as default optimizer strategy 2024-03-12 16:57:06 +01:00
Bourgerie Quentin
721858346a refactor(compiler): Just reorder options for better readability 2024-03-12 16:57:06 +01:00
Bourgerie Quentin
2ac4f52ca5 feat(compiler/tests): Add random-tests options to end-to-end-test tool 2024-03-12 16:57:06 +01:00
Bourgerie Quentin
6b4ce8889b feat(compiler): Add input ciphertext compression with seeded ciphertext 2024-03-12 16:57:06 +01:00
Bourgerie Quentin
0fdc7d78ff perf(compiler): Use parallel implementation to decompress bs and ks keys 2024-03-11 16:51:05 +01:00
Andi Drebes
b9589146f4 test(compiler): Add tests generating explicit optimizer partition frontiers 2024-03-07 15:42:26 +01:00
Andi Drebes
9b6878316f fix(compiler): Preserve explicit optimizer partition boundaries through the pipeline
The Concrete Optimizer is invoked on a representation of the program
in the high-level FHELinalg / FHE Dialects and yields a solution with
a one-to-one mapping of operations to keys. However, the abstractions
used by these dialects do not allow for references to keys and the
application of the solution is delayed until the pipeline reaches a
representation of the program in the lower-level TFHE dialect. Various
transformations applied by the pipeline along the way may break the
one-to-one mapping and add indirections into producer-consumer
relationships, resulting in ambiguous or partial mappings of TFHE
operations to the keys. In particular, explicit frontiers between
optimizer partitions may not be recovered.

This commit preserves explicit frontiers between optimizer partitions
as `optimizer.partition_frontier` operations and lowers these to
keyswitch operations before parametrization of TFHE operations.
2024-03-07 15:42:26 +01:00
Andi Drebes
a701b3a742 feat(compiler): Add support for tensor.empty in the pipeline from FHE to std 2024-03-06 14:50:27 +01:00
Andi Drebes
8e660e2f75 feat(compiler): Add dialect with operations related to the optimizer
This adds a new dialect called `Optimizer` with operations related to
the Concrete Optimizer. Currently, there is only one operation
`optimizer.partition_frontier` that can be inserted between a producer
and a consumer which belong to different partitions computed by the
optimizer. The purpose of this operation is to preserve explicit key
changes from the invocation of the optimizer on high-level dialects
(i.e., FHELinalg / FHE) until the IR is provided with actual
references to keys in low-level dialects (i.e., TFHE).
2024-03-06 14:50:27 +01:00
Andi Drebes
3d16efb681 feat(compiler): Add functions for type inference debugging to TypeInferenceUtils
The main debugging function is
`TypeInferenceUtils::dumpAllState(mlir::Operation* op)` which dumps
the entire state of type inference for the function containing `op`.
2024-03-06 14:50:27 +01:00
Andi Drebes
282cacaef4 fix(compiler): Do not omit assignment of optimizer ID to FHE.reinterpret_precision
The DAG pass establishing a mapping between operations in the IR and
the optimizer DAG currently omits assignment of the optimizer ID to
`FHE.reinterpret_precision` operations via the `TFHE.OId`
attribute. This prevents subsequent passes from determining to which
optimizer partition a `FHE.reinterpret_precision` operation belongs.

This commit removes the early exit in `FunctionToDag::addOperation`
for the handling of `FHE.reinterpret_precision` that prevented the
code assigning the optimizer ID from being executed.
2024-03-06 14:50:27 +01:00
Bourgerie Quentin
7651cb1129 fix(compiler): Guard decompression of seeded keys to avoid access conflicts in parallel programs 2024-03-06 14:43:40 +01:00
Alexandre Péré
9b5a2e46da feat(compiler): support multi-circuit compilation 2024-03-01 15:35:52 +01:00
Antoniu Pop
bda568ab6b feat(compiler): distributed execution - on-demand key transfer to remote nodes. 2024-02-23 13:55:52 +00:00
Antoniu Pop
da1f30023f feat(compiler): upgrade HPX library version to 1.9.1. 2024-02-23 10:31:18 +00:00
Umut
29503dfc17 feat(compiler): fusing table lookups 2024-02-20 12:39:57 +01:00
Bourgerie Quentin
22bbdec086 fix(ci/compiler): Remove KeySetCache directory on mac os CI to avoid space disk issues 2024-02-20 09:17:13 +01:00
Alexandre Péré
c53985f112 fix(compiler): fix double free on aliased outputs 2024-02-19 16:14:12 +01:00
Alexandre Péré
d1b62462f2 fix(compiler): fix mac arm exception propagation
On Mac arm, the c api backing the python bindings does not propagate the
exceptions properly to the concretelang python module. This makes all
exceptions raised through `CompilerEngine.cpp` fall in the catch-all
case of the pybind exceptions handler.

Since there is no particular need for a public c api, we just remove it
from the bindings, and move all the content of `CompilerEngine.cpp`
directly in the `CompilerAPIModule.cpp` file.
2024-02-14 15:08:19 +01:00
Bourgerie Quentin
ebea2e3cae chore(ci): Reduce number of compiler test for macos 2024-02-13 17:02:46 +01:00
Bourgerie Quentin
7c3e4388aa chore(ci): Use a stable version of the nightly rust toolchain for concrete-cpu build 2024-02-13 17:02:46 +01:00
rudy
86e88443fc feat(optimizer): accept high precision weight 2024-02-08 17:53:23 +01:00