Commit Graph

480 Commits

Author SHA1 Message Date
youben11
bce7fe30ba fix(ci): build compiler image with cuda11.8
previous version was not working properly (too recent). So we switched
to 11.8 and thus downgraded to gcc11. The reason for using ?= in the
Makefile is to default to gcc11 in the docker image, as those variables
are set in the env.
2024-06-13 13:41:11 +01:00
Umut
81b04a3562 fix(compiler): use maxpool strides properly when lowering to linalg 2024-06-11 18:32:02 +03:00
Alexandre Péré
5185940807 feat(frontend): add support for wires to concrete-python 2024-06-11 13:23:03 +02:00
Bourgerie Quentin
db2c7550f5 fix(compiler): Allow uncompressed ciphertext in compressed gate to fix composition + compression 2024-06-04 16:12:18 +02:00
Antoniu Pop
0a1934c2ee fix(compiler): fix input parameter deserialization where total data input overflows 32bit accumulator. 2024-05-30 08:11:29 +01:00
Umut
c677f83af7 feat(frontend-python): dynamic indexing 2024-05-29 18:21:46 +03:00
Alexandre Péré
15816354aa feat(optimizer): add support for circuits and composition rules 2024-05-28 09:10:04 +02:00
youben11
974830e40d fix(compiler): control overflow detection for LUT via flag 2024-05-28 07:28:45 +01:00
aquint-zama
08a1871252 chore(compiler): update black dev dependency 2024-05-24 09:48:15 +02:00
youben11
6637b659db feat(compiler/frontend): add flag to enable/disable overflow detection
in simulation
2024-05-24 07:52:03 +01:00
Andi Drebes
2caafc7f3b feat(compiler): Allow dag-multi optimization strategy for data-flow parallelization
With the type inference pass now being able to handle RT operations
and multiple functions, the restriction disallowing data-flow
parallelization when choosing the dag-multi optimization strategy can
be lifted. Remove the check and bail out in `CompilerEngine.cpp`.
2024-05-16 12:07:51 +02:00
Andi Drebes
1703f08e78 feat(compiler): Type Inference: Add support for RT operations
This adds support for the operations `RT.await_future`,
`RT.build_return_ptr_placeholder`, `RT.create_async_task`,
`RT.deref_return_ptr_placeholder`,
`RT.deref_work_function_argument_ptr_placeholder`,
`RT.make_ready_future`, `RT.register_task_work_function`, and
`RT.work_function_return`, the RT types `RT.ptr` and `RT.future`, as
well as the auxiliary operation `arith.select`.
2024-05-16 12:07:51 +02:00
Antoniu Pop
2da8644e57 fix(compiler): fix lowering of tasks generated from loop tiling pass. 2024-05-16 12:07:51 +02:00
Andi Drebes
a5afb1f0a6 feat(compiler): Type Inference: Add support for multiple functions
The type inference pass currently only supports a single function as
it is unable to infer types across function boundaries. This commit
adds support for multiple functions and tracks types across
`func.func`, `func.call` and function `constant` operations.
2024-05-16 12:07:51 +02:00
Andi Drebes
d270886091 refactor(compiler): Type inference: Enable debugging output for entire modules 2024-05-16 12:07:51 +02:00
Andi Drebes
26bed92ee7 fix(compiler): Type Inference: Defer erasure of functions to the end of the rewriting
A function may be referenced at multiple sites, including at locations
that have not been visited by the rewriter when the function itself is
rewritten. By using `IRRewriter::replaceOp` after rewriting a
function, the function is erased immediately, which may cause the
rewriting to fail due to remaining uses of the function.

Defering the erasure of functions to the end of the entire rewriting
process ensures that all uses of the original functions have been
updated to the rewritten functions.
2024-05-16 12:07:51 +02:00
Andi Drebes
c1d742adf0 fix(compiler): Type Inference: Support ops with regions containing multiple blocks
Operations with regions containing multiple blocks are currently not
handled correctly, since the list of successors of an operation is not
updated with rewritten blocks when the operation is
rewritten. Furthermore, functions were assumed to have only a single
block.

