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
BootstrappingKeysType
Prepared bundle of bootstrapping evaluation keys
Syntax: !poulpy.bootstrapping_keys
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:
| Parameter | C++ type | Description |
|---|---|---|
| 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
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:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
dst | memref of CKKS ciphertext storage plus semantic precision metadata. values |
a | memref of CKKS ciphertext storage plus semantic precision metadata. values |
b | memref of CKKS ciphertext storage plus semantic precision metadata. values |
scratch | Owned 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:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
dst | memref of CKKS ciphertext storage plus semantic precision metadata. values |
a | memref of CKKS ciphertext storage plus semantic precision metadata. values |
scratch | Owned 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:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
dst | memref of A CKKS ciphertext produced by an unnormalized linear operation values |
a | memref of CKKS ciphertext storage plus semantic precision metadata. values |
b | memref of CKKS ciphertext storage plus semantic precision metadata. values |
scratch | Owned 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:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
dst | memref of CKKS ciphertext storage plus semantic precision metadata. values |
src | memref of CKKS ciphertext storage plus semantic precision metadata. values |
scratch | Owned 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:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
real | memref of any non-token type values |
imag | memref of any non-token type values |
plaintext | memref 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:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
plaintext | memref of A plaintext in the ZNX (torus) domain in the poulpy backend values |
ciphertext | memref of CKKS ciphertext storage plus semantic precision metadata. values |
secret_key | A DFT-domain prepared GLWE secret key |
scratch | Owned 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:
| Attribute | MLIR Type | Description |
|---|---|---|
logDelta | ::mlir::IntegerAttr | 64-bit signless integer attribute |
logBudget | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
plaintext | memref of A plaintext in the ZNX (torus) domain in the poulpy backend values |
real | memref of any non-token type values |
imag | memref 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:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
ciphertext | memref of CKKS ciphertext storage plus semantic precision metadata. values |
plaintext | memref of A plaintext in the ZNX (torus) domain in the poulpy backend values |
secret_key | A DFT-domain prepared GLWE secret key |
scratch | Owned 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:
| Attribute | MLIR Type | Description |
|---|---|---|
N | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Results:
| Result | Description |
|---|---|
module | An 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:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
dst | memref of CKKS ciphertext storage plus semantic precision metadata. values |
a | memref of CKKS ciphertext storage plus semantic precision metadata. values |
b | memref of CKKS ciphertext storage plus semantic precision metadata. values |
tsk | DFT-domain (prepared) variant of a GLWE tensor key. |
scratch | Owned 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:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
dst | memref of CKKS ciphertext storage plus semantic precision metadata. values |
a | memref of CKKS ciphertext storage plus semantic precision metadata. values |
tsk | DFT-domain (prepared) variant of a GLWE tensor key. |
scratch | Owned 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:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
res | memref of CKKS ciphertext storage plus semantic precision metadata. values |
a | memref of A CKKS ciphertext produced by an unnormalized linear operation values |
scratch | Owned 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:
| Attribute | MLIR Type | Description |
|---|---|---|
bits | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
dst | memref of CKKS ciphertext storage plus semantic precision metadata. values |
src | memref of CKKS ciphertext storage plus semantic precision metadata. values |
scratch | Owned 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:
| Attribute | MLIR Type | Description |
|---|---|---|
bits | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
dst | memref of CKKS ciphertext storage plus semantic precision metadata. values |
scratch | Owned 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:
| Attribute | MLIR Type | Description |
|---|---|---|
k | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
dst | memref of CKKS ciphertext storage plus semantic precision metadata. values |
src | memref of CKKS ciphertext storage plus semantic precision metadata. values |
keys | Map of prepared automorphism keys keyed by Galois element |
scratch | Owned 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:
| Attribute | MLIR Type | Description |
|---|---|---|
k | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
dst | memref of CKKS ciphertext storage plus semantic precision metadata. values |
keys | Map of prepared automorphism keys keyed by Galois element |
scratch | Owned 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:
| Attribute | MLIR Type | Description |
|---|---|---|
size | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Results:
| Result | Description |
|---|---|
scratch | Owned 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:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
dst | memref of CKKS ciphertext storage plus semantic precision metadata. values |
a | memref of CKKS ciphertext storage plus semantic precision metadata. values |
b | memref of CKKS ciphertext storage plus semantic precision metadata. values |
scratch | Owned 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:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
dst | memref of CKKS ciphertext storage plus semantic precision metadata. values |
a | memref of CKKS ciphertext storage plus semantic precision metadata. values |
scratch | Owned 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:
| Operand | Description |
|---|---|
module | An evaluator context for the poulpy backend |
dst | memref of A CKKS ciphertext produced by an unnormalized linear operation values |
a | memref of CKKS ciphertext storage plus semantic precision metadata. values |
b | memref of CKKS ciphertext storage plus semantic precision metadata. values |
scratch | Owned scratch buffer for temporary workspace during polynomial operations. |
Poulpy additional definitions
PoulpyBackend
An enum attribute representing a module’s backend-specific handle
Cases:
| Symbol | Value | String |
|---|---|---|
| FFT64Ref | 0 | fft64_ref |
| NTT4x30Ref | 1 | ntt4x30_ref |