Mgmt
‘mgmt’ Dialect
The mgmt
dialect contains scheme-agnostic ciphertext management ops
(like relinearize and mod reduce), to enable initial high-level compiler
passes to perform a first pass at parameter selection, while lower-level
passes may refine them with scheme-specific information.
Mgmt attributes
MgmtAttr
Container attribute for all mgmt parameter
Syntax:
#mgmt.mgmt<
int, # level
int # dimension
>
This attribute is used to store all mgmt parameters.
The attribute is a struct with the following fields:
level
: the level of the ciphertext, from L to 0dimension
: the dimension of the ciphertext, defaults to 2
Internally, this attribute is used by secret-to-
It should be populated by –secret-with-mgmt-
Example:
#mgmt = #mgmt.mgmt<level = 1> // dimension defaults to 2
#mgmt1 = #mgmt.mgmt<level = 1, dimension = 3>
%0 = secret.generic ins(%arg0, %arg1 : !secret.secret<i16>) attrs = {mgmt.mgmt = #mgmt} {
...
} -> !secret.secret<i16>
Parameters:
Parameter | C++ type | Description |
---|---|---|
level | int | |
dimension | int |
Mgmt ops
mgmt.bootstrap
(heir::mgmt::BootstrapOp)
Bootstrap the input ciphertext to refresh its noise budget
Syntax:
operation ::= `mgmt.bootstrap` operands attr-dict `:` type($output)
This is a scheme-agnostic operation that implies bootstrapping of the input ciphertext to refresh its noise budget.
Bootstrapping is a technique used in homomorphic encryption to reduce the noise in a ciphertext, allowing further operations to be performed on it without decryption.
When further lowered, it could be lowered to bgv.bootstrap or ckks.bootstrap depending on the scheme.
For the current backend, only ckks.bootstrap is supported. Further backend may include bgv.bootstrap.
Traits: AlwaysSpeculatableImplTrait
, Elementwise
, SameOperandsAndResultType
, Scalarizable
, Tensorizable
, Vectorizable
Interfaces: ConditionallySpeculatable
, InferTypeOpInterface
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
input | any type |
Results:
Result | Description |
---|---|
output | any type |
mgmt.modreduce
(heir::mgmt::ModReduceOp)
Modulus switch the input ciphertext down by one limb (RNS assumed)
Syntax:
operation ::= `mgmt.modreduce` operands attr-dict `:` type($output)
This is scheme-agonistic operation that implies modulus switching/rescaling by one limb.
Input ciphertext is assumed to be in RNS form when further lowered.
When further lowered, it could be lowered to bgv.modulus_switch or ckks.rescale depending on the scheme.
Traits: AlwaysSpeculatableImplTrait
, Elementwise
, SameOperandsAndResultType
, Scalarizable
, Tensorizable
, Vectorizable
Interfaces: ConditionallySpeculatable
, InferTypeOpInterface
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
input | any type |
Results:
Result | Description |
---|---|
output | any type |
mgmt.relinearize
(heir::mgmt::RelinearizeOp)
Relinearize the input ciphertext to be linear
Syntax:
operation ::= `mgmt.relinearize` operands attr-dict `:` type($output)
This is scheme-agonistic operation that implies relinearization of the input ciphertext to be linear (i.e. returns to dimension 2).
This is used solely by multiplication. For rotation, currently HEIR assumes relinearization is done internally and does not have a separate scheme-specific operation for it.
This accepts a ciphertext with dimension > 2 and returns a ciphertext with dimension 2. Note that the semantic includes the relinearization of higher dimension input like input with dimension 4 or higher, which when materialized should require multiple relinearization keys.
When further lowered, it could be lowered to bgv.relinearize or ckks.relinearize depending on the scheme.
Traits: AlwaysSpeculatableImplTrait
, Elementwise
, SameOperandsAndResultType
, Scalarizable
, Tensorizable
, Vectorizable
Interfaces: ConditionallySpeculatable
, InferTypeOpInterface
, NoMemoryEffect (MemoryEffectOpInterface)
Effects: MemoryEffects::Effect{}
Operands:
Operand | Description |
---|---|
input | any type |
Results:
Result | Description |
---|---|
output | any type |