Preprocessing

‘preprocessing’ Dialect

The preprocessing dialect defines operations and types for representing sever-side plaintext preprocessing. The dialect is meant as a structural intermediate dialect to support the split-preprocessing pass.

Preprocessing types

PreprocessingStorageType

A storage type wrapping an ordered list of element types

Syntax:

!preprocessing.storage<
  ::llvm::ArrayRef<mlir::Type>   # elementTypes
>

This type is an abstraction over memref (or similar containers) holding an ordered list of element types for multi-type storage, where the exact layout is not yet decided.

This allows us to manage server-side plaintext preprocessing as a single SSA value, hiding details such as whether there are multiple plaintext types that need handling. These details are determined by a later pass that lowers preprocessing.storage to a backend-specific data structure, often a 1D memref, and defers the exact description of that layout until it is easier to determine.

Parameters:

ParameterC++ typeDescription
elementTypes::llvm::ArrayRef<mlir::Type>

Preprocessing ops

preprocessing.empty (heir::preprocessing::EmptyOp)

Allocate an empty preprocessing storage

Syntax:

operation ::= `preprocessing.empty` attr-dict `:` type($storage)

This op creates a new preprocessing.storage value with an undetermined size.

Results:

ResultDescription
storageA storage type wrapping an ordered list of element types

preprocessing.load (heir::preprocessing::LoadOp)

Load a value from preprocessing storage at given indices and site_id

Syntax:

operation ::= `preprocessing.load` $storage `[` $indices `]` `site` $site_id `<` $element_type `>` attr-dict `:` type($storage) `,` type($result)

This op loads a value from a preprocessing.storage, while tracking:

  1. The type being stored.
  2. The site_id it came from, which corresponds to an encode op the value is used in.
  3. An (optional) multiset of indices corresponding to a particular iteration of a loop nest.

In preprocessing-to-memref, this op lowers to extracting a plaintext from a memref.

Attributes:

AttributeMLIR TypeDescription
site_id::mlir::IntegerAttr32-bit signless integer attribute
element_type::mlir::TypeAttrany type attribute

Operands:

OperandDescription
storageA storage type wrapping an ordered list of element types
indicesvariadic of index

Results:

ResultDescription
resultany non-token type

preprocessing.store (heir::preprocessing::StoreOp)

Store a value to preprocessing storage at given indices and site_id

Syntax:

operation ::= `preprocessing.store` $value `,` $storage `[` $indices `]` `site` $site_id `<` $element_type `>` attr-dict `:` type($value) `,` type($storage)

This op stores a value into a preprocessing.storage, while tracking:

  1. The type being stored.
  2. The site_id it came from, which corresponds to an encode op the value is used in.
  3. An (optional) multiset of indices corresponding to a particular iteration of a loop nest.

In preprocessing-to-memref, this op lowers to storing a plaintext in a memref.

Attributes:

AttributeMLIR TypeDescription
site_id::mlir::IntegerAttr32-bit signless integer attribute
element_type::mlir::TypeAttrany type attribute

Operands:

OperandDescription
valueany non-token type
storageA storage type wrapping an ordered list of element types
indicesvariadic of index