Commit Graph

204 Commits

Author SHA1 Message Date
Bourgerie Quentin
1b0106302b fix(optimizer/backend-cpu): Fix Cargo.lock to avoid flaky dependencies 2023-06-30 16:08:43 +02:00
Umut
6fdcb78158 fix(compiler-bindings): use manual function pointer type to avoid compilation error on macOS 2023-06-27 18:36:22 +02:00
youben11
648e868ffe feat(compiler): support parallelization during simulation 2023-06-27 14:21:42 +01:00
youben11
3ad37522e5 test(compiler): test compile/run in simulation 2023-06-27 14:21:42 +01:00
youben11
27e1835f23 feat(compiler/python): expose simulation to python-bindings 2023-06-27 14:21:42 +01:00
youben11
eb116058e0 feat(compiler): support invoke on simulated circuits 2023-06-27 14:21:42 +01:00
youben11
32ad46f7c5 feat(compiler): disable runtimeCtx pass in simulation 2023-06-27 14:21:42 +01:00
youben11
5e848a6971 feat(compiler/clientlib): support simulation in enc-args 2023-06-27 14:21:42 +01:00
youben11
09b84e0373 refactor(compiler/clientlib): add ValueDecrypter Interface 2023-06-27 14:21:42 +01:00
youben11
ad13602bf3 refactor(compiler/clientlib): add ValueExporter Interface 2023-06-27 14:21:42 +01:00
youben11
7b594c5ecd feat(compiler): add simulation runtime 2023-06-27 14:21:42 +01:00
youben11
b8e462c1cc feat(compiler): add option to compile in simulation mode 2023-06-27 14:21:42 +01:00
youben11
e58b46d86d feat(compiler): add a pass to simulate TFHE ops
lowering is done to CAPI calls that implement simulation as well as
standard MLIR ops
2023-06-27 14:21:42 +01:00
Umut
c98b8f0241 fix(frontend-python): manually abort on ctrl+c 2023-06-27 15:11:21 +02:00
Bourgerie Quentin
29f1ce753b fix(optimizer): new version of generated files
This reverts commit 9b345e51ed.
2023-06-27 11:06:32 +02:00
Bourgerie Quentin
6a49fc3a1d test(compiler): Temporary disable matmul_eint_eint on 16bits integer 2023-06-26 22:49:56 +02:00
Andi Drebes
934e25de0d test(compiler): Let entire Makefile rules for tests / benchmarks fail if subcommand fails
The commands for the Makefile rules `run-end-to-end-tests` and
`run-cpu-benchmarks` are generated using the `$(foreach)` builtin
function with a trailing `;` for each subcommand. The result is a
sequence of commands separated by `;`, which only fails if the last
command fails. This causes any code for which the last test /
benchmark passes, but for which any of the preceding subcommands fails
to pass the CI and thus to leave failing tests undiscovered.

