Commit Graph

3314 Commits

Author SHA1 Message Date
Andi Drebes
21a7eead6c refactor(compiler): Re-implement TFHE multi-parameter parametrization with type inference
The current pass applying the parameters determined by the optimizer
to the IR propagates the parametrized TFHE types to operations not
directly tagged with an optimizer ID only under certain conditions. In
particular, it does not always properly propagate types into nested
regions (e.g., of `scf.for` loops).

This burdens preceding transformations that are applied in between the
invocation of the optimizer and the parametrization pass with
data-flow analysis and book-keeping in order to tag newly inserted
operations with the right optimizer IDs that ensure proper
parametrization.

This commit replaces the current parametrization pass with a new pass
that propagates parametrized TFHE types up and down def-use chains
using type inference and a proper rewriter. The pass is limited to the
operations supported by `TFHEParametrizationTypeResolver::resolve`.
2024-02-01 16:18:45 +01:00
Andi Drebes
775171c69d fix(compiler): Run canonicalizer after TFHE circuit parametrization
In order to avoid leftover TFHE operations to be lowered further down
the pipeline after parametrization, run the canonicalizer, which
includes dead code eliminiation.
2024-02-01 16:18:45 +01:00
Andi Drebes
bc171dde82 test(compiler): Run canonicalizer in TFHE parametrization tests 2024-02-01 16:18:45 +01:00
Andi Drebes
79d8337026 feat(compiler): Add support for batched keyswitch ops in TFHE key normalization 2024-02-01 16:18:45 +01:00
Andi Drebes
1faeb2d10d feat(compiler): Add rewriter applying the results from type inference
This adds the `TypeInferenceRewriter` class, which applies the results
for type inference obtained from the state of a `DataFlowSolver` and
from a final invocation of a type resolver to a module.
2024-02-01 16:18:45 +01:00
Andi Drebes
43180a70be feat(compiler): Add infrastructure for type inference
Type inference is implemented through the two classes
`ForwardTypeInferenceAnalysis` and `BackwardTypeInferenceAnalysis`,
which can be used as forward and backward dataflow analyses with the
MLIR sparse dataflow analysis framework.

Both classes rely on a type resolver, which must be a class inheriting
`TypeResolver` and that specifies which types are to be considered as
unresolved and that resolves the actual types for the values related
to an operation based on the previous state of type inference.

The type inference state for an operation is represented by an
instance of the class `LocalInferenceState`, which maps the values
related to an operation to instances of `InferredType` (either
indicating the inferred type as an `mlir::Type` or indicating that no
type has been inferred, yet).

The local type inference by a type resolver can be implemented with
type constraints (instances of sub-classes of `TypeConstraint`), which
can be combined into a `TypeConstraintSet`. The latter provides a
function that attempts to apply the constraints until the resulting
type inference state converges.

There are multiple, predefined type constraint classes for common
constraints (e.g., if two values must have the same type or the same
element type). These exist both as static constraints and as dynamic
constraints. Some pre-defined type constraints depend on a class that
yields a pair of values for which the contraints shall be applied
(e.g., yielding two operands or an operand and a result, etc.).
2024-02-01 16:18:45 +01:00
Andi Drebes
e78883cc24 feat(compiler): Add a dialect for type inference debugging
The `TypeInference` dialect provides three operations.

The operation `TypeInference.propagate_downwards` respresents a type
barrier, which is supposed to forward the type of its operand as its
result type during type inference.

The operation `TypeInference.propagate_upwards` also respresents a
type barrier, but is supposed to forward the type of its result as the
type for its operand during type inference.

The operation `TypeInference.unresolved_conflict` can be used as a
marker when two different types have beed inferred for a value (e.g.,
one type during forward dataflow analysis and the other during
backward dataflow analysis)
2024-02-01 16:18:45 +01:00
Andi Drebes
9ca9369413 chore(compiler): Bump MLIR fork to version with fix for backward dataflow analysis 2024-02-01 16:18:45 +01:00
Andi Drebes
8b1c6ab034 fix(compiler): Fix typos in the summaries of batched TFHE ops 2024-02-01 16:18:45 +01:00
Umut
000ca60062 feat(frontend-python): if then else extension nightly-2024.02.02 2024-02-01 12:18:52 +02:00
Umut
868a910e23 chore(frontend-python): fix pylint warnings 2024-02-01 12:18:52 +02:00
rudy
fe4735162f fix(ci): use bigger storage to account for keys in concrete tests 2024-02-01 10:22:09 +02:00
Andi Drebes
8d71dc2028 feat(compiler): Add verifier to TFHE.encode_expand_lut_for_bootstrap nightly-2024.02.01 nightly-2024.01.30 nightly-2024.01.31 2024-01-29 15:35:14 +01:00
Andi Drebes
ea07239732 feat(compiler): Add verifiers to TFHE bootstrap operations 2024-01-29 15:35:10 +01:00
Andi Drebes
a133407035 test(compiler): Fix the size of lookup tables used in tests with bootstrap operations
Some of the tests use lookup tables whose numbers of elements do not
match the sizes of the polynoms of the bootstrap operations they are
passed to. This commit replaces these lookup tables with tables of the
right size.
2024-01-29 15:28:49 +01:00
Alexandre Péré
f113e8bcfe fix(ci): fix the doc verification nightly-2024.01.27 2024-01-26 17:15:03 +01:00
Alexandre Péré
a02bf3bae9 fix(optimizer): compiler output forwarding
In the optimizer, nodes without consumers are identified as outputs.
Since we can now return multiple values, this is inherently buggy,
since a value can then be both returned, and consumed to create another
input.

