Openfhe

‘openfhe’ Dialect

The openfhe dialect is an exit dialect for generating c++ code against the OpenFHE library API.

See https://github.com/openfheorg/openfhe-development

Openfhe types

CCParamsType

The CCParams required to create CryptoContext.

Syntax: !openfhe.cc_params

CryptoContextType

The CryptoContext required to perform homomorphic operations in OpenFHE.

Syntax: !openfhe.crypto_context

EvalKeyType

The evaluation key required to keyswitch/relinearize/rotate/automorphism operation in OpenFHE.

Syntax: !openfhe.eval_key

PrivateKeyType

The private key required to decrypt a ciphertext in OpenFHE.

Syntax: !openfhe.private_key

PublicKeyType

The public key required to encrypt plaintext in OpenFHE.

Syntax: !openfhe.public_key

Openfhe ops

openfhe.add (heir::openfhe::AddOp)

OpenFHE add operation of two ciphertexts.

Syntax:

operation ::= `openfhe.add` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
lhsA type for RLWE ciphertexts
rhsA type for RLWE ciphertexts

Results:

ResultDescription
outputA type for RLWE ciphertexts

openfhe.add_plain (heir::openfhe::AddPlainOp)

OpenFHE add operation of a ciphertext and a plaintext.

Syntax:

operation ::= `openfhe.add_plain` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
ciphertextA type for RLWE ciphertexts
plaintextA type for RLWE plaintexts

Results:

ResultDescription
outputA type for RLWE ciphertexts

openfhe.automorph (heir::openfhe::AutomorphOp)

Syntax:

operation ::= `openfhe.automorph` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
ciphertextA type for RLWE ciphertexts
evalKeyThe evaluation key required to keyswitch/relinearize/rotate/automorphism operation in OpenFHE.

Results:

ResultDescription
outputA type for RLWE ciphertexts

openfhe.decrypt (heir::openfhe::DecryptOp)

Syntax:

operation ::= `openfhe.decrypt` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
ciphertextA type for RLWE ciphertexts
privateKeyThe private key required to decrypt a ciphertext in OpenFHE.

Results:

ResultDescription
plaintextA type for RLWE plaintexts

openfhe.encrypt (heir::openfhe::EncryptOp)

Syntax:

operation ::= `openfhe.encrypt` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
plaintextA type for RLWE plaintexts
publicKeyThe public key required to encrypt plaintext in OpenFHE.

Results:

ResultDescription
ciphertextA type for RLWE ciphertexts

openfhe.gen_context (heir::openfhe::GenContextOp)

Syntax:

operation ::= `openfhe.gen_context` operands attr-dict `:` functional-type(operands, results)

Interfaces: InferTypeOpInterface

Operands:

OperandDescription
paramsThe CCParams required to create CryptoContext.

Results:

ResultDescription
contextThe CryptoContext required to perform homomorphic operations in OpenFHE.

openfhe.gen_mulkey (heir::openfhe::GenMulKeyOp)

Syntax:

operation ::= `openfhe.gen_mulkey` operands attr-dict `:` functional-type(operands, results)

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
privateKeyThe private key required to decrypt a ciphertext in OpenFHE.

openfhe.gen_params (heir::openfhe::GenParamsOp)

Syntax:

operation ::= `openfhe.gen_params` operands attr-dict `:` functional-type(operands, results)

Interfaces: InferTypeOpInterface

Attributes:

AttributeMLIR TypeDescription
mulDepth::mlir::IntegerAttr64-bit signless integer attribute
plainMod::mlir::IntegerAttr64-bit signless integer attribute

Results:

ResultDescription
paramsThe CCParams required to create CryptoContext.

openfhe.gen_rotkey (heir::openfhe::GenRotKeyOp)

Syntax:

operation ::= `openfhe.gen_rotkey` operands attr-dict `:` functional-type(operands, results)

Attributes:

AttributeMLIR TypeDescription
indices::mlir::DenseI64ArrayAttri64 dense array attribute

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
privateKeyThe private key required to decrypt a ciphertext in OpenFHE.

openfhe.key_switch (heir::openfhe::KeySwitchOp)

Syntax:

operation ::= `openfhe.key_switch` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
ciphertextA type for RLWE ciphertexts
evalKeyThe evaluation key required to keyswitch/relinearize/rotate/automorphism operation in OpenFHE.

