Poulpy

‘poulpy’ Dialect

The poulpy dialect is an exit dialect for generating Rust code against the Poulpy library API.

See https://github.com/poulpy-fhe/poulpy

Poulpy types

AutomorphismKeyMapType

Map of prepared automorphism keys keyed by Galois element

Syntax: !poulpy.automorphism_key_map

See https://docs.rs/poulpy-core/latest/poulpy_core/layouts/struct.GLWEAutomorphismKey.html

BootstrappingContextType

Compiled bootstrapping context with resident DFT matrices

Syntax: !poulpy.bootstrapping_context

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/layouts/bootstrapping/struct.BootstrappingContext.html

BootstrappingKeysType

Prepared bundle of bootstrapping evaluation keys

Syntax: !poulpy.bootstrapping_keys

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/layouts/bootstrapping_keys/struct.BootstrappingKeysPrepared.html

CiphertextType

CKKS ciphertext storage plus semantic precision metadata.

Syntax: !poulpy.ciphertext

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/layouts/ciphertext/struct.CKKSCiphertext.html

ModuleType

An evaluator context for the poulpy backend

Syntax:

!poulpy.module<
  ::mlir::heir::poulpy::PoulpyBackend   # backend
>

See https://docs.rs/poulpy-hal/latest/poulpy_hal/layouts/struct.Module.html

Parameters:

ParameterC++ typeDescription
backend::mlir::heir::poulpy::PoulpyBackend

PlaintextType

A plaintext in the ZNX (torus) domain in the poulpy backend

Syntax: !poulpy.plaintext

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/layouts/plaintext/struct.CKKSPlaintext.html

ScratchType

Owned scratch buffer for temporary workspace during polynomial operations.

Syntax: !poulpy.scratch

See https://docs.rs/poulpy-hal/latest/poulpy_hal/layouts/struct.ScratchOwned.html

SecretKeyType

A DFT-domain prepared GLWE secret key

Syntax: !poulpy.secret_key

See https://docs.rs/poulpy-core/latest/poulpy_core/layouts/prepared/struct.GLWESecretPrepared.html

TensorKeyType

DFT-domain (prepared) variant of a GLWE tensor key.

Syntax: !poulpy.tensor_key

See https://docs.rs/poulpy-core/latest/poulpy_core/layouts/prepared/struct.GLWETensorKeyPrepared.html

UnnormalizedCiphertextType

A CKKS ciphertext produced by an unnormalized linear operation

Syntax: !poulpy.unnormalized_ciphertext

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/layouts/ciphertext/type.UnnormalizedCKKSCiphertext.html

Poulpy ops

poulpy.add (heir::poulpy::AddOp)

Computes dst = a + b.

Syntax:

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

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSAddOps.html

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
dstmemref of CKKS ciphertext storage plus semantic precision metadata. values
amemref of CKKS ciphertext storage plus semantic precision metadata. values
bmemref of CKKS ciphertext storage plus semantic precision metadata. values
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.add_assign (heir::poulpy::AddAssignOp)

Computes dst += a.

Syntax:

operation ::= `poulpy.add_assign` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSAddOps.html

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
dstmemref of CKKS ciphertext storage plus semantic precision metadata. values
amemref of CKKS ciphertext storage plus semantic precision metadata. values
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.add_unnormalized (heir::poulpy::AddUnnormalizedOp)

Computes dst = a + b without normalizing dst.

Syntax:

operation ::= `poulpy.add_unnormalized` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSAddOps.html

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
dstmemref of A CKKS ciphertext produced by an unnormalized linear operation values
amemref of CKKS ciphertext storage plus semantic precision metadata. values
bmemref of CKKS ciphertext storage plus semantic precision metadata. values
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.compact_limbs (heir::poulpy::CompactLimbsOp)

Level-aware ciphertext copy that compacts src into a smaller dst.

Syntax:

operation ::= `poulpy.compact_limbs` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSCopyOps.html

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
dstmemref of CKKS ciphertext storage plus semantic precision metadata. values
srcmemref of CKKS ciphertext storage plus semantic precision metadata. values
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.decode (heir::poulpy::DecodeOp)

Decode a plaintext into real and imaginary slot vectors

Syntax:

operation ::= `poulpy.decode` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/encoding/reim/struct.Encoder.html

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
realmemref of any non-token type values
imagmemref of any non-token type values
plaintextmemref of A plaintext in the ZNX (torus) domain in the poulpy backend values

poulpy.decrypt (heir::poulpy::DecryptOp)

Secret-key decryption of a CKKS ciphertext

Syntax:

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

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSDecrypt.html

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
plaintextmemref of A plaintext in the ZNX (torus) domain in the poulpy backend values
ciphertextmemref of CKKS ciphertext storage plus semantic precision metadata. values
secret_keyA DFT-domain prepared GLWE secret key
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.encode (heir::poulpy::EncodeOp)

Encode real and imaginary slot vectors into a plaintext

Syntax:

operation ::= `poulpy.encode` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/encoding/reim/struct.Encoder.html

Attributes:

AttributeMLIR TypeDescription
logDelta::mlir::IntegerAttr64-bit signless integer attribute
logBudget::mlir::IntegerAttr64-bit signless integer attribute

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
plaintextmemref of A plaintext in the ZNX (torus) domain in the poulpy backend values
realmemref of any non-token type values
imagmemref of any non-token type values

poulpy.encrypt (heir::poulpy::EncryptOp)

Secret-key encryption of a CKKS plaintext

Syntax:

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

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSEncrypt.html

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
ciphertextmemref of CKKS ciphertext storage plus semantic precision metadata. values
plaintextmemref of A plaintext in the ZNX (torus) domain in the poulpy backend values
secret_keyA DFT-domain prepared GLWE secret key
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.module_create (heir::poulpy::ModuleCreateOp)

