Lattigo
’lattigo’ Dialect
The lattigo dialect is an exit dialect for generating GO code against the Lattigo library API.
See https://github.com/tuneinsight/lattigo
Lattigo attributes
BGVParametersLiteralAttr
Literal parameters for Lattigo BGV
Syntax:
#lattigo.bgv.parameters_literal<
int, # logN
DenseI64ArrayAttr, # Q
DenseI64ArrayAttr, # P
DenseI32ArrayAttr, # logQ
DenseI32ArrayAttr, # logP
int64_t # plaintextModulus
>
This attribute represents the literal parameters for Lattigo BGV.
This is in accordance with https://pkg.go.dev/github.com/tuneinsight/lattigo/v6@v6.1.0/schemes/bgv#ParametersLiteral where some field are not present in the current implementation.
Users must set the polynomial degree (LogN) and the coefficient modulus, by either setting the Q and P fields to the desired moduli chain, or by setting the LogQ and LogP fields to the desired moduli sizes.
Note that for Lattigo, Q/P requires []uint64, where this attribute only provides int64. We assume user should not select moduli so large to consider the signedness issue.
Users must also specify the coefficient modulus in plaintext-space (T). This modulus must be an NTT-friendly prime in the plaintext space: it must be equal to 1 modulo 2n where n is the plaintext ring degree (i.e., the plaintext space has n slots).
Parameters:
| Parameter | C++ type | Description |
|---|---|---|
| logN | int | |
| Q | DenseI64ArrayAttr | |
| P | DenseI64ArrayAttr | |
| logQ | DenseI32ArrayAttr | |
| logP | DenseI32ArrayAttr | |
| plaintextModulus | int64_t |
CKKSBootstrappingParametersLiteralAttr
Literal bootstrapping parameters for Lattigo CKKS
Syntax:
#lattigo.ckks.bootstrapping_parameters_literal<
int # logN
>
This attribute represents the literal bootstrapping parameters for Lattigo CKKS.
This is in accordance with https://pkg.go.dev/github.com/tuneinsight/lattigo/v6/circuits/ckks/bootstrapping#ParametersLiteral where some field are not present in the current implementation.
This struct contains only optional fields.
Parameters:
| Parameter | C++ type | Description |
|---|---|---|
| logN | int |
CKKSParametersLiteralAttr
Literal parameters for Lattigo CKKS
Syntax:
#lattigo.ckks.parameters_literal<
int, # logN
DenseI64ArrayAttr, # Q
DenseI64ArrayAttr, # P
DenseI32ArrayAttr, # logQ
DenseI32ArrayAttr, # logP
int # logDefaultScale
>
This attribute represents the literal parameters for Lattigo CKKS.
This is in accordance with https://pkg.go.dev/github.com/tuneinsight/lattigo/v6@v6.1.0/schemes/ckks#ParametersLiteral where some field are not present in the current implementation.
Users must set the polynomial degree (LogN) and the coefficient modulus, by either setting the Q and P fields to the desired moduli chain, or by setting the LogQ and LogP fields to the desired moduli sizes.
Note that for Lattigo, Q/P requires []uint64, where this attribute only provides int64. We assume user should not select moduli so large to consider the signedness issue.
Users must also specify a default initial scale for the plaintexts1.
Parameters:
| Parameter | C++ type | Description |
|---|---|---|
| logN | int | |
| Q | DenseI64ArrayAttr | |
| P | DenseI64ArrayAttr | |
| logQ | DenseI32ArrayAttr | |
| logP | DenseI32ArrayAttr | |
| logDefaultScale | int |
Lattigo types
BGVEncoderType
Syntax: !lattigo.bgv.encoder
This type represents the encoder for the BGV encryption scheme.
BGVEvaluatorType
Syntax: !lattigo.bgv.evaluator
This type represents the evaluator for the BGV encryption scheme.
BGVParameterType
Syntax: !lattigo.bgv.parameter
This type represents the parameters for the BGV encryption scheme.
CKKSBootstrappingEvaluationKeysType
Syntax: !lattigo.ckks.bootstrapping_eval_keys
This type represents the eval keys for bootstrapping for the CKKS encryption scheme.
CKKSBootstrappingEvaluatorType
Syntax: !lattigo.ckks.bootstrapping_evaluator
This type represents the bootstrapping evaluator for the CKKS encryption scheme.
CKKSBootstrappingParameterType
Syntax: !lattigo.ckks.bootstrapping_parameter
This type represents the bootstrapping parameters for the CKKS encryption scheme.
CKKSEncoderType
Syntax: !lattigo.ckks.encoder
This type represents the encoder for the CKKS encryption scheme.
CKKSEvaluatorType
Syntax: !lattigo.ckks.evaluator
This type represents the evaluator for the CKKS encryption scheme.
CKKSParameterType
Syntax: !lattigo.ckks.parameter
This type represents the parameters for the CKKS encryption scheme.
CKKSPolynomialEvaluatorType
Syntax: !lattigo.ckks.polynomial_evaluator
This type represents the PolynomialEvaluator for the CKKS encryption scheme.
RLWECiphertextType
Syntax: !lattigo.rlwe.ciphertext
This type represents the ciphertext for the RLWE encryption scheme.
RLWEDecryptorType
Syntax: !lattigo.rlwe.decryptor
This type represents the decryptor for the RLWE encryption scheme.
RLWEEncryptorType
Syntax:
!lattigo.rlwe.encryptor<
bool # publicKey
>
This type represents the encryptor for the RLWE encryption scheme.
Parameters:
| Parameter | C++ type | Description |
|---|---|---|
| publicKey | bool |
RLWEEvaluationKeySetType
Syntax: !lattigo.rlwe.evaluation_key_set
This type represents the evaluation key set for the RLWE encryption scheme.
RLWEGaloisKeyType
Syntax:
!lattigo.rlwe.galois_key<
::mlir::IntegerAttr # galoisElement
>
This type represents the Galois key for the RLWE encryption scheme.
galoisElement: Enabling the automorphism X -> X^{galoisElement}.
Parameters:
| Parameter | C++ type | Description |
|---|---|---|
| galoisElement | ::mlir::IntegerAttr | An Attribute containing a integer value |
RLWEKeyGeneratorType
Syntax: !lattigo.rlwe.key_generator
This type represents the key generator for the RLWE encryption scheme.
RLWEPlaintextType
Syntax: !lattigo.rlwe.plaintext
This type represents the plaintext for the RLWE encryption scheme.
RLWEPublicKeyType
Syntax: !lattigo.rlwe.public_key
This type represents the public key for the RLWE encryption scheme.
RLWERelinearizationKeyType
Syntax: !lattigo.rlwe.relinearization_key
This type represents the relinearization key for the RLWE encryption scheme.
RLWESecretKeyType
Syntax: !lattigo.rlwe.secret_key
This type represents the secret key for the RLWE encryption scheme.
Lattigo ops
lattigo.bgv.add_new (heir::lattigo::BGVAddNewOp)
Add two ciphertexts in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.add_new` operands attr-dict `:` functional-type(operands, results)
This operation adds two ciphertext values in the Lattigo BGV dialect.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
lhs | |
rhs | or |
Results:
| Result | Description |
|---|---|
output |
lattigo.bgv.add (heir::lattigo::BGVAddOp)
Add two ciphertexts in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.add` operands attr-dict `:` functional-type(operands, results)
This operation adds two ciphertext values in the Lattigo BGV dialect.
The result will be written to the inplace operand. The outputresult is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
lhs | |
rhs | or |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.bgv.decode (heir::lattigo::BGVDecodeOp)
Decode a plaintext value in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.decode` operands attr-dict `:` functional-type(operands, results)
This operation decodes a plaintext value using the specified encoder in the Lattigo BGV dialect.
The input value tensor should have elements of integer type.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
encoder | |
plaintext | |
value | ranked tensor of integer values |
Results:
| Result | Description |
|---|---|
decoded | ranked tensor of integer values |
lattigo.bgv.encode (heir::lattigo::BGVEncodeOp)
Encode a plaintext value in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.encode` operands attr-dict `:` functional-type(operands, results)
This operation encodes a plaintext value using the specified encoder in the Lattigo BGV dialect.
The input value tensor should have elements of integer type.
The scale attribute indicates the scaling factor for encoding.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
scale | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
encoder | |
value | ranked tensor of integer values |
plaintext |
Results:
| Result | Description |
|---|---|
encoded |
lattigo.bgv.mul_new (heir::lattigo::BGVMulNewOp)
Multiply two ciphertexts in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.mul_new` operands attr-dict `:` functional-type(operands, results)
This operation multiplies two ciphertext values in the Lattigo BGV dialect.
Interfaces: IncreasesMulDepthOpInterface, InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
lhs | |
rhs | or |
Results:
| Result | Description |
|---|---|
output |
lattigo.bgv.mul (heir::lattigo::BGVMulOp)
Multiply two ciphertexts in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.mul` operands attr-dict `:` functional-type(operands, results)
This operation multiplies two ciphertext values in the Lattigo BGV dialect.
The result will be written to the inplace operand. The outputresult is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, IncreasesMulDepthOpInterface, InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
lhs | |
rhs | or |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.bgv.new_encoder (heir::lattigo::BGVNewEncoderOp)
Create a new encoder in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.new_encoder` operands attr-dict `:` functional-type(operands, results)
This operation creates a new encoder for encoding plaintext values in the Lattigo BGV dialect.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
params |
Results:
| Result | Description |
|---|---|
encoder |
lattigo.bgv.new_evaluator (heir::lattigo::BGVNewEvaluatorOp)
Create a new evaluator in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.new_evaluator` operands attr-dict `:` functional-type(operands, results)
This operation creates a new evaluator for performing operations on ciphertexts in the Lattigo BGV dialect.
By default, the evaluator is created with the provided parameters and could execute operations which does not relying on evaluation keys.
To support operations that require evaluation keys, the optional evaluation key set should be provided.
The scaleInvariant flag is used to indicate whether the evaluator is for B/FV or BGV. If it is set to true, the evaluator will evaluate operations in B/FV style.
Interfaces: InferTypeOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
scaleInvariant | ::mlir::BoolAttr | bool attribute |
Operands:
| Operand | Description |
|---|---|
params | |
evaluationKeySet |
Results:
| Result | Description |
|---|---|
evaluator |
lattigo.bgv.new_parameters_from_literal (heir::lattigo::BGVNewParametersFromLiteralOp)
Create new BGV parameters from a literal in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.new_parameters_from_literal` operands attr-dict `:` functional-type(operands, results)
This operation creates new BGV parameters from a given literal value in the Lattigo BGV dialect.
Interfaces: InferTypeOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
paramsLiteral | ::mlir::heir::lattigo::BGVParametersLiteralAttr | Literal parameters for Lattigo BGV |
Results:
| Result | Description |
|---|---|
params |
lattigo.bgv.new_plaintext (heir::lattigo::BGVNewPlaintextOp)
Create a new plaintext in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.new_plaintext` operands attr-dict `:` functional-type(operands, results)
This operation creates a new plaintext value in the Lattigo BGV dialect.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
params |
Results:
| Result | Description |
|---|---|
plaintext |
lattigo.bgv.relinearize_new (heir::lattigo::BGVRelinearizeNewOp)
Relinearize a ciphertext in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.relinearize_new` operands attr-dict `:` functional-type(operands, results)
This operation relinearizes a ciphertext value in the Lattigo BGV dialect.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
input |
Results:
| Result | Description |
|---|---|
output |
lattigo.bgv.relinearize (heir::lattigo::BGVRelinearizeOp)
Relinearize a ciphertext in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.relinearize` operands attr-dict `:` functional-type(operands, results)
This operation relinearizes a ciphertext value in the Lattigo BGV dialect.
The result will be written to the inplace operand. The outputresult is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
input | |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.bgv.rescale_new (heir::lattigo::BGVRescaleNewOp)
Rescale a ciphertext in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.rescale_new` operands attr-dict `:` functional-type(operands, results)
This operation rescales a ciphertext value in the Lattigo BGV dialect.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
input |
Results:
| Result | Description |
|---|---|
output |
lattigo.bgv.rescale (heir::lattigo::BGVRescaleOp)
Rescale a ciphertext in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.rescale` operands attr-dict `:` functional-type(operands, results)
This operation rescales a ciphertext value in the Lattigo BGV dialect.
The result will be written to the inplace operand. The outputresult is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
input | |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.bgv.rotate_columns_new (heir::lattigo::BGVRotateColumnsNewOp)
Rotate columns of a ciphertext in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.rotate_columns_new` operands attr-dict `:` functional-type(operands, results)
This operation rotates the columns of a ciphertext value in the Lattigo BGV dialect.
Lattigo exposes the SIMD slot of BGV as a N/2 x 2 matrix, where N/2 is the column.
Offset is valid for both positive and negative number.
Interfaces: InferTypeOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
offset | ::mlir::IntegerAttr | An Attribute containing a integer value |
Operands:
| Operand | Description |
|---|---|
evaluator | |
input |
Results:
| Result | Description |
|---|---|
output |
lattigo.bgv.rotate_columns (heir::lattigo::BGVRotateColumnsOp)
Rotate columns of a ciphertext in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.rotate_columns` operands attr-dict `:` functional-type(operands, results)
This operation rotates the columns of a ciphertext value in the Lattigo BGV dialect.
Lattigo exposes the SIMD slot of BGV as a N/2 x 2 matrix, where N/2 is the column.
Offset is valid for both positive and negative number.
The result will be written to the inplace operand. The outputresult is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
offset | ::mlir::IntegerAttr | An Attribute containing a integer value |
Operands:
| Operand | Description |
|---|---|
evaluator | |
input | |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.bgv.rotate_rows_new (heir::lattigo::BGVRotateRowsNewOp)
Rotate rows of a ciphertext in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.rotate_rows_new` operands attr-dict `:` functional-type(operands, results)
This operation swap the rows of a ciphertext value in the Lattigo BGV dialect.
Lattigo exposes the SIMD slot of BGV as a N/2 x 2 matrix, where 2 is the row.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
input |
Results:
| Result | Description |
|---|---|
output |
lattigo.bgv.rotate_rows (heir::lattigo::BGVRotateRowsOp)
Rotate rows of a ciphertext in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.rotate_rows` operands attr-dict `:` functional-type(operands, results)
This operation swap the rows of a ciphertext value in the Lattigo BGV dialect.
Lattigo exposes the SIMD slot of BGV as a N/2 x 2 matrix, where 2 is the row.
The result will be written to the inplace operand. The outputresult is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
input | |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.bgv.sub_new (heir::lattigo::BGVSubNewOp)
Subtract two ciphertexts in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.sub_new` operands attr-dict `:` functional-type(operands, results)
This operation subtracts one ciphertext value from another in the Lattigo BGV dialect.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
lhs | |
rhs | or |
Results:
| Result | Description |
|---|---|
output |
lattigo.bgv.sub (heir::lattigo::BGVSubOp)
Subtract two ciphertexts in the Lattigo BGV dialect
Syntax:
operation ::= `lattigo.bgv.sub` operands attr-dict `:` functional-type(operands, results)
This operation subtracts one ciphertext value from another in the Lattigo BGV dialect.
The result will be written to the inplace operand. The outputresult is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
lhs | |
rhs | or |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.add_new (heir::lattigo::CKKSAddNewOp)
Add two ciphertexts in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.add_new` operands attr-dict `:` functional-type(operands, results)
This operation adds two ciphertext values in the Lattigo CKKS dialect.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
lhs | |
rhs | or |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.add (heir::lattigo::CKKSAddOp)
Add two ciphertexts in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.add` operands attr-dict `:` functional-type(operands, results)
This operation adds two ciphertext values in the Lattigo CKKS dialect.
The result will be written to the inplace operand. The outputresult is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
lhs | |
rhs | or |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.bootstrap (heir::lattigo::CKKSBootstrapOp)
Bootstrap a ciphertext in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.bootstrap` operands attr-dict `:` functional-type(operands, results)
Bootstraps a ciphertext value in the Lattigo CKKS dialect.
The operation applies bootstrapping in-place and also returns the result.
It takes a ciphertext at level 0 (if not at level 0, then it will reduce it
to level 0) and returns a ciphertext with the max level of
evaluator.ResidualParameters.MaxLevel.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
input |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.chebyshev (heir::lattigo::CKKSChebyshevOp)
Evaluate a chebyshev polynomial on a lattigo CKKS ciphertext
Syntax:
operation ::= `lattigo.ckks.chebyshev` operands attr-dict `:` functional-type(operands, results)
This operation evaluates a chebyshev polynomial on a CKKS ciphertext using the Lattigo polynomial evaluator API.
The codegen constructs the Lattigo polynomial and, using an existing polynomial evaluator, calls the evaluation routine with a given target scale.
Interfaces: InferTypeOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
coefficients | ::mlir::ArrayAttr | array attribute |
targetScale | ::mlir::IntegerAttr | An Attribute containing a integer value |
Operands:
| Operand | Description |
|---|---|
evaluator | |
ciphertext |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.decode (heir::lattigo::CKKSDecodeOp)
Decode a plaintext value in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.decode` operands attr-dict `:` functional-type(operands, results)
This operation decodes a plaintext value using the specified encoder in the Lattigo CKKS dialect.
The input value tensor should have elements of float type or complex type.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
encoder | |
plaintext | |
value | ranked tensor of floating-point or complex-type values |
Results:
| Result | Description |
|---|---|
decoded | ranked tensor of floating-point or complex-type values |
lattigo.ckks.encode (heir::lattigo::CKKSEncodeOp)
Encode a plaintext value in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.encode` operands attr-dict `:` functional-type(operands, results)
This operation encodes a plaintext value using the specified encoder in the Lattigo CKKS dialect.
The input value tensor should have elements of float type or complex type.
The scale attribute indicates the scaling factor for encoding.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
scale | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
encoder | |
value | ranked tensor of floating-point or complex-type values |
plaintext |
Results:
| Result | Description |
|---|---|
encoded |
lattigo.ckks.gen_evaluation_keys_bootstrapping (heir::lattigo::CKKSGenEvaluationKeysBootstrappingOp)
Create new evaluation keys for CKKS bootstrapping
Syntax:
operation ::= `lattigo.ckks.gen_evaluation_keys_bootstrapping` operands attr-dict `:` functional-type(operands, results)
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
params | |
sk |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.linear_transform (heir::lattigo::CKKSLinearTransformOp)
Apply a linear transform on a lattigo CKKS ciphertext
Syntax:
operation ::= `lattigo.ckks.linear_transform` operands attr-dict `:` functional-type(operands, results)
This operation applies a linear transform on a CKKS ciphertext using the provided float diagonals.
The linear transform is defined by a set of diagonals, where each diagonal represents a specific shift and scaling of the input ciphertext slots.
The diagonals input is a 2D tensor where each row represents one non-zero
diagonal of the square matrix to evaluate. The diagonal values are floats
that will be encoded into plaintexts during code generation.
The levelQ attribute specifies the modulus level at which the operation
should be performed.
The logBabyStepGiantStepRatio attribute is used to optimize the linear
transformation using the baby-step giant-step algorithm. It defines the
ratio between the sizes of the baby steps and giant steps. If unset,
it is zero by default.
During code generation, this op will:
- Create a lintrans.Diagonals map from the input tensor
- Create and encode a lintrans.Transformation
- Create a lintrans.Evaluator
- Evaluate the transformation on the input ciphertext
Interfaces: InferTypeOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
diagonal_indices | ::mlir::DenseI32ArrayAttr | i32 dense array attribute |
levelQ | ::mlir::IntegerAttr | An Attribute containing a integer value |
logBabyStepGiantStepRatio | ::mlir::IntegerAttr | An Attribute containing a integer value |
Operands:
| Operand | Description |
|---|---|
evaluator | |
encoder | |
input | |
diagonals | 2D tensor of floating-point values |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.mul_new (heir::lattigo::CKKSMulNewOp)
Multiply two ciphertexts in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.mul_new` operands attr-dict `:` functional-type(operands, results)
This operation multiplies two ciphertext values in the Lattigo CKKS dialect.
Interfaces: IncreasesMulDepthOpInterface, InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
lhs | |
rhs | or |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.mul (heir::lattigo::CKKSMulOp)
Multiply two ciphertexts in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.mul` operands attr-dict `:` functional-type(operands, results)
This operation multiplies two ciphertext values in the Lattigo CKKS dialect.
The result will be written to the inplace operand. The outputresult is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, IncreasesMulDepthOpInterface, InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
lhs | |
rhs | or |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.new_bootstrapping_evaluator (heir::lattigo::CKKSNewBootstrappingEvaluatorOp)
Create a new bootstrapping evaluator in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.new_bootstrapping_evaluator` operands attr-dict `:` functional-type(operands, results)
Creates a new bootstrapping evaluator for performing operations on ciphertexts in the Lattigo CKKS dialect.
By default, the evaluator is created with default parameters to provide a depth of 15 and security level of 128. The evaluation key set for bootstrapping must be provided.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
params | |
evaluationKeySet |
Results:
| Result | Description |
|---|---|
evaluator |
lattigo.ckks.new_bootstrapping_parameters_from_literal (heir::lattigo::CKKSNewBootstrappingParametersFromLiteralOp)
Create new CKKS bootstrapping parameters from a literal in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.new_bootstrapping_parameters_from_literal` operands attr-dict `:` functional-type(operands, results)
This operation creates new CKKS bootstrapping parameters from a given literal value in the Lattigo CKKS dialect.
Interfaces: InferTypeOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
btParamsLiteral | ::mlir::heir::lattigo::CKKSBootstrappingParametersLiteralAttr | Literal bootstrapping parameters for Lattigo CKKS |
Operands:
| Operand | Description |
|---|---|
params |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.new_encoder (heir::lattigo::CKKSNewEncoderOp)
Create a new encoder in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.new_encoder` operands attr-dict `:` functional-type(operands, results)
This operation creates a new encoder for encoding plaintext values in the Lattigo CKKS dialect.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
params |
Results:
| Result | Description |
|---|---|
encoder |
lattigo.ckks.new_evaluator (heir::lattigo::CKKSNewEvaluatorOp)
Create a new evaluator in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.new_evaluator` operands attr-dict `:` functional-type(operands, results)
This operation creates a new evaluator for performing operations on ciphertexts in the Lattigo CKKS dialect.
By default, the evaluator is created with the provided parameters and could execute operations which does not relying on evaluation keys.
To support operations that require evaluation keys, the optional evaluation key set should be provided.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
params | |
evaluationKeySet |
Results:
| Result | Description |
|---|---|
evaluator |
lattigo.ckks.new_parameters_from_literal (heir::lattigo::CKKSNewParametersFromLiteralOp)
Create new CKKS parameters from a literal in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.new_parameters_from_literal` operands attr-dict `:` functional-type(operands, results)
This operation creates new CKKS parameters from a given literal value in the Lattigo CKKS dialect.
Interfaces: InferTypeOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
paramsLiteral | ::mlir::heir::lattigo::CKKSParametersLiteralAttr | Literal parameters for Lattigo CKKS |
Results:
| Result | Description |
|---|---|
params |
lattigo.ckks.new_plaintext (heir::lattigo::CKKSNewPlaintextOp)
Create a new plaintext in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.new_plaintext` operands attr-dict `:` functional-type(operands, results)
This operation creates a new plaintext value in the Lattigo CKKS dialect.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
params |
Results:
| Result | Description |
|---|---|
plaintext |
lattigo.ckks.new_polynomial_evaluator (heir::lattigo::CKKSNewPolynomialEvaluatorOp)
Create a new polynomial evaluator in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.new_polynomial_evaluator` operands attr-dict `:` functional-type(operands, results)
This operation creates a new evaluator for evaluating polynomials in the Lattigo CKKS dialect.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
params | |
evaluator |
Results:
| Result | Description |
|---|---|
polynomialEvaluator |
lattigo.ckks.relinearize_new (heir::lattigo::CKKSRelinearizeNewOp)
Relinearize a ciphertext in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.relinearize_new` operands attr-dict `:` functional-type(operands, results)
This operation relinearizes a ciphertext value in the Lattigo CKKS dialect.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
input |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.relinearize (heir::lattigo::CKKSRelinearizeOp)
Relinearize a ciphertext in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.relinearize` operands attr-dict `:` functional-type(operands, results)
This operation relinearizes a ciphertext value in the Lattigo CKKS dialect.
The result will be written to the inplace operand. The outputresult is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
input | |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.rescale_new (heir::lattigo::CKKSRescaleNewOp)
Rescale a ciphertext in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.rescale_new` operands attr-dict `:` functional-type(operands, results)
This operation rescales a ciphertext value in the Lattigo CKKS dialect.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
input |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.rescale (heir::lattigo::CKKSRescaleOp)
Rescale a ciphertext in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.rescale` operands attr-dict `:` functional-type(operands, results)
This operation rescales a ciphertext value in the Lattigo CKKS dialect.
The result will be written to the inplace operand. The outputresult is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
input | |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.rotate_new (heir::lattigo::CKKSRotateNewOp)
Rotate slots of a ciphertext in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.rotate_new` operands attr-dict `:` functional-type(operands, results)
This operation rotates slots of a ciphertext value in the Lattigo CKKS dialect.
For vanilla CKKS, the maximum number of slots is N/2 with each slot being complex number. Lattigo also support a conjugate-invariant version of CKKS, i.e. the ring is Z[X + X^{-1} ]/(X^N+1), which allows for a maximum of N slots with each slot being real number.
Offset is valid for both positive and negative number.
Interfaces: InferTypeOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
offset | ::mlir::IntegerAttr | An Attribute containing a integer value |
Operands:
| Operand | Description |
|---|---|
evaluator | |
input |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.rotate (heir::lattigo::CKKSRotateOp)
Rotate slots of a ciphertext in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.rotate` operands attr-dict `:` functional-type(operands, results)
This operation rotates slots of a ciphertext value in the Lattigo CKKS dialect.
For vanilla CKKS, the maximum number of slots is N/2 with each slot being complex number. Lattigo also support a conjugate-invariant version of CKKS, i.e. the ring is Z[X + X^{-1} ]/(X^N+1), which allows for a maximum of N slots with each slot being real number.
Offset is valid for both positive and negative number.
The result will be written to the inplace operand. The outputresult is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
offset | ::mlir::IntegerAttr | An Attribute containing a integer value |
Operands:
| Operand | Description |
|---|---|
evaluator | |
input | |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.sub_new (heir::lattigo::CKKSSubNewOp)
Subtract two ciphertexts in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.sub_new` operands attr-dict `:` functional-type(operands, results)
This operation subtracts one ciphertext value from another in the Lattigo CKKS dialect.
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
lhs | |
rhs | or |
Results:
| Result | Description |
|---|---|
output |
lattigo.ckks.sub (heir::lattigo::CKKSSubOp)
Subtract two ciphertexts in the Lattigo CKKS dialect
Syntax:
operation ::= `lattigo.ckks.sub` operands attr-dict `:` functional-type(operands, results)
This operation subtracts one ciphertext value from another in the Lattigo CKKS dialect.
The result will be written to the inplace operand. The outputresult is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | |
lhs | |
rhs | or |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.rlwe.decrypt (heir::lattigo::RLWEDecryptOp)
Decrypts a ciphertext using RLWE
Syntax:
operation ::= `lattigo.rlwe.decrypt` operands attr-dict `:` functional-type(operands, results)
This operation decrypts a ciphertext using RLWE
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
decryptor | |
ciphertext |
Results:
| Result | Description |
|---|---|
plaintext |
lattigo.rlwe.drop_level_new (heir::lattigo::RLWEDropLevelNewOp)
Drop level of a ciphertext
Syntax:
operation ::= `lattigo.rlwe.drop_level_new` operands attr-dict `:` functional-type(operands, results)
Interfaces: InferTypeOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
levelToDrop | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
evaluator | or |
input |
Results:
| Result | Description |
|---|---|
output |
lattigo.rlwe.drop_level (heir::lattigo::RLWEDropLevelOp)
Drop level of a ciphertext
Syntax:
operation ::= `lattigo.rlwe.drop_level` operands attr-dict `:` functional-type(operands, results)
This operation drops the level of a ciphertext
The result will be written to the inplace operand. The outputresult is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
levelToDrop | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
evaluator | or |
input | |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.rlwe.encrypt (heir::lattigo::RLWEEncryptOp)
Encrypts a plaintext using RLWE
Syntax:
operation ::= `lattigo.rlwe.encrypt` operands attr-dict `:` functional-type(operands, results)
This operation encrypts a plaintext using RLWE
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
encryptor | |
plaintext |
Results:
| Result | Description |
|---|---|
ciphertext |
lattigo.rlwe.gen_galois_key (heir::lattigo::RLWEGenGaloisKeyOp)
Generates a new RLWE Galois key
Syntax:
operation ::= `lattigo.rlwe.gen_galois_key` operands attr-dict `:` functional-type(operands, results)
This operation generates a new RLWE Galois key
galoisElement: Enabling the automorphism X -> X^{galoisElement}.
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
galoisElement | ::mlir::IntegerAttr | An Attribute containing a integer value |
Operands:
| Operand | Description |
|---|---|
keyGenerator | |
secretKey |
Results:
| Result | Description |
|---|---|
galoisKey |
lattigo.rlwe.gen_key_pair (heir::lattigo::RLWEGenKeyPairOp)
Generates a new RLWE key pair
Syntax:
operation ::= `lattigo.rlwe.gen_key_pair` operands attr-dict `:` functional-type(operands, results)
This operation generates a new RLWE key pair
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
keyGenerator |
Results:
| Result | Description |
|---|---|
secretKey | |
publicKey |
lattigo.rlwe.gen_relinearization_key (heir::lattigo::RLWEGenRelinearizationKeyOp)
Generates a new RLWE relinearization key
Syntax:
operation ::= `lattigo.rlwe.gen_relinearization_key` operands attr-dict `:` functional-type(operands, results)
This operation generates a new RLWE relinearization key
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
keyGenerator | |
secretKey |
Results:
| Result | Description |
|---|---|
relinearizationKey |
lattigo.rlwe.negate_new (heir::lattigo::RLWENegateNewOp)
Negate a ciphertext
Syntax:
operation ::= `lattigo.rlwe.negate_new` operands attr-dict `:` functional-type(operands, results)
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | or |
input |
Results:
| Result | Description |
|---|---|
output |
lattigo.rlwe.negate (heir::lattigo::RLWENegateOp)
Negate of a ciphertext
Syntax:
operation ::= `lattigo.rlwe.negate` operands attr-dict `:` functional-type(operands, results)
This operation negates a ciphertext
The result will be written to the inplace operand. The output result is
a transitive reference to the inplace operand for sake of the MLIR SSA form.
Interfaces: InPlaceOpInterface, InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
evaluator | or |
input | |
inplace |
Results:
| Result | Description |
|---|---|
output |
lattigo.rlwe.new_decryptor (heir::lattigo::RLWENewDecryptorOp)
Creates a new RLWE decryptor
Syntax:
operation ::= `lattigo.rlwe.new_decryptor` operands attr-dict `:` functional-type(operands, results)
This operation creates a new RLWE decryptor
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
params | or |
secretKey |
Results:
| Result | Description |
|---|---|
decryptor |
lattigo.rlwe.new_encryptor (heir::lattigo::RLWENewEncryptorOp)
Creates a new RLWE encryptor
Syntax:
operation ::= `lattigo.rlwe.new_encryptor` operands attr-dict `:` functional-type(operands, results)
This operation creates a new RLWE encryptor
Operands:
| Operand | Description |
|---|---|
params | or |
encryptionKey | or |
Results:
| Result | Description |
|---|---|
encryptor |
lattigo.rlwe.new_evaluation_key_set (heir::lattigo::RLWENewEvaluationKeySetOp)
Generates a new RLWE evaluation key set
Syntax:
operation ::= `lattigo.rlwe.new_evaluation_key_set` operands attr-dict `:` functional-type(operands, results)
This operation generates a new RLWE evaluation key set
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
keys | variadic of any type |
Results:
| Result | Description |
|---|---|
evaluationKeySet |
lattigo.rlwe.new_key_generator (heir::lattigo::RLWENewKeyGeneratorOp)
Generates a new RLWE key generator
Syntax:
operation ::= `lattigo.rlwe.new_key_generator` operands attr-dict `:` functional-type(operands, results)
This operation generates a new RLWE key generator
Interfaces: InferTypeOpInterface
Operands:
| Operand | Description |
|---|---|
params | or |
Results:
| Result | Description |
|---|---|
keyGenerator |