FHE dialect
High Level Fully Homomorphic Encryption dialect A dialect for representation of high level operation on fully homomorphic ciphertext.
Operation definition
FHE.add_eint_int
(::mlir::concretelang::FHE::AddEintIntOp)
FHE.add_eint_int
(::mlir::concretelang::FHE::AddEintIntOp)Adds an encrypted integer and a clear integer
The clear integer must have at most one more bit than the encrypted integer and the result must have the same width and the same signedness as the encrypted integer.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: AdditiveNoise, Binary, BinaryEintInt, ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| |
| integer |
Results:
Result | Description |
---|---|
«unnamed» |
FHE.add_eint
(::mlir::concretelang::FHE::AddEintOp)
FHE.add_eint
(::mlir::concretelang::FHE::AddEintOp)Adds two encrypted integers
The encrypted integers and the result must have the same width and the same signedness.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: AdditiveNoise, BinaryEint, ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| |
|
Results:
Result | Description |
---|---|
«unnamed» |
FHE.apply_lookup_table
(::mlir::concretelang::FHE::ApplyLookupTableEintOp)
FHE.apply_lookup_table
(::mlir::concretelang::FHE::ApplyLookupTableEintOp)Applies a clear lookup table to an encrypted integer
The width of the result can be different than the width of the operand. The lookup table must be a tensor of size 2^p
where p
is the width of the encrypted integer.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, ConstantNoise, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| |
| tensor of integer values |
Results:
Result | Description |
---|---|
«unnamed» |
FHE.and
(::mlir::concretelang::FHE::BoolAndOp)
FHE.and
(::mlir::concretelang::FHE::BoolAndOp)Applies an AND gate to two encrypted boolean values
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| An encrypted boolean |
| An encrypted boolean |
Results:
Result | Description |
---|---|
«unnamed» | An encrypted boolean |
FHE.nand
(::mlir::concretelang::FHE::BoolNandOp)
FHE.nand
(::mlir::concretelang::FHE::BoolNandOp)Applies a NAND gate to two encrypted boolean values
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| An encrypted boolean |
| An encrypted boolean |
Results:
Result | Description |
---|---|
«unnamed» | An encrypted boolean |
FHE.not
(::mlir::concretelang::FHE::BoolNotOp)
FHE.not
(::mlir::concretelang::FHE::BoolNotOp)Applies a NOT gate to an encrypted boolean value
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), UnaryEint
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| An encrypted boolean |
Results:
Result | Description |
---|---|
«unnamed» | An encrypted boolean |
FHE.or
(::mlir::concretelang::FHE::BoolOrOp)
FHE.or
(::mlir::concretelang::FHE::BoolOrOp)Applies an OR gate to two encrypted boolean values
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| An encrypted boolean |
| An encrypted boolean |
Results:
Result | Description |
---|---|
«unnamed» | An encrypted boolean |
FHE.xor
(::mlir::concretelang::FHE::BoolXorOp)
FHE.xor
(::mlir::concretelang::FHE::BoolXorOp)Applies an XOR gate to two encrypted boolean values
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| An encrypted boolean |
| An encrypted boolean |
Results:
Result | Description |
---|---|
«unnamed» | An encrypted boolean |
FHE.change_partition
(::mlir::concretelang::FHE::ChangePartitionEintOp)
FHE.change_partition
(::mlir::concretelang::FHE::ChangePartitionEintOp)Change partition if necessary.
Changing the partition of a ciphertext. If necessary, it keyswitch the ciphertext to a different key having a different set of parameters than the original one.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), UnaryEint
Effects: MemoryEffects::Effect{}
Attributes:
Attribute | MLIR Type | Description |
---|---|---|
| ::mlir::concretelang::FHE::PartitionAttr | An attribute representing a partition. |
| ::mlir::concretelang::FHE::PartitionAttr | An attribute representing a partition. |
Operands:
Operand | Description |
---|---|
|
Results:
Result | Description |
---|---|
«unnamed» |
FHE.from_bool
(::mlir::concretelang::FHE::FromBoolOp)
FHE.from_bool
(::mlir::concretelang::FHE::FromBoolOp)Cast a boolean to an unsigned integer
Examples:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), UnaryEint
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| An encrypted boolean |
Results:
Result | Description |
---|---|
«unnamed» | An encrypted unsigned integer |
FHE.gen_gate
(::mlir::concretelang::FHE::GenGateOp)
FHE.gen_gate
(::mlir::concretelang::FHE::GenGateOp)Applies a truth table based on two boolean inputs
Truth table must be a tensor of four boolean values.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| An encrypted boolean |
| An encrypted boolean |
| tensor of integer values |
Results:
Result | Description |
---|---|
«unnamed» | An encrypted boolean |
FHE.lsb
(::mlir::concretelang::FHE::LsbEintOp)
FHE.lsb
(::mlir::concretelang::FHE::LsbEintOp)Extract the lowest significant bit at a given precision.
This operation extracts the lsb of a ciphertext in a specific precision.
Extracting the lsb with the smallest precision:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, ConstantNoise, NoMemoryEffect (MemoryEffectOpInterface), UnaryEint
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
|
Results:
Result | Description |
---|---|
«unnamed» |
FHE.max_eint
(::mlir::concretelang::FHE::MaxEintOp)
FHE.max_eint
(::mlir::concretelang::FHE::MaxEintOp)Retrieve the maximum of two encrypted integers.
Retrieve the maximum of two encrypted integers using the formula, 'max(x, y) == max(x - y, 0) + y'. The input and output types should be the same.
If `x - y`` inside the max overflows or underflows, the behavior is undefined. To support the full range, you should increase the bit-width by 1 manually.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: BinaryEint, ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| |
|
Results:
Result | Description |
---|---|
«unnamed» |
FHE.mul_eint_int
(::mlir::concretelang::FHE::MulEintIntOp)
FHE.mul_eint_int
(::mlir::concretelang::FHE::MulEintIntOp)Multiply an encrypted integer with a clear integer
The clear integer must have one more bit than the encrypted integer and the result must have the same width and the same signedness as the encrypted integer.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: Binary, BinaryEintInt, ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| |
| integer |
Results:
Result | Description |
---|---|
«unnamed» |
FHE.mul_eint
(::mlir::concretelang::FHE::MulEintOp)
FHE.mul_eint
(::mlir::concretelang::FHE::MulEintOp)Multiplies two encrypted integers
The encrypted integers and the result must have the same width and signedness. Also, due to the current implementation, one supplementary bit of width must be provided, in addition to the number of bits needed to encode the largest output value.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: BinaryEint, ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| |
|
Results:
Result | Description |
---|---|
«unnamed» |
FHE.mux
(::mlir::concretelang::FHE::MuxOp)
FHE.mux
(::mlir::concretelang::FHE::MuxOp)Multiplexer for two encrypted boolean inputs, based on an encrypted condition
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| An encrypted boolean |
| An encrypted boolean |
| An encrypted boolean |
Results:
Result | Description |
---|---|
«unnamed» | An encrypted boolean |
FHE.neg_eint
(::mlir::concretelang::FHE::NegEintOp)
FHE.neg_eint
(::mlir::concretelang::FHE::NegEintOp)Negates an encrypted integer
The result must have the same width and the same signedness as the encrypted integer.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: AdditiveNoise, ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), UnaryEint
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
|
Results:
Result | Description |
---|---|
«unnamed» |
FHE.reinterpret_precision
(::mlir::concretelang::FHE::ReinterpretPrecisionEintOp)
FHE.reinterpret_precision
(::mlir::concretelang::FHE::ReinterpretPrecisionEintOp)Reinterpret the ciphertext with a different precision.
Changing the precision of a ciphertext. It changes both the precision, the value, and in certain cases the correctness of the ciphertext.
Changing to - a bigger precision is always safe. This is equivalent to a shift left for the value. - a smaller precision is only safe if you clear the lowest bits that are discarded. If not, you can assume small errors on the next TLU. This is equivalent to a shift right for the value.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), UnaryEint
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
|
Results:
Result | Description |
---|---|
«unnamed» |
FHE.round
(::mlir::concretelang::FHE::RoundEintOp)
FHE.round
(::mlir::concretelang::FHE::RoundEintOp)Rounds a ciphertext to a smaller precision.
Assuming a ciphertext whose message is implemented over p
bits, this operation rounds it to fit to q
bits with p>q
.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), UnaryEint
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
|
Results:
Result | Description |
---|---|
«unnamed» |
FHE.sub_eint_int
(::mlir::concretelang::FHE::SubEintIntOp)
FHE.sub_eint_int
(::mlir::concretelang::FHE::SubEintIntOp)Subtract a clear integer from an encrypted integer
The clear integer must have one more bit than the encrypted integer and the result must have the same width and the same signedness as the encrypted integer.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: AdditiveNoise, Binary, BinaryEintInt, ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| |
| integer |
Results:
Result | Description |
---|---|
«unnamed» |
FHE.sub_eint
(::mlir::concretelang::FHE::SubEintOp)
FHE.sub_eint
(::mlir::concretelang::FHE::SubEintOp)Subtract an encrypted integer from an encrypted integer
The encrypted integers and the result must have the same width and the same signedness.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: AdditiveNoise, BinaryEint, ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| |
|
Results:
Result | Description |
---|---|
«unnamed» |
FHE.sub_int_eint
(::mlir::concretelang::FHE::SubIntEintOp)
FHE.sub_int_eint
(::mlir::concretelang::FHE::SubIntEintOp)Subtract an encrypted integer from a clear integer
The clear integer must have one more bit than the encrypted integer and the result must have the same width and the same signedness as the encrypted integer.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: AdditiveNoise, Binary, BinaryIntEint, ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| integer |
|
Results:
Result | Description |
---|---|
«unnamed» |
FHE.to_bool
(::mlir::concretelang::FHE::ToBoolOp)
FHE.to_bool
(::mlir::concretelang::FHE::ToBoolOp)Cast an unsigned integer to a boolean
The input must be of width one or two. Two being the current representation of an encrypted boolean, leaving one bit for the carry.
Examples:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), UnaryEint
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| An encrypted unsigned integer |
Results:
Result | Description |
---|---|
«unnamed» | An encrypted boolean |
FHE.to_signed
(::mlir::concretelang::FHE::ToSignedOp)
FHE.to_signed
(::mlir::concretelang::FHE::ToSignedOp)Cast an unsigned integer to a signed one
The result must have the same width as the input.
The behavior is undefined on overflow/underflow.
Examples:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), UnaryEint
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| An encrypted unsigned integer |
Results:
Result | Description |
---|---|
«unnamed» | An encrypted signed integer |
FHE.to_unsigned
(::mlir::concretelang::FHE::ToUnsignedOp)
FHE.to_unsigned
(::mlir::concretelang::FHE::ToUnsignedOp)Cast a signed integer to an unsigned one
The result must have the same width as the input.
The behavior is undefined on overflow/underflow.
Examples:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), UnaryEint
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
| An encrypted signed integer |
Results:
Result | Description |
---|---|
«unnamed» | An encrypted unsigned integer |
FHE.zero
(::mlir::concretelang::FHE::ZeroEintOp)
FHE.zero
(::mlir::concretelang::FHE::ZeroEintOp)Returns a trivial encrypted integer of 0
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), ZeroNoise
Effects: MemoryEffects::Effect{}
Results:
Result | Description |
---|---|
|
FHE.zero_tensor
(::mlir::concretelang::FHE::ZeroTensorOp)
FHE.zero_tensor
(::mlir::concretelang::FHE::ZeroTensorOp)Creates a new tensor with all elements initialized to an encrypted zero.
Creates a new tensor with the shape specified in the result type and initializes its elements with an encrypted zero.
Example:
Traits: AlwaysSpeculatableImplTrait
Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface), ZeroNoise
Effects: MemoryEffects::Effect{}
Results:
Result | Description |
---|---|
|
Attribute definition
PartitionAttr
An attribute representing a partition.
Syntax:
Parameters:
Parameter | C++ type | Description |
---|---|---|
name |
| |
lweDim |
| |
glweDim |
| |
polySize |
| |
pbsBaseLog |
| |
pbsLevel |
|
Type definition
EncryptedBooleanType
An encrypted boolean
Syntax: !FHE.ebool
An encrypted boolean.
EncryptedSignedIntegerType
An encrypted signed integer
An encrypted signed integer with width
bits to performs FHE Operations.
Examples:
Parameters:
Parameter | C++ type | Description |
---|---|---|
width |
|
EncryptedUnsignedIntegerType
An encrypted unsigned integer
An encrypted unsigned integer with width
bits to performs FHE Operations.
Examples:
Parameters:
Parameter | C++ type | Description |
---|---|---|
width |
|
Last updated