Mgmt

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 0
  • dimension : the dimension of the ciphertext, defaults to 2

Internally, this attribute is used by secret-to- for determining the level and dimension of the ciphertext.

It should be populated by –secret-with-mgmt- before going through the secret-to- pass.

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:

ParameterC++ typeDescription
levelint
dimensionint

Mgmt ops

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:

OperandDescription
inputany type

Results:

ResultDescription
outputany 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:

OperandDescription
inputany type

Results:

ResultDescription
outputany type