Create a new poulpy module

Syntax:

operation ::= `poulpy.module_create` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-hal/latest/poulpy_hal/layouts/struct.Module.html

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
N::mlir::IntegerAttr64-bit signless integer attribute

Results:

ResultDescription
moduleAn evaluator context for the poulpy backend

poulpy.mul (heir::poulpy::MulOp)

Computes dst = a * b using tensor-product keyswitching via tsk.

Syntax:

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

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSMulOps.html

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
dstmemref of CKKS ciphertext storage plus semantic precision metadata. values
amemref of CKKS ciphertext storage plus semantic precision metadata. values
bmemref of CKKS ciphertext storage plus semantic precision metadata. values
tskDFT-domain (prepared) variant of a GLWE tensor key.
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.mul_assign (heir::poulpy::MulAssignOp)

Computes dst *= a in-place using tensor-product keyswitching via tsk.

Syntax:

operation ::= `poulpy.mul_assign` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSMulOps.html

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
dstmemref of CKKS ciphertext storage plus semantic precision metadata. values
amemref of CKKS ciphertext storage plus semantic precision metadata. values
tskDFT-domain (prepared) variant of a GLWE tensor key.
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.normalize (heir::poulpy::NormalizeOp)

Propagate carries in an unnormalized ciphertext, producing a normalized result.

Syntax:

operation ::= `poulpy.normalize` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-core/latest/poulpy_core/api/trait.GLWENormalize.html

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
resmemref of CKKS ciphertext storage plus semantic precision metadata. values
amemref of A CKKS ciphertext produced by an unnormalized linear operation values
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.rescale (heir::poulpy::RescaleOp)

Computes dst = src / 2^bits.

Syntax:

operation ::= `poulpy.rescale` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSPow2Ops.html

Attributes:

AttributeMLIR TypeDescription
bits::mlir::IntegerAttr64-bit signless integer attribute

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
dstmemref of CKKS ciphertext storage plus semantic precision metadata. values
srcmemref of CKKS ciphertext storage plus semantic precision metadata. values
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.rescale_assign (heir::poulpy::RescaleAssignOp)

Computes dst /= 2^bits in-place.

Syntax:

operation ::= `poulpy.rescale_assign` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSPow2Ops.html

Attributes:

AttributeMLIR TypeDescription
bits::mlir::IntegerAttr64-bit signless integer attribute

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
dstmemref of CKKS ciphertext storage plus semantic precision metadata. values
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.rotate (heir::poulpy::RotateOp)

Computes dst = rotate(src, k): shifts all complex slots by k positions.

Syntax:

operation ::= `poulpy.rotate` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSRotateOps.html

Attributes:

AttributeMLIR TypeDescription
k::mlir::IntegerAttr64-bit signless integer attribute

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
dstmemref of CKKS ciphertext storage plus semantic precision metadata. values
srcmemref of CKKS ciphertext storage plus semantic precision metadata. values
keysMap of prepared automorphism keys keyed by Galois element
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.rotate_assign (heir::poulpy::RotateAssignOp)

Computes dst = rotate(dst, k) in-place. Metadata is unchanged.

Syntax:

operation ::= `poulpy.rotate_assign` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSRotateOps.html

Attributes:

AttributeMLIR TypeDescription
k::mlir::IntegerAttr64-bit signless integer attribute

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
dstmemref of CKKS ciphertext storage plus semantic precision metadata. values
keysMap of prepared automorphism keys keyed by Galois element
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.scratch_alloc (heir::poulpy::ScratchAllocOp)

Allocate a scratch arena of the given byte size

Syntax:

operation ::= `poulpy.scratch_alloc` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-hal/latest/poulpy_hal/layouts/struct.ScratchOwned.html

Traits: AlwaysSpeculatableImplTrait

Interfaces: ConditionallySpeculatable, NoMemoryEffect (MemoryEffectOpInterface)

Effects: MemoryEffects::Effect{}

Attributes:

AttributeMLIR TypeDescription
size::mlir::IntegerAttr64-bit signless integer attribute

Results:

ResultDescription
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.sub (heir::poulpy::SubOp)

Computes dst = a - b.

Syntax:

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

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSSubOps.html

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
dstmemref of CKKS ciphertext storage plus semantic precision metadata. values
amemref of CKKS ciphertext storage plus semantic precision metadata. values
bmemref of CKKS ciphertext storage plus semantic precision metadata. values
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.sub_assign (heir::poulpy::SubAssignOp)

Computes dst -= a.

Syntax:

operation ::= `poulpy.sub_assign` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSSubOps.html

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
dstmemref of CKKS ciphertext storage plus semantic precision metadata. values
amemref of CKKS ciphertext storage plus semantic precision metadata. values
scratchOwned scratch buffer for temporary workspace during polynomial operations.

poulpy.sub_unnormalized (heir::poulpy::SubUnnormalizedOp)

Computes dst = a - b without normalizing dst.

Syntax:

operation ::= `poulpy.sub_unnormalized` operands attr-dict `:` functional-type(operands, results)

See https://docs.rs/poulpy-ckks/latest/poulpy_ckks/api/trait.CKKSSubOps.html

Operands:

OperandDescription
moduleAn evaluator context for the poulpy backend
dstmemref of A CKKS ciphertext produced by an unnormalized linear operation values
amemref of CKKS ciphertext storage plus semantic precision metadata. values
bmemref of CKKS ciphertext storage plus semantic precision metadata. values
scratchOwned scratch buffer for temporary workspace during polynomial operations.

Poulpy additional definitions

PoulpyBackend

An enum attribute representing a module’s backend-specific handle

Cases:

SymbolValueString
FFT64Ref0fft64_ref
NTT4x30Ref1ntt4x30_ref