This change supports operations with multiple blocks by fixing the
issues above.
2024-05-16 12:07:51 +02:00
Andi Drebes
c371269896 fix(compiler): Type Inference: Allow unresolved types in TypeInferenceUtils::getInferredType 2024-05-16 12:07:51 +02:00
Andi Drebes
ebb08c788f fix(compiler): Type Inference: Register dependencies between op and its related values
Updates of the types inferred for the values related to an operation
only propagate correctly to the operation if there is a direct
producer-consumer relationship or an indirect producer-consumer
relationship via some additional mechanism (e.g., region
successors). However, this is not sufficient to ensure updates of
values and operations that are related otherwise.

This change explicitly models the dependencies between related values
and an operation via `DataFlowAnalysis::addDependency` in order to
guarantee that all updates of the types of values are propagated to
all operations that the type resolver has designated as related
operations.

Furthermore, all operations are visited once initially in order to
guarantee that updates propagate to operations, for which the dataflow
framework does not invoke `visitOperation`.
2024-05-16 12:07:51 +02:00
Andi Drebes
ea41400b90 feat(compiler): Type inference: Delegate enumeration of related values to TypeResolver
This delegates the enumeration of values related to an operation to
the class `TypeResolver`. This allows for the customization of this
process via a class inheriting `TypeResolver`.
2024-05-16 12:07:51 +02:00
Andi Drebes
c3366d9eef feat(compiler): Type Inference: Add support for tensor.dim 2024-05-16 12:07:51 +02:00
Andi Drebes
b297de93c4 refactor(compiler): Type inference: Generalize constraint for equal element types to nested types 2024-05-16 12:07:51 +02:00
youben11
b6a43cfc5c feat(compiler/simu): support signed integers 2024-05-15 10:53:42 +01:00
youben11
c655856b1c test(compiler): overflow in simulation 2024-05-15 10:53:42 +01:00
youben11
cae77e89bf feat(compiler/simu): add loc in overflow warnings 2024-05-15 10:53:42 +01:00
youben11
b953d57fe4 feat(compiler): warn when there is overflow in sim (native encoding) 2024-05-15 10:53:42 +01:00
youben11
001aba6809 refactor(compiler, simu): rewrite add/mul to CAPI calls 2024-05-15 10:53:42 +01:00
Umut
d954b279e8 fix(compiler): use exact passes on check tests to avoid reordering when new passes are introduced 2024-05-15 11:21:46 +03:00
Umut
8e4d237364 feat(compiler): fancy assignment 2024-05-15 11:21:46 +03:00
Umut
6e36d0f801 feat(compiler): tensor.generate to scf.forall 2024-05-15 11:21:46 +03:00
Umut
0b161c436f feat(compiler): fancy indexing operation 2024-05-15 11:21:46 +03:00
Bourgerie Quentin
efe223e181 fix(compiler): Share the decompress state instead of try to avoid copies
This partially reverts commit 081e8b7b74.
2024-05-14 15:08:34 +02:00
Bourgerie Quentin
081e8b7b74 fix(compiler): Decompression of evaluation keys was done several times 2024-05-06 11:53:34 +02:00
Antoniu Pop
73d254162b feat(compiler): [GPU runtime] add heuristic estimate of GPU vs. CPU core ratio and update CPU HW threads usedwhen not specified by user. 2024-05-03 11:58:56 +01:00
Antoniu Pop
05ee0a59c9 fix(compiler): [GPU backend] add SDFG_MAX_BATCH_SIZE environment variable to control batching limit. 2024-05-03 11:58:56 +01:00
Antoniu Pop
904cbae70a fix(compiler): [GPU backend] Restrict SDFG generation and batching to bootstrapping subgraphs to limit overhead. Restricts loop parallelism in loop nests where SDFG put/get operations occur as they have side effects. 2024-05-03 11:58:56 +01:00
Antoniu Pop
a431c9d4ef feat(compiler): [GPU backend] enable parallel loop collapsing for GPU backend using batching and fix loop coalescing infrastructure in MLIR to allow operation before bufferization. 2024-05-03 11:58:56 +01:00
Antoniu Pop
a3a6216cbf feat(compiler): [GPU runtime] add basic support for multiple keys on GPU. 2024-05-03 11:58:56 +01:00
Alexandre Péré
b96fecea16 chore(optimizer): please new rust compiler lints 2024-05-03 10:15:47 +02:00
Alexandre Péré
36cf48113a fix(optimizer): faulty output regeneration 2024-05-03 10:15:47 +02:00
Alexandre Péré
6f323e58a2 fix(optimizer): broken viz macro 2024-05-03 10:15:47 +02:00
rudy
1d0a63caa5 fix(optimizer): woppbs, full cost, missing ks and hybrid packing ep 2024-05-03 09:28:59 +02:00
Alexandre Péré
d033102a3c feat(optimizer): allow circuit manipulation in optimizer dag 2024-04-30 10:16:52 +02:00
Bourgerie Quentin
9beaeac007 feat(compiler): Allow concat with only one operand 2024-04-26 10:13:54 +02:00
Andi Drebes
51b5b42c05 fix(compiler): Support indirect references to IVs in indexes when hoisting RT.await_future ops
Until now, the pass hoisting `RT.await_future` operations only
supports `tensor.parallel_insert_slice` operations that use loop
induction variables directly as indexes. Any more complex indexing
expressions produce a domination error, since a
`tensor.parallel_insert_slice` cloned by the pass into an additional
parallel for loop is left with references to values from the original
loop.