This commit adds a trailing `&& exit $$?` to each command, such that
the entire sequence fails if a single command fails.
2023-06-26 22:49:56 +02:00
Quentin Bourgerie
9b345e51ed Revert "fix(optimizer): new version of generated files"
This reverts commit db3ecb1402.
2023-06-26 17:06:02 +02:00
Quentin Bourgerie
41a911603b Revert "fix(optimizer): best complexity was not updated in the function optimize_1_fks_and_all_compatible_ks"
This reverts commit 48e8842ef0.
2023-06-26 17:06:02 +02:00
Quentin Bourgerie
7147fb8f35 Revert "fix(optimizer): updating optimize_1_fks_and_all_compatible_ks function in odrer to return the best solution"
This reverts commit aff3d91278.
2023-06-26 17:06:02 +02:00
Umut
45e69798aa feat(frontend-python): support ctrl+c during compilation and key generation 2023-06-26 12:37:52 +02:00
jadkhatib
aff3d91278 fix(optimizer): updating optimize_1_fks_and_all_compatible_ks function in odrer to return the best solution 2023-06-23 18:42:58 +02:00
jadkhatib
48e8842ef0 fix(optimizer): best complexity was not updated in the function optimize_1_fks_and_all_compatible_ks 2023-06-23 18:42:58 +02:00
jadkhatib
db3ecb1402 fix(optimizer): new version of generated files 2023-06-23 18:42:58 +02:00
Bourgerie Quentin
ff02adea89 test(compiler): Add bug report 376 2023-06-23 14:34:23 +02:00
Bourgerie Quentin
5147ac8418 feat(compiler): Add canonicalization of FHE/FHELinalg to_signed to_unsigned ops 2023-06-23 14:34:23 +02:00
Bourgerie Quentin
5a80e22cf3 fix(compiler): Annotate FHELinalg as Pure for canonicalization 2023-06-23 14:34:23 +02:00
Bourgerie Quentin
d946f16345 test(compiler): Add a minimal test for catching crt dimension added to clear tensor input 2023-06-21 12:14:11 +01:00
Ayoub Benaissa
3bdebae1f6 fix(compiler): fix plaintext tensor shape when using crt
client parameter generation was removing last dimension of a tensor when using CRT including plaintext ones, while it should only be done for encrypted ones.
2023-06-21 12:14:11 +01:00
Bourgerie Quentin
b6da228dd4 fix(compiler): Add extra conversion keyswitch just after bootstrap
Rely on strong asumptions of the optimization (see comment)

close https://github.com/zama-ai/concrete-internal/issues/352
2023-06-21 08:53:36 +02:00
Antoniu Pop
9363c40753 fix(compiler): fix key serialization for distributed computing in DFR.
Key serialization for transfers between nodes in clusters was broken
since the changes introduced to separate keys from key parameters and
introduction of support for multi-key (ref
cacffadbd2).

This commit restores functionality for distributing keys to non-shared
memory nodes.
2023-06-19 09:54:21 +01:00
Mayeul@Zama
e360e938c9 feat(optimizer): add table u32, u128 2023-06-15 10:48:07 +02:00
Mayeul@Zama
2e94c21970 chore(optimizer): fix formatting 2023-06-15 10:48:07 +02:00
Mayeul@Zama
97b13e871c feat(optimizer): introduce fft precision 2023-06-15 10:48:07 +02:00
Mayeul@Zama
5659195dbc feat(optimizer): accept any ciphertext_modulus_log 2023-06-15 10:48:07 +02:00
Andi Drebes
549d2ded86 feat(compiler): Batching: Favor batching of all operands for binary TFHE ops
This changes the order of batching variants for binary TFHE
operations, such that batching of both operands is favored over
batching of a single operand.
2023-06-12 22:51:30 +01:00
Antoniu Pop
81eaaa7560 feat(compiler): add multi-gpu scheduler for batched ops. Scheduler splits op batches in chunks to fit GPU memory and balance load across GPUs. 2023-06-12 22:51:30 +01:00
Andi Drebes
38e14446d6 feat(compiler): Batching: Add pattern folding operations on tensors of constants
This adds a new pattern to the batching pass that folds operations on
tensors of constants into new tensors of constants. E.g.,

  %cst = arith.constant dense<...> : tensor<Nxi9>
  %res = scf.for %i = %c0 to %cN {
    %cst_i9 = tensor.extract %cst[%i]
    %cst_i64 = arith.extui %cst_i9 : i64
    ...
  }

becomes:

  %cst = arith.constant dense<...> : tensor<Nxi64>
  %res = scf.for %i = %c0 to %cN {
    %cst_i64 = tensor.extract %cst[%i]
    ...
  }