Results:

ResultDescription
outputA type for RLWE ciphertexts

openfhe.level_reduce (heir::openfhe::LevelReduceOp)

OpenFHE level_reduce operation of a ciphertext.

Syntax:

operation ::= `openfhe.level_reduce` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
ciphertextA type for RLWE ciphertexts

Results:

ResultDescription
outputA type for RLWE ciphertexts

openfhe.make_ckks_packed_plaintext (heir::openfhe::MakeCKKSPackedPlaintextOp)

Syntax:

operation ::= `openfhe.make_ckks_packed_plaintext` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
valueranked tensor of floating-point or integer values

Results:

ResultDescription
plaintextA type for RLWE plaintexts

openfhe.make_packed_plaintext (heir::openfhe::MakePackedPlaintextOp)

Syntax:

operation ::= `openfhe.make_packed_plaintext` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
valueranked tensor of integer values

Results:

ResultDescription
plaintextA type for RLWE plaintexts

openfhe.mod_reduce (heir::openfhe::ModReduceOp)

OpenFHE mod_reduce operation of a ciphertext. (used only for BGV/CKKS)

Syntax:

operation ::= `openfhe.mod_reduce` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
ciphertextA type for RLWE ciphertexts

Results:

ResultDescription
outputA type for RLWE ciphertexts

openfhe.mul_const (heir::openfhe::MulConstOp)

OpenFHE mul operation of a ciphertext and a constant.

Syntax:

operation ::= `openfhe.mul_const` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
ciphertextA type for RLWE ciphertexts
constant64-bit signless integer

Results:

ResultDescription
outputA type for RLWE ciphertexts

openfhe.mul_no_relin (heir::openfhe::MulNoRelinOp)

OpenFHE mul operation of two ciphertexts without relinearization.

Syntax:

operation ::= `openfhe.mul_no_relin` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
lhsA type for RLWE ciphertexts
rhsA type for RLWE ciphertexts

Results:

ResultDescription
outputA type for RLWE ciphertexts

openfhe.mul (heir::openfhe::MulOp)

OpenFHE mul operation of two ciphertexts with relinearization.

Syntax:

operation ::= `openfhe.mul` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
lhsA type for RLWE ciphertexts
rhsA type for RLWE ciphertexts

Results:

ResultDescription
outputA type for RLWE ciphertexts

openfhe.mul_plain (heir::openfhe::MulPlainOp)

OpenFHE mul operation of a ciphertext and a plaintext.

Syntax:

operation ::= `openfhe.mul_plain` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
ciphertextA type for RLWE ciphertexts
plaintextA type for RLWE plaintexts

Results:

ResultDescription
outputA type for RLWE ciphertexts

openfhe.negate (heir::openfhe::NegateOp)

OpenFHE negate operation of a ciphertext.

Syntax:

operation ::= `openfhe.negate` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
ciphertextA type for RLWE ciphertexts

Results:

ResultDescription
outputA type for RLWE ciphertexts

openfhe.relin (heir::openfhe::RelinOp)

OpenFHE relinearize operation of a ciphertext.

Syntax:

operation ::= `openfhe.relin` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
ciphertextA type for RLWE ciphertexts

Results:

ResultDescription
outputA type for RLWE ciphertexts

openfhe.rot (heir::openfhe::RotOp)

Syntax:

operation ::= `openfhe.rot` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
index::mlir::IntegerAttrAn Attribute containing a integer value

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
ciphertextA type for RLWE ciphertexts

Results:

ResultDescription
outputA type for RLWE ciphertexts

openfhe.square (heir::openfhe::SquareOp)

OpenFHE square operation of a ciphertext.

Syntax:

operation ::= `openfhe.square` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
ciphertextA type for RLWE ciphertexts

Results:

ResultDescription
outputA type for RLWE ciphertexts

openfhe.sub (heir::openfhe::SubOp)

OpenFHE sub operation of two ciphertexts.

Syntax:

operation ::= `openfhe.sub` operands attr-dict `:` functional-type(operands, results)

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, InferTypeOpInterface, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Operands:

OperandDescription
cryptoContextThe CryptoContext required to perform homomorphic operations in OpenFHE.
lhsA type for RLWE ciphertexts
rhsA type for RLWE ciphertexts

Results:

ResultDescription
outputA type for RLWE ciphertexts