This change properly clones operations producing intermediate values
within the original parallel for loop and thus adds support for
indexing expressions that reference loops IVs only indirectly.
2024-04-25 11:05:54 +02:00
Andi Drebes
16f00416fc fix(compiler): Fix RT type parser: Remove unconditional parsing of prefix "future"
The type parser of the RT dialect unconditionally attempts to parse
the string "future". This breaks the parsing of any RT type. Remove
unconditional parsing of this prefix.
2024-04-23 13:26:35 +02:00
Andi Drebes
e238067cd8 fix(compiler): Type inference rewriter: Handle return-like operations correctly
Return-like operations require special treatment by the type inference
rewriter, since their operand types are both tied to the result types
of their producers and to result types of their parent operations.

The inference scheme for ordinary operations, in which the initial
local inference state is composed of the operand types of the
rewritten producers and the old types of related operations before
rewriting is insufficient, since this may result in a mismatch between
the inferred types and the actual types of the already rewritten
parent operation.

Until now, precedence of the new result types of the parent operation
has been implemented by simply designating these types as the operand
types of a return-like operation. However, while this works as
intended for return-like operations, which simply forward values
(e.g., `func.return`), this creates invalid IR for other return-like
operations (e.g., `tensor.yield`).

This change implements precedence of the result types of the parent
operation of a return-like operation by adding the return types of the
already rewritten parent operation to the initial local inference
state before final invocation of type inference.
2024-04-19 09:10:57 +02:00
Bourgerie Quentin
676a787ff2 fix(compiler): Use concrete-cpu function to compute key size in compilation feedbacks 2024-04-18 14:55:43 +02:00
Alexandre Péré
ba1d049d95 fix(compiler): increases deserialization limit for values 2024-04-18 14:22:51 +02:00
Andi Drebes
a88968d8df fix(compiler): Type inference rewriter: Fix use-after-free in function renaming
The type inference rewriter changes the name of the rewritten function
to the name of the original function when the rewriting process is
complete. However, the name is retrieved from the original function
operation after the operation has already been replaced and thus
destroyed, resulting in a null pointer dereference.

This change retrieves the name of the original function before it is
replaced and saves it in a copy, which is then used to safely assign
the new name to the rewritten function.
2024-04-17 09:55:10 +02:00