This document provides instructions on how to customize the compilation pipeline using Configuration
s in Python and describes various configuration options available.
You can customize Concrete using the fhe.Configuration
:
You can overwrite individual configuration options by specifying kwargs in the compile
method:
You can also combine both ways:
When options are specified both in the configuration
and as kwargs in the compile
method, the kwargs take precedence.
Provide fine control for approximate rounding:
To enable exact clipping,
Or/and approximate clipping, which makes overflow protection faster.
Adjust rounders automatically.
Enable auto parallelization in the compiler.
Specify preference for bitwise strategies, can be a single strategy or an ordered list of strategies. See Bitwise to learn more.
Enable or disable the debug mode of the compiler. This can show a lot of information, including passes and pattern rewrites.
Enable or disable verbose mode of the compiler. This mainly shows logs from the compiler and is less verbose than the debug mode.
Specify preference for comparison strategies. Can be a single strategy or an ordered list of strategies. See Comparisons to learn more.
Specify that serialization takes the compressed form of evaluation keys.
Specify that serialization takes the compressed form of input ciphertexts.
Specify that the function must be composable with itself.
Only used when compiling a single circuit; when compiling modules, use the composition policy.
Enable dataflow parallelization in the compiler.
Export debugging artifacts automatically on compilation failures.
Enables Table Lookups(TLU) fusing to reduce the number of TLUs.
Enable unsafe features.
Enable FHE execution. Can be enabled later using circuit.enable_fhe_execution()
.
Enable FHE simulation. Can be enabled later using circuit.enable_fhe_simulation()
.
Global error probability for the whole circuit.
If set, the whole circuit will have the probability of a non-exact result smaller than the set value. See Exactness to learn more.
Chunk size to use when converting the fhe.if_then_else extension
.
Location of insecure key cache.
Enable loop parallelization in the compiler.
Set the level of circuit partitioning when using fhe.ParameterSelectionStrategy.MULTI
.
PRECISION
: all TLUs with the same input precision have their own parameters.
PRECISION_AND_NORM2
: all TLUs with the same input precision and output norm2 have their own parameters.
Enables TLU optimizations based on measured bounds.
Not enabled by default, as it could result in unexpected overflows during runtime.
Configures whether to convert values to their original precision before doing a table lookup on them.
True
enables it for all cases.
False
disables it for all cases.
Integer value enables or disables it depending on the original bit width. With the default value of 8, only the values with original bit width ≤ 8 will be converted to their original precision.
Error probability for individual table lookups.
If set, all table lookups will have the probability of a non-exact result smaller than the set value. See Exactness to learn more.
Set how cryptographic parameters are selected.
Enables printing of TLU fusing to see which table lookups are fused.
How many nested tag elements to display with the progress bar.
True
means all tag elements
False
disables the display.
2
will display elmt1.elmt2
.
Title of the progress bar.
Set default exactness mode for the rounding operation:
EXACT
: threshold for rounding up or down is exactly centered between the upper and lower value.
APPROXIMATE
: faster but threshold for rounding up or down is approximately centered with a pseudo-random shift. Precise behavior is described in fhe.rounding_bit_pattern
.
Chunk size of the ReLU extension when fhe.bits implementation is used.
Bit-width to start implementing the ReLU extension with fhe.bits.
Enable promotions in encrypted shifts instead of casting at runtime. See Bitwise#Shifts to learn more.
Print computation graph during compilation.
True
means always print
False
means never print
None
means print depending on verbose configuration.
Print MLIR during compilation.
True
means always print
False
means never print
None
means print depending on verbose configuration.
Print optimizer output during compilation.
True
means always print
False
means never print
None
means print depending on verbose configuration.
Display a progress bar during circuit execution.
Print circuit statistics during compilation.
True
means always print
False
means never print
None
means print depending on verbose configuration.
Whether to use the simulate encrypt/run/decrypt methods of the circuit/module instead of actual encryption/evaluation/decryption.
When this option is set to True
, encrypt and decrypt are identity functions, and run is a wrapper around simulation. In other words, this option allows switching off encryption to quickly test if a function has the expected semantic (without paying the price of FHE execution).
This is extremely unsafe and should only be used during development.
For this reason, it requires enable_unsafe_features
to be set to True
.
Use single precision for the whole circuit.
Enable generating code for GPU in the compiler.
Use the insecure key cache.
Print details related to compilation.