This commit fixes this by allowing the compiler to tag nodes as being
outputs.
2024-01-26 17:15:03 +01:00
Alexandre Péré
166a3217ad docs(frontend): add doc for weak composition nightly-2024.01.26 2024-01-25 17:21:54 +01:00
Umut
4999c1ebfe chore(ci): use apt instead of dnf when testing python frontend when releasing 2024-01-25 12:42:08 +03:00
yuxizama
06777f8556 docs: update badges and links 2024-01-25 10:28:00 +01:00
yuxizama
59133e4bec docs: update README.md
update support banner
2024-01-25 10:28:00 +01:00
Umut
037600112d feat(frontend-python): drawing nightly-2024.01.24 nightly-2024.01.25 2024-01-23 11:42:26 +03:00
Alexandre Péré
9beb98c141 chore(optimizer): allow debug mode compilation nightly-2024.01.23 2024-01-22 15:54:02 +01:00
Alexandre Péré
b2fbf8eb28 fix(frontend): fix composition bitwidth incompatibility nightly-2024.01.20 2024-01-19 18:25:23 +01:00
Ben
75132edf37 docs(frontend): include docs changes from #593 2024-01-19 12:06:32 +03:00
Ben
749096dda9 docs(frontend): v2.5 diff language 2024-01-19 12:06:32 +03:00
Alexandre Péré
4df041c399 chore(optimizer): fix new nightly lints nightly-2024.01.19 2024-01-18 14:03:35 +01:00
Alexandre Péré
75d33d4f94 fix(optimizer): enhance error reported on non-composability 2024-01-18 14:03:35 +01:00
Alexandre Péré
2746bda27e chore(optimizer): add dot partitioning visualization 2024-01-18 14:03:35 +01:00
Alexandre Péré
52427d129b fix(optimizer): add test for composition with 3 partitions 2024-01-18 14:03:35 +01:00
Alexandre Péré
939ae72292 fix(optimizer): allow composability of input only circuits 2024-01-18 14:03:35 +01:00
rudy
cd390b02dc fix(optimizer): do not mix lsb and tlu-0bits from round nightly-2024.01.17 nightly-2024.01.16 nightly-2024.01.18 2024-01-15 14:42:25 +01:00
Umut
b4ed398549 fix(frontend-python): reduce the failure rate of setting keys test nightly-2024.01.13 2024-01-12 16:25:51 +03:00
rudy
6db7c5c1fe fix(common): version tag major.minor.revision(-whatever)? nightly-2024.01.12 2024-01-11 17:40:00 +01:00
Umut
8ef84bed42 feat(frontend-python): add relu extension 2024-01-11 16:09:42 +01:00
rudy-6-4
cc14e7a4f9 docs(frontend-python): bit extract performance nightly-2024.01.10 nightly-2024.01.11 2024-01-09 14:57:08 +01:00
Bourgerie Quentin
c438fb21d0 fix(compiler/benchamrk): Fix command line for compilation options of e2e tools 2024-01-09 12:40:31 +01:00
rudy
8183d98605 feat(frontend-python): multi-parameters, Configuration, by-precision-and-norm2 strategy nightly-2024.01.09 2024-01-08 20:32:27 +01:00
rudy
cb0679fc03 fix(optimizer): multi-parameters, tolerate overspecified partition_cut 2024-01-08 20:32:27 +01:00
rudy
c298408f26 feat(optimizer): multi-parameters, partitionning using norm2 2024-01-08 20:32:27 +01:00
rudy
b2f382f63a feat(optimizer): multi-parameters, do not bottleneck on the default partition 2024-01-08 20:32:27 +01:00
Jeremy Kun
bee264a1bb docs(compiler): fix readme 2024-01-08 17:08:05 +01:00
Bourgerie Quentin
da3a3b7c07 fix(compiler/benchmark): Use default compiler options for default command line tools 2024-01-08 14:45:54 +01:00
Bourgerie Quentin
f9c7a79183 refactor(compiler/frontend): Rename option to compress_evaluation_keys 2024-01-08 09:49:06 +01:00
rudy
9b685300b4 fix(frontend-python): ensure shift strategies coverage 2024-01-08 09:38:08 +01:00
rudy
b680f3137d fix(frontend-python): some tests are broken due to compiler and cp bug
related to multi output in multi parameter
2024-01-08 09:36:34 +01:00
rudy
0f819d864c fix(optimizer): accept composable for v0-no-dag and woppbs 2024-01-08 09:30:20 +01:00
Benoit Chevallier-Mames
c952d7b1f7 chore(frontend): using fhe.bits() feature in Game of Life example 2024-01-08 09:14:17 +01:00
Antoniu Pop
69efcee01b test(compiler): make benchmarks framework compatible with distributed execution. nightly-2024.01.06 2024-01-05 19:03:56 +00:00
Antoniu Pop
541a9fb2eb fix(compiler): distributed execution: fix dataflow runtime termination. 2024-01-05 19:03:56 +00:00