The pattern only works for static loops, indexes that are quasi-affine
expressions on single loop induction variables with a constant step
size across iterations and foldable operations that have a single
result.
2023-06-12 22:51:30 +01:00
Andi Drebes
3516ae7682 feat(compiler): Add option for maximum batch size to batching pass
This adds a new compilation option `maxBatchSize` and a command line
option `--max-batch-size` to `concretecompiler`.
2023-06-12 22:51:30 +01:00
Andi Drebes
38a5b5e928 feat(compiler): Add support for batching with multiple batchable operands
The current batching pass only supports batching of operations that
have a single batchable operand, that can only be batched in one way
and that operate on scalar values. However, this does not allow for
efficient batching of all arithmetic operations in TFHE, since these
are often applied to pairs of scalar values from tensors, to tensors
and scalars or to tensors that can be grouped in higher-order tensors.

This commit introduces three new features for batching:

  1. Support of multiple batchable operands

     The operation interface for batching now allows for the
     specification of multiple batchable operands. This set can be
     composed of any subset of an operation's operands, i.e., it is
     not limited to sets of operands with contiguous operand indexes.

  2. Support for multiple batching variants

     To account for multiple kinds of batching, the batching operation
     interface `BatchableOpInterface` now supports variants. The
     batching pass attempts to batch an operation by trying the
     batching variants expressed via the interface in order until it
     succeeds.

  3. Support for batching of tensor values

     Some operations that could be batched already operate on tensor
     values. The new batching pass detects those patterns and groups
     the batchable tensors' values into higher-dimensional tensors.
2023-06-12 22:51:30 +01:00
Antoniu Pop
20394368bf feat(compiler): add lowering of batched mapped bootstrap operations to wrappers and SDFG, with support in the runtime. 2023-06-12 22:51:30 +01:00
Andi Drebes
5a6ed84076 fix(compiler): Batching: Do not attempt to extract static bounds for dynamic loops
The batching pass erroneously assumes that any expression solely
composed of an induction variable has static bounds. This commit adds
a test for the lower bound, upper bound and step checking that they
are indeed static before attempting to determine their static values.
2023-06-12 22:51:30 +01:00
Antoniu Pop
3a679a6f0a feat(compiler): add mapped version of batched bootstrap wrappers for CPU and GPU. 2023-06-12 22:51:30 +01:00
Antoniu Pop
7407948b18 test(compiler): add SDFG as default to GPU backend options and batched SDFG GPU test. 2023-06-12 22:51:30 +01:00
Antoniu Pop
3f9f228a23 feat(compiler): add runtime support for batched operations in SDFG/GPU. 2023-06-12 22:51:30 +01:00
Antoniu Pop
60412f7f61 feat(compiler): add SDFG op generation for batched operations. 2023-06-12 22:51:30 +01:00
Antoniu Pop
3f230957cb feat(compiler): add batched operations for all levelled ops. 2023-06-12 22:51:30 +01:00
Antoniu Pop
799e64e8ab feat(compiler): add task creation using vectors of futures as inputs and outputs. 2023-06-12 22:51:30 +01:00
Andi Drebes
d94993ede2 fix(compiler): Replace in-place updated with conversion patterns when lowering TFHE to Concrete
The current scheme with in-place updates of the types of values may
result in operations recognized as legal and thus preventing them from
being converted when the operations producing their operands have been
converted earlier, as their types have been updated and legality is
solely based on types.

For example, the conversion pattern for an `tensor.insert_slice`
operation working on tensors of encrypted values may not trigger if
the operations producing its operands have been converted, leaving the
operation with updated operand types with the extra dimension added by
the type conversion from TFHE to Concrete, but with unmodified sizes,
strides and offsets, not taking into account the extra dimension. This
causes the verifier of the affected operation to fail and the
compilation to abort.

By using op conversion patterns, the original types of each operation
are preserved during the actual rewrite, correctly triggering all
conversion patterns based on the legality of data types.
2023-06-12 22:51:30 +01:00
Umut
3ec17a74b6 feat(frontend-python): support python 3.11 2023-06-12 14:34:23 +02:00