Commit Graph

565 Commits

Author SHA1 Message Date
youben11
59d35619a8 feat: lower and exec boolean mux 2023-02-09 09:43:48 +01:00
youben11
7e60f87141 refactor: remove chunked_eint
the pass transforming operations on chunked_eint will operate now on
eint
2023-02-07 12:27:01 +01:00
youben11
bb87d29934 feat: support chunked integer during enc/dec/exec 2023-02-07 12:27:01 +01:00
youben11
d41d14dbb8 feat: lower FHE.add on eint64 to ops on smaller chunks
this is a first commit to support operations on U64 by decomposing them
into smaller chunks (32 chunks of 2 bits). This commit introduce the
lowering pass that will be later populated to support other operations.
2023-02-07 12:27:01 +01:00
aPere3
fb680340f9 feat(concrete-compiler): add new ciphertext multiplication operator 2023-02-06 11:30:31 +01:00
aPere3
a200ce43bd fix p-error in mul_eint_int test 2023-02-03 16:19:43 +01:00
aPere3
e95c53f2ff feat: support signed execution
Author: aPere3 <alexandre.pere@zama.ai>
Co-authored-by: Umut <umutsahin@protonmail.com>
2023-02-03 16:19:43 +01:00
aPere3
f913c39e5b fix(format): fix linter complaining 2023-02-03 14:29:17 +01:00
aPere3
9a6309a079 fix(concrete-compiler): add end-to-end tests for tensor ops 2023-02-03 14:29:17 +01:00
aPere3
002be243be fix(concrete-compiler): fix bug in crt slice ops 2023-02-03 14:29:17 +01:00
aPere3
2fbcd1a792 fix(concrete-compiler): reassociation maps are incorrect in crt mode
See #890.
2023-02-03 14:29:17 +01:00
Quentin Bourgerie
63334e138f fix: Fixing integer extension for plaintext encoding (close #847) 2023-02-02 14:28:23 +01:00
Andi Drebes
73fd6c5fe7 refactor(compiler): FHE to TFHE: Use OpConversionPattern for dialect conversion
Use `OpConversionPattern` instead of `OpRewritePattern` for operation
conversion during dialect conversion. This makes explicit and in-place
type conversions unnecessary, since `OpConversionPattern` already
properly converts operand types and provides them to the rewrite rule
through an operation adaptor.

The main contributions of this commit are the two class templates
`TypeConvertingReinstantiationPattern` and
`GenericOneToOneOpConversionPattern`.

The former allows for the definition of a simple replacement rule that
re-instantiates an operation after the types of its operands have been
converted. This is especially useful for type-polymorphic operations
during dialect conversion.

The latter allows for the definition of patterns, where one operation
needs to be replaced with a different operation after conversion of
its operands.

The default implementations for the class templates provide
conversions rules for operations that have a generic builder method
that takes the desired return type(s), the operands and (optionally) a
set of attributes. How attributes are discarded during a conversion
(either by omitting the builder argument or by passing an empty set of
attributes) can be defined through specialization of
`ReinstantiationAttributeDismissalStrategy`.

Custom replacement rules that deviate from the scheme above should be
implemented by specializing
`TypeConvertingReinstantiationPattern::matchAndRewrite()` and
`GenericOneToOneOpConversionPattern::matchAndRewrite()`.
2023-02-01 14:27:10 +01:00
Quentin Bourgerie
49b8bf484c fix: Do not assert fail with too large weight and fix computation of 2-Norm with negative weigth (close #892) 2023-02-01 10:50:46 +01:00
Quentin Bourgerie
d0308dda43 chore: Use parameters curves generated files and expose security level options 2023-01-30 15:14:53 +01:00
Antoniu Pop
f60bd16e2b fix(GPU): remove transfers of uninitialized data to GPU. 2023-01-30 15:08:38 +01:00
youben11
36f51ba0c2 feat: lower and exec boolean ops 2023-01-26 11:22:41 +01:00
tmontaigu
ee00672996 feat(rust): partially bind CircuitGate, EncryptionGate
This adds partial bindings of the CircuitGate, EncrytionGate
and Encoding types for the rust frontend
2023-01-24 15:49:44 +01:00
tmontaigu
8e8651c6a6 chore(rust): rename crate
Renames the crate from `concrete_compiler_rust` to
`concrete-compiler`.

- The `_rust` is removed as its redundant, the crate is a rust project.
- The `_` are replaced with `-` as its the naming scheme for our other
  crates
2023-01-23 11:01:23 +01:00
rudy
bac3ed38e0 fix: apply_multi_lookup_table, remove costly workaround
Closes #881
2023-01-23 09:53:25 +01:00
rudy
b7668a7256 fix: apply_mapped_lookup_table, remove costly workaround
Closes #880
2023-01-19 14:57:18 +01:00
Quentin Bourgerie
d1ddd60a23 fix: Fixing the MANP computation for conv2d (close #883) 2023-01-19 13:32:59 +01:00
Antoniu Pop
0329d4fc2d fix(gpu-wrappers): fix KS/BS wrappers for GPU (memory management). 2023-01-18 19:33:07 +00:00
tmontaigu
ddf905b4db chore(rust): impl std::error::Error for CompilerError
All types which are errors should impl
the std::error::Error trait.

So that for example they could be put inside
a `Box<dyn std::error::Error>`.
2023-01-18 09:55:47 +01:00
youben11
95d49f4657 feat: add boolean types/ops in FHE dialect 2023-01-18 09:13:26 +01:00
tmontaigu
7c19da974a chore(rust): remove 'get_' prefix from getters
In rust the convention/guideline for getters is not to prefix them with `get_`.

This commit changes any `get_` getter function to follow that guideline.

See the API Guidelines: https://rust-lang.github.io/api-guidelines/naming.html?highlight=getter#getter-names-follow-rust-convention-c-getter
2023-01-17 15:24:59 +01:00
tmontaigu
e1171cf55f chore(rust): mark BufferRef::new as unsafe 2023-01-17 15:24:52 +01:00
tmontaigu
6f0fbc8a3d feat(rust): add from_tensor_[u32|u16] 2023-01-15 22:57:31 +01:00
tmontaigu
c9f3983577 fix(rust): serialize functions take self by ref 2023-01-14 11:45:58 +01:00
tmontaigu
6348eda50e fix(rust): properly give an array of location to mlirBlockCreate
The MlirBlock constructor expects one location per input argument
of the block.
2023-01-13 20:18:06 +01:00
tmontaigu
d188cfae54 fix(rust): change tinfo linking to ncurses
- tinfo is a part of the ncurses project.
- tinfo does not seem easily installable stand alone
  (no brew install tinfo, no dnf install tinfo-devel, etc)
  but installing ncurses is possible and generally makes tinfo
  'findable'
- on macos (M1 mac) it seems that even with ncurses installed
  tinfo is not found, but linking to ncurses fixes the problem
2023-01-13 19:32:50 +01:00
tmontaigu
237c7eee9b fix: remove unused but set variable 2023-01-13 13:05:22 +01:00
rudy
456e1952f5 fix: not private side effect in woppbs wrapper
Fix #865
2023-01-12 17:15:26 +01:00
youben11
91d41a2ff8 fix: add call to init dfr from python
Co-authored-by: Antoniu Pop <antoniu.pop@zama.ai>
2023-01-11 14:45:14 +01:00
rudy
d1cf650817 fix: overflow on high log norm2 2023-01-05 11:24:38 +01:00
rudy
80818bfc5d feat: use optimized private packing keyswitch 2023-01-04 17:41:49 +01:00
youben11
8c6a0859cd refactor(rust): add Rust wrapper for every CStruct
we want to wrap CStructs in RustStructs to own them, and free memeory
when they are no longer used. Users won't have to deal with the direct
binded CAPI, but the new wrappers
2023-01-02 12:10:14 +01:00
Antoniu Pop
aa2e0479b3 feat(compiler): add a parallel loop coalescing pass. 2023-01-02 12:04:34 +01:00
rudy
de779b2f6f fix: display compilation error in benchmark
the checking of llvm expected was not correct
2022-12-14 09:21:18 +01:00
rudy
bb756a6426 fix: default is global-error-probability=1/100_000 2022-12-14 09:21:18 +01:00
rudy
4ed0c01d8e feat(optimizer): option to disable optimizer cache
--optimizer-no-cache-on-disk
2022-12-13 18:54:40 +01:00
Quentin Bourgerie
d15c9822db fix(rust-bindings): Fix rust bindings after raise-encoding 2022-12-13 17:01:52 +01:00
Quentin Bourgerie
19fdbf652e fix(compiler): The crt loops are unary and should be init by a alloc_tensor 2022-12-13 17:01:52 +01:00
aPere3
2fd9b6f0e3 refactor(encodings): raise plaintext/lut encodings higher up in the pipeline 2022-12-13 17:01:52 +01:00
Antoniu Pop
7226c89cf1 enhance(compiler): coalesce loop nests before parallelization. 2022-12-13 15:23:29 +00:00
Andi Drebes
e2e6df322e feat(compiler): Add support for full unrolling of loops with SDFG-convertible ops
This adds a new option `--unroll-loops-with-sdfg-convertible-ops`,
which causes loops containing SDFG-convertible operations to be fully
unrolled upon the extraction of SDFG-operations using the
`--emit-sdfg-ops` switch. This avoids constant roundtrips between an
SDFG-capable accelerator and the host during execution of a loop.

The option is limited to `scf.for` loops with static bounds and a
static step size. Since full unrolling of loops with large bounds
results in a large number of operations, the option is disabled by
default.
2022-12-13 12:03:51 +01:00
Quentin Bourgerie
607457d34a fix(compiler): CRT multiplication with negative value (close: #834) 2022-12-09 17:28:03 +01:00
Antoniu Pop
0dbb86bb36 feat(compiler): add lowering and bufferization for SDFG dialect, generate code to Stream Emulator API. 2022-12-08 14:54:14 +01:00
Antoniu Pop
752f0feb75 feat(runtime): add a stream emulator. 2022-12-08 14:54:14 +01:00
Andi Drebes
ee2f743a78 feat(compiler): Add new action dump-sdfg
Add a new action `dump-sdfg` to `concretecompiler` that causes the IR
to be dumpred right after the extraction of SDFG operations.
2022-12-08 14:54:14 +01:00