CheddarGPU

‘cheddar_gpu’ Dialect

The cheddar_gpu dialect represents low-level buffer operations mirroring Cheddar’s GPU kernels (ElementWise.cu, NTT.cu, ModSwitch.cu).

Data representation contract:

  • Buffers are plain memref<L x N x iW> where L is the number of limbs, N = 2^log_n is the ring degree, and W in {32, 64} is the word width.
  • Limb layout is limb-major [limb][coeff].
  • Limb order follows Cheddar convention: ter[num_ter - 1 ... 0], main[0 ...], aux[0 ...].
  • Every buffer operand has a representation form. Ops that accept more than one form carry *_form attributes; for all other ops the forms are implied and documented in the op description. The forms are:
    • coeff: canonical coefficient form in [0, q). Natural order.
    • coeff_centered: centered coefficient form in [-(q-1)/2, (q-1)/2]. Natural order.
    • eval: evaluation domain representation. By Cheddar convention, data in eval form is in Montgomery form (x * R mod q where R = 2^W) AND in bit-reversed coefficient order.
  • Operations follow destination-passing style where output buffers are explicit operands and operations have no SSA results, matching Cheddar’s preallocated device memory execution model.

CheddarGPU attributes

FormAttr

Cheddar polynomial representation form

Syntax:

#cheddar_gpu.form<
  `coeff` | `coeff_centered` | `eval`   # value
>

Enum cases:

  • coeff (Coeff)
  • coeff_centered (CoeffCentered)
  • eval (Eval)

Parameters:

ParameterC++ typeDescription
value::mlir::heir::cheddar_gpu::Forman enum of type Form

HoistPhaseKindAttr

Hoist phase kind (cts or stc)

Syntax:

#cheddar_gpu.hoist_phase_kind<
  `cts` | `stc`   # value
>

Parameters:

ParameterC++ typeDescription
value::mlir::heir::cheddar_gpu::HoistPhaseKindan enum of type HoistPhaseKind

INTTEpilogueAttr

INTT epilogue post-processing mode

Syntax:

#cheddar_gpu.intt_epilogue<
  `none` | `mult_const` | `mult_const_normalize`   # value
>

Enum cases:

  • none (None)
  • mult_const (MultConst)
  • mult_const_normalize (MultConstNormalize)

Parameters:

ParameterC++ typeDescription
value::mlir::heir::cheddar_gpu::INTTEpiloguean enum of type INTTEpilogue

ParamsAttr

Cheddar GPU scheme parameters

Syntax:

#cheddar_gpu.params<
  uint32_t,   # word
  uint32_t,   # log_n
  ::mlir::DenseI64ArrayAttr,   # ter
  ::mlir::DenseI64ArrayAttr,   # main
  ::mlir::DenseI64ArrayAttr,   # aux
  ::mlir::ArrayAttr,   # level_config
  uint32_t,   # alpha
  uint32_t   # dnum
>

Module-level attribute encoding scheme parameters and modulus chain info.

Every prime in ter, main, and aux must lie in the open interval (0, 2^(word - 1)), which leaves the top bit of each word free as headroom for modular arithmetic.

Parameters:

ParameterC++ typeDescription
worduint32_tword size in bits (32 or 64)
log_nuint32_tlog2 of the polynomial degree N = 2^log_n
ter::mlir::DenseI64ArrayAttrmoduli for terminal primes (ter[0 … num_ter - 1])
main::mlir::DenseI64ArrayAttrmoduli for main primes (main[0 … num_main - 1])
aux::mlir::DenseI64ArrayAttrmoduli for auxiliary primes (aux[0 … num_aux - 1])
level_config::mlir::ArrayAttrlist of [m, t] pairs specifying level modulus configuration
alphauint32_tnumber of auxiliary primes per digit in key-switching
dnumuint32_tnumber of digits in key-switching

CheddarGPU ops

cheddar_gpu.add (heir::cheddar_gpu::AddOp)

Pointwise modular addition of two RNS polynomials

Syntax:

operation ::= `cheddar_gpu.add` $out `,` $lhs `,` $rhs prop-dict attr-dict `:` type($out) (`->` type($result)^)?

Mirrors Cheddar’s kernel::Sum and ElementWiseHandler::Add in ElementWise.cu. Computes out = lhs + rhs mod Q limb-wise, where the limbs of Q are defined in CheddarGPU_ParamsAttr.

Form contract:

  • Modular addition is valid in both coeff and eval domain.
  • Both operands must have matching form (lhs_form == rhs_form == out_form).

Traits: CheddarGPU_NumAuxWithinOut

Interfaces: DestinationStyleOpInterface, MemoryEffectOpInterface

Attributes:

AttributeMLIR TypeDescription
lhs_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
rhs_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
out_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
outstatically shaped 2D polynomial memref or tensor
lhsstatically shaped 2D polynomial memref or tensor
rhsstatically shaped 2D polynomial memref or tensor

Results:

ResultDescription
resultvariadic of statically shaped 2D tensor of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.add_2 (heir::cheddar_gpu::Add2Op)

Pointwise modular addition of two pairs of polynomial buffers

Syntax:

operation ::= `cheddar_gpu.add_2` `ins` `(` $lhs_bx `,` $lhs_ax `,` $rhs_bx `,` $rhs_ax `)`
              `outs` `(` $out_bx `,` $out_ax `)`
              prop-dict attr-dict `:` type($out_bx)

Mirrors Cheddar’s ElementWiseHandler::Add with two polynomials, which launches kernel::Sum<word, 2> in ElementWise.cu. Computes out_bx = lhs_bx + rhs_bx mod Q and out_ax = lhs_ax + rhs_ax mod Q limb-wise, where the limbs of Q are defined in CheddarGPU_ParamsAttr.

Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
lhs_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
rhs_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
out_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
lhs_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
rhs_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
lhs_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
lhs_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
rhs_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
rhs_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.add_const (heir::cheddar_gpu::AddConstOp)

Pointwise addition of per-limb constants to a polynomial buffer

Syntax:

operation ::= `cheddar_gpu.add_const` operands prop-dict attr-dict `:` functional-type(operands, results)

Mirrors Cheddar’s kernel::AddConst and ElementWiseHandler::AddConst in ElementWise.cu. Computes out[l][i] = in[l][i] + cst[l] mod Q_l, where Q_l is the l-th limb of Q from CheddarGPU_ParamsAttr.

Form contract:

  • Valid in both coeff and eval domain (in_form == out_form).

Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
in_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
out_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
in_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
cststatically shaped 1D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.bconv (heir::cheddar_gpu::BConvOp)

Approximate basis conversion (BConv) of polynomial buffers

Syntax:

operation ::= `cheddar_gpu.bconv` operands prop-dict attr-dict `:` functional-type(operands, results)

Mirrors Cheddar’s kernel::ModSwitchMatrixMult in ModSwitch.cu. Converts polynomial coefficients from a source modulus chain (in, with src_len limbs) to a destination modulus chain (out, with dst_len computed limbs) via the approximate HPS (Halevi-Polyakov-Smart) basis conversion formula:

out[m, x] = MontReduce(sum_{s=0}^{src_len-1} in[s, x] * table[m, s])

where table[m, s] = Normalize((Q̂_s * R^2) mod p_m, p_m) is the precomputed double-Montgomery projection table, with Q_s being the s-th limb of Q from CheddarGPU_ParamsAttr.

Contract:

  • Input form is coeff_centered, which can be produced by an INTT with mult_const_normalize epilogue.
  • Output form is coeff.
  • table is a memref of shape <DxSxiW>, where D is the number of computed destination limbs (dst_len) and S is the number of active source limbs (src_len).
  • skip_range = [skip_start, skip_end], when specified, causes destination limbs m in [0, dst_len) to map to limb index (m < skip_start) ? m : m + (skip_end - skip_start) in the destination buffer.
  • in_limb_range and out_limb_range are optional [offset, count] ranges for slicing larger buffers.

Traits: LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
skip_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [start >= 0, end >= start]
in_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
dst_primes::mlir::DenseI64ArrayAttri64 dense array attribute

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
tablestatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.boot (heir::cheddar_gpu::BootOp)

High-level bootstrapping operation for CKKS ciphertext

Syntax:

operation ::= `cheddar_gpu.boot` `ins` `(` $in_bx `,` $in_ax `,` $consts_slab `,` $evk_slab `:`
              type($in_bx) `,` type($in_ax) `,` type($consts_slab) `,` type($evk_slab) `)`
              `outs` `(` $out_bx `,` $out_ax `:` type($out_bx) `,` type($out_ax) `)`
              prop-dict attr-dict

Performs full bootstrapping on ciphertext (in_bx, in_ax) using consts_slab and evk_slab, producing refreshed ciphertext (out_bx, out_ax). All ciphertext operands are in eval form.

Attributes:

AttributeMLIR TypeDescription
num_slots::mlir::IntegerAttr64-bit signless integer attribute whose value is a power of two > 0 whose minimum value is 256 whose maximum value is 32768
params::mlir::heir::cheddar_gpu::ParamsAttrCheddar GPU scheme parameters

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 64-bit signless integer values
out_axstatically shaped 2D memref of 64-bit signless integer values
in_bxstatically shaped 2D memref of 64-bit signless integer values
in_axstatically shaped 2D memref of 64-bit signless integer values
consts_slabstatically shaped 1D memref of 8-bit integer values
evk_slabstatically shaped 1D memref of 8-bit integer values

cheddar_gpu.copy (heir::cheddar_gpu::CopyOp)

Pointwise copy of a polynomial buffer or slice

Syntax:

operation ::= `cheddar_gpu.copy` operands prop-dict attr-dict `:` functional-type(operands, results)

Copies elements from in to out. Supports optional in_limb_range and out_limb_range [start, count].

Traits: CheddarGPU_InOutCountsMatch, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
in_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.cp_accum (heir::cheddar_gpu::CPAccumOp)

Accumulate Montgomery products: dst = sum_k (common_srcs[k] * ct_srcs[k])

Syntax:

operation ::= `cheddar_gpu.cp_accum` $out `,` `ct_srcs` `(` $ct_srcs `)` `,` `common_srcs` `(` $common_srcs `)` prop-dict attr-dict
              `:` functional-type(operands, results)

Mirrors Cheddar’s kernel::CPAccum and ElementWiseHandler::CPAccumWorker<false/true> in ElementWise.cu. Computes out = sum_k MultMontgomery(ct_srcs[k], common_srcs[k]). common_srcs can be polynomial buffers (memref<LxNxiW>) or per-limb constants (memref<LxiW>).

Form contract:

  • Montgomery pointwise multiplication requires eval form for all operands.

Traits: AttrSizedOperandSegments, CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
prime_offset::mlir::IntegerAttr64-bit signless integer attribute
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
ct_srcsvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
common_srcsvariadic of statically shaped polynomial buffer or per-limb constant vector

cheddar_gpu.cp_accum_2 (heir::cheddar_gpu::CPAccum2Op)

Accumulate Montgomery products for two polynomials: {out_bx, out_ax} = sum_k MontMul({ct_bx[k], ct_ax[k]}, common[k])

Syntax:

operation ::= `cheddar_gpu.cp_accum_2` $out_bx `,` $out_ax `,` `ct_bx_srcs` `(` $ct_bx_srcs `)` `,`
              `ct_ax_srcs` `(` $ct_ax_srcs `)` `,` `common_srcs` `(` $common_srcs `)` prop-dict attr-dict
              `:` functional-type(operands, results)

Mirrors Cheddar’s CPAccum<word,2,...> / PAccum in Context.cpp / ElementWise.cu. Computes {out_bx, out_ax} = sum_k MontMul({ct_bx[k], ct_ax[k]}, common[k]) over k < K (K <= 4), reading each common[k] (mod-up digit) once for both outputs.

Traits: AttrSizedOperandSegments, CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
prime_offset::mlir::IntegerAttr64-bit signless integer attribute
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
ct_bx_srcsvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
ct_ax_srcsvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
common_srcsvariadic of statically shaped polynomial buffer or per-limb constant vector

cheddar_gpu.cp_accum_add (heir::cheddar_gpu::CPAccumAddOp)

Accumulate Montgomery products with base: dst = acc + sum_k (common_srcs[k] * ct_srcs[k])

Syntax:

operation ::= `cheddar_gpu.cp_accum_add` $out `,` `acc` `(` $acc `)` `,` `ct_srcs` `(` $ct_srcs `)` `,`
              `common_srcs` `(` $common_srcs `)` prop-dict attr-dict `:` functional-type(operands, results)

Mirrors Cheddar’s kernel::CPAccumAdd in ElementWise.cu. Computes out = acc + sum_k MultMontgomery(ct_srcs[k], common_srcs[k]).

Form contract:

  • Montgomery pointwise multiplication requires eval form for all operands.

Traits: AttrSizedOperandSegments, CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
prime_offset::mlir::IntegerAttr64-bit signless integer attribute
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
accstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
ct_srcsvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
common_srcsvariadic of statically shaped polynomial buffer or per-limb constant vector

cheddar_gpu.cp_accum_add_2 (heir::cheddar_gpu::CPAccumAdd2Op)

Accumulate Montgomery products with base for two polynomials: {out_bx, out_ax} = {acc_bx, acc_ax} + sum_k MontMul({ct_bx[k], ct_ax[k]}, common[k])

Syntax:

operation ::= `cheddar_gpu.cp_accum_add_2` $out_bx `,` $out_ax `,` `acc` `(` $acc_bx `,` $acc_ax `)` `,`
              `ct_bx_srcs` `(` $ct_bx_srcs `)` `,` `ct_ax_srcs` `(` $ct_ax_srcs `)` `,`
              `common_srcs` `(` $common_srcs `)` prop-dict attr-dict `:` functional-type(operands, results)

Mirrors Cheddar’s CPAccumAdd<L,2> / CAccum in Context.cpp / ElementWise.cu. Computes {out_bx, out_ax} = {acc_bx, acc_ax} + sum_k MontMul({ct_bx[k], ct_ax[k]}, common[k]).

Traits: AttrSizedOperandSegments, CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
prime_offset::mlir::IntegerAttr64-bit signless integer attribute
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
acc_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
acc_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
ct_bx_srcsvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
ct_ax_srcsvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
common_srcsvariadic of statically shaped polynomial buffer or per-limb constant vector

cheddar_gpu.eval_mod (heir::cheddar_gpu::EvalModOp)

Homomorphic modular reduction for CKKS bootstrapping

Syntax:

operation ::= `cheddar_gpu.eval_mod` `ins` `(` $in_bx `,` $in_ax `,` $evk_slab `:`
              type($in_bx) `,` type($in_ax) `,` type($evk_slab) `)`
              `outs` `(` $out_bx `,` $out_ax `:` type($out_bx) `,` type($out_ax) `)`
              prop-dict attr-dict

Evaluates modular reduction polynomial on ciphertext (in_bx, in_ax).

The input ciphertext must be at level 21, and this op produces an output ciphertext at level 13. Uses multiplication key slice from evk_slab. Operates in the eval domain.

Attributes:

AttributeMLIR TypeDescription
relin_evk_byte_offset::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative whose value is a multiple of 8
relin_evk_num_q::mlir::IntegerAttr64-bit signless integer attribute whose minimum value is 22
relin_evk_beta::mlir::IntegerAttr64-bit signless integer attribute whose value is positive
params::mlir::heir::cheddar_gpu::ParamsAttrCheddar GPU scheme parameters

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_slabstatically shaped 1D memref of 8-bit integer values

cheddar_gpu.hconj (heir::cheddar_gpu::HConjOp)

Homomorphic complex conjugation

Syntax:

operation ::= `cheddar_gpu.hconj` $out_bx `,` $out_ax `,` $in_bx `,` $in_ax `,`
              `evk_bx` `(` $evk_bx `)` `,` `evk_ax` `(` $evk_ax `)`
              prop-dict attr-dict `:` functional-type(operands, results)

Conjugates ciphertext (in_bx, in_ax) using conjugation evaluation key (evk_bx, evk_ax). Operates in evaluation (eval) domain.

Traits: AttrSizedOperandSegments

Attributes:

AttributeMLIR TypeDescription
level::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_bxvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_axvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.hoist_bs_fused (heir::cheddar_gpu::HoistBSFusedOp)

Fused baby-step key multiplication, accumulation, and Galois automorphism

Syntax:

operation ::= `cheddar_gpu.hoist_bs_fused` `out_bx` `(` $out_bx `)` `,` `out_ax` `(` $out_ax `)` `,` `mod_up` `(` $mod_up `)` `,`
              $evk_slab `,` $in_bx_pseudo_modup prop-dict attr-dict `:` functional-type(operands, results)

Mirrors Cheddar’s BSFusedKernel in Hoist.cu. Computes R rotated baby-step ciphertexts from mod-up digits and EVK slab.

Traits: AttrSizedOperandSegments

Attributes:

AttributeMLIR TypeDescription
galois_factors::mlir::DenseI64ArrayAttri64 dense array attribute
evk_byte_offsets::mlir::DenseI64ArrayAttri64 dense array attribute
evk_num_q::mlir::DenseI64ArrayAttri64 dense array attribute
num_q::mlir::IntegerAttr64-bit signless integer attribute whose value is positive
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative
prime_offset::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
out_bxvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
mod_upvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_slabstatically shaped 1D memref of 8-bit integer values
in_bx_pseudo_modupstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.hoist_gs_fused (heir::cheddar_gpu::HoistGSFusedOp)

Fused giant-step plaintext multiplication and accumulation

Syntax:

operation ::= `cheddar_gpu.hoist_gs_fused` `out_bx` `(` $out_bx `)` `,` `out_ax` `(` $out_ax `)` `,` `in_bx` `(` $in_bx `)` `,`
              `in_ax` `(` $in_ax `)` `,` $consts_slab prop-dict attr-dict
              `:` functional-type(operands, results)

Mirrors Cheddar’s GSFusedKernel in Hoist.cu. Computes G giant-step ciphertexts from B baby-step ciphertexts and plaintext constants slab.

Traits: AttrSizedOperandSegments

Attributes:

AttributeMLIR TypeDescription
pt_word_offsets::mlir::DenseI64ArrayAttri64 dense array attribute where all elements are >= -1
num_q::mlir::IntegerAttr64-bit signless integer attribute whose value is positive
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative
prime_offset::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative
pt_limbs::mlir::IntegerAttr64-bit signless integer attribute

Operands:

OperandDescription
out_bxvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_bxvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_axvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
consts_slabstatically shaped 1D memref of 8-bit integer values

cheddar_gpu.hoist_phase (heir::cheddar_gpu::HoistPhaseOp)

High-level hoisted linear transform phase for CKKS bootstrapping

Syntax:

operation ::= `cheddar_gpu.hoist_phase` `ins` `(` $in_bx `,` $in_ax `,` $consts_slab `,` $evk_slab `:`
              type($in_bx) `,` type($in_ax) `,` type($consts_slab) `,` type($evk_slab) `)`
              `outs` `(` $out_bx `,` $out_ax `:` type($out_bx) `,` type($out_ax) `)`
              prop-dict attr-dict

Represents one phase of CoeffToSlot or SlotToCoeff hoisted BSGS linear transform. Expanded by --cheddar-gpu-expand-hoist into fused BSGS kernels and giant-step reduction.

Attributes:

AttributeMLIR TypeDescription
kind::mlir::heir::cheddar_gpu::HoistPhaseKindAttrHoist phase kind (cts or stc)
phase::mlir::IntegerAttr64-bit signless integer attribute
num_slots::mlir::IntegerAttr64-bit signless integer attribute whose value is a power of two > 0 whose minimum value is 256 whose maximum value is 32768
params::mlir::heir::cheddar_gpu::ParamsAttrCheddar GPU scheme parameters

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
consts_slabstatically shaped 1D memref of 8-bit integer values
evk_slabstatically shaped 1D memref of 8-bit integer values

cheddar_gpu.hrot (heir::cheddar_gpu::HRotOp)

Homomorphic slot rotation

Syntax:

operation ::= `cheddar_gpu.hrot` $out_bx `,` $out_ax `,` $in_bx `,` $in_ax `,`
              `evk_bx` `(` $evk_bx `)` `,` `evk_ax` `(` $evk_ax `)`
              prop-dict attr-dict `:` functional-type(operands, results)

Rotates ciphertext (in_bx, in_ax) by rot_dist (or corresponding galois element) using rotation evaluation key (evk_bx, evk_ax). Operates in evaluation (eval) domain.

Traits: AttrSizedOperandSegments

Attributes:

AttributeMLIR TypeDescription
level::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative
rot_dist::mlir::IntegerAttr64-bit signless integer attribute
galois::mlir::IntegerAttr64-bit signless integer attribute

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_bxvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_axvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.hrot_add (heir::cheddar_gpu::HRotAddOp)

Homomorphic rotation followed by ciphertext addition

Syntax:

operation ::= `cheddar_gpu.hrot_add` $out_bx `,` $out_ax `,` $in1_bx `,` $in1_ax `,` $in2_bx `,` $in2_ax `,`
              `evk_bx` `(` $evk_bx `)` `,` `evk_ax` `(` $evk_ax `)`
              prop-dict attr-dict `:` functional-type(operands, results)

Rotates ciphertext (in1_bx, in1_ax) and adds (in2_bx, in2_ax) into (out_bx, out_ax). Operates in evaluation (eval) domain.

Traits: AttrSizedOperandSegments

Attributes:

AttributeMLIR TypeDescription
level::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative
rot_dist::mlir::IntegerAttr64-bit signless integer attribute
galois::mlir::IntegerAttr64-bit signless integer attribute

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in1_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in1_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in2_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in2_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_bxvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_axvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.intt (heir::cheddar_gpu::INTTOp)

Inverse Number Theoretic Transform (INTT) with optional epilogue

Syntax:

operation ::= `cheddar_gpu.intt` $out `,` $in ( `,` `cst` `(` $cst^ `)` )? prop-dict attr-dict
              `:` functional-type(operands, results)

Mirrors Cheddar’s NTTHandler::INTT and NTTHandler::INTTAndMultConst in NTT.cu. Computes the inverse negacyclic number theoretic transform limb-wise, where the limbs of Q are defined in CheddarGPU_ParamsAttr. in is in eval form.

The epilogue selects what is applied to the transformed result:

  • none: no epilogue (cst must be absent). If montgomery_conversion is set, the result is converted out of Montgomery form; otherwise it stays in Montgomery form. out is in coeff form.
  • mult_const: the result is Montgomery-multiplied limb-wise by the per-limb constant cst. out is in coeff form.
  • mult_const_normalize: as mult_const, then each residue is centered into [-(Q-1)/2, (Q-1)/2]. out is in coeff_centered form.

prime_range ([offset, count]) or prime_indices optionally select which limbs of Q the active limbs are reduced by. If in_split = [split_count, extra_limbs] is set, the first split_count active limbs are read contiguously from in, and the remaining limbs are read after skipping extra_limbs limbs of in.

Traits: CheddarGPU_NTTPrimeCounts, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
montgomery_conversion::mlir::BoolAttrbool attribute
epilogue::mlir::heir::cheddar_gpu::INTTEpilogueAttrINTT epilogue post-processing mode
in_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
prime_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements
prime_indices::mlir::DenseI64ArrayAttri64 dense array attribute
in_split::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements whose value is non-negative

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
cststatically shaped 1D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.key_switch (heir::cheddar_gpu::KeySwitchOp)

KeySwitch with ModDown

Syntax:

operation ::= `cheddar_gpu.key_switch` $out_bx `,` $out_ax `,` $in_bx `,` $in_ax `,`
              `evk_bx` `(` $evk_bx `)` `,` `evk_ax` `(` $evk_ax `)`
              prop-dict attr-dict `:` functional-type(operands, results)

Performs key switching on input ciphertext (in_bx, in_ax) using evaluation key (evk_bx, evk_ax) and produces output ciphertext (out_bx, out_ax) at the same level. Operates in evaluation (eval) domain. level = -1 denotes the special base-level case where ‘out_bx’ has 1 limb.

Traits: AttrSizedOperandSegments

Attributes:

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

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_bxvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_axvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.key_switch_no_mod_down (heir::cheddar_gpu::KeySwitchNoModDownOp)

Key switch without ModDown: ModUp + CPAccum + p_prod addition

Syntax:

operation ::= `cheddar_gpu.key_switch_no_mod_down` $out_bx `,` $out_ax `,` $in `,`
              ( `in_bx` `(` $in_bx^ `)` `,` )?
              ( `in_ax` `(` $in_ax^ `)` `,` )?
              `evk_bx` `(` $evk_bx `)` `,` `evk_ax` `(` $evk_ax `)` prop-dict attr-dict
              `:` functional-type(operands, results)

Computes destination-passing KeySwitch without modulus down: out_bx = sum_k (mod_up(in)_k * evk_bx_k) + (in_bx ? in_bx * p_prod : 0) out_ax = sum_k (mod_up(in)_k * evk_ax_k) + (in_ax ? in_ax * p_prod : 0) Operates in evaluation (eval) domain. level = -1 denotes the special base-level case where ‘out_bx’ has 2 limbs.

Traits: AttrSizedOperandSegments

Attributes:

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

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_bxvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_axvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.mod_down (heir::cheddar_gpu::ModDownOp)

ModDown modulus switching: drops auxiliary primes P

Syntax:

operation ::= `cheddar_gpu.mod_down` operands prop-dict attr-dict `:` functional-type(operands, results)

Mirrors Cheddar’s ModSwitchHandler::ModDown in ModSwitch.cu. Shrinks input in (with num_q + num_aux limbs) down to out (with num_q limbs). Operates in evaluation (eval) domain.

Attributes:

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

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.mod_down_epilogue (heir::cheddar_gpu::ModDownEpilogueOp)

Fused epilogue for ModDown, Rescale, and ModDownAndRescale

Syntax:

operation ::= `cheddar_gpu.mod_down_epilogue` $out `,` $ntt_bconv `,` $inv_prime_prod ( `,` `src2` `(` $src2^ `)` )?
              ( `,` `src2_padding` `(` $src2_padding^ `)` )? prop-dict attr-dict
              `:` functional-type(operands, results)

Mirrors Cheddar’s NTTPhase2ForModDown fused epilogue in NTT.cu. Computes: out[l, i] = ((src2_exists ? (src2[l - pad_start, i] * src2_padding[l - pad_start]) : 0) - ntt_bconv[l, i]) * inv_prime_prod[l] mod Q_l, where Q_l is the l-th limb of Q from CheddarGPU_ParamsAttr. Operates in evaluation (eval) domain.

Traits: AttrSizedOperandSegments, CheddarGPU_PadRangeWithinDest

Attributes:

AttributeMLIR TypeDescription
pad_start::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative
pad_end::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
ntt_bconvstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
inv_prime_prodstatically shaped 1D memref of 32-bit signless integer or 64-bit signless integer values
src2statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
src2_paddingstatically shaped 1D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.mod_down_rescale (heir::cheddar_gpu::ModDownRescaleOp)

Combined ModDown and Rescale modulus switching

Syntax:

operation ::= `cheddar_gpu.mod_down_rescale` operands prop-dict attr-dict `:` functional-type(operands, results)

Mirrors Cheddar’s ModSwitchHandler::ModDownAndRescale in ModSwitch.cu. Shrinks input in (with num_q(level) + num_aux limbs) down to out (at level - 1). Operates in evaluation (eval) domain.

Attributes:

AttributeMLIR TypeDescription
level::mlir::IntegerAttr64-bit signless integer attribute whose value is positive

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.mod_up (heir::cheddar_gpu::ModUpOp)

ModUp basis extension: expands polynomial across beta destination buffers

Syntax:

operation ::= `cheddar_gpu.mod_up` `outs` `(` $outs `)` `,` $in prop-dict attr-dict `:` functional-type(operands, results)

Mirrors Cheddar’s ModSwitchHandler::ModUp in ModSwitch.cu. Expands input in (with num_q limbs) into beta destination buffers outs (each having num_q + num_aux limbs). Operates in evaluation (eval) domain. level = -1 denotes the special base-level case where ‘outs’ has one more limb than ‘in’.

Attributes:

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

Operands:

OperandDescription
outsvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.mod_up_to_max (heir::cheddar_gpu::ModUpToMaxOp)

Broadcast and reduce polynomial limb across primes without centering

Syntax:

operation ::= `cheddar_gpu.mod_up_to_max` operands prop-dict attr-dict `:` functional-type(operands, results)

Mirrors Cheddar’s ModUpToMax1 in ElementWise.cu. Computes dst[l, x] = src[0, x] % Q_l limb-wise, where Q_l is the l-th limb of Q from CheddarGPU_ParamsAttr. Operates in coefficient domain.

Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
prime_offset::mlir::IntegerAttr64-bit signless integer attribute
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.mul (heir::cheddar_gpu::MulOp)

Pointwise Montgomery modular multiplication of two RNS polynomials

Syntax:

operation ::= `cheddar_gpu.mul` $out `,` $lhs `,` $rhs prop-dict attr-dict `:` type($out) (`->` type($result)^)?

Mirrors Cheddar’s kernel::Mult and ElementWiseHandler::Mult in ElementWise.cu. Computes the Montgomery form multiplication of lhs and rhs mod Q.

Form contract:

  • Polynomial multiplication in evaluation domain is pointwise Montgomery multiplication: (a * R) * (b * R) * R^-1 = (a * b) * R mod Q.
  • All operands are in eval form.

Traits: CheddarGPU_NumAuxWithinOut

Interfaces: DestinationStyleOpInterface, MemoryEffectOpInterface

Attributes:

AttributeMLIR TypeDescription
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
outstatically shaped 2D polynomial memref or tensor
lhsstatically shaped 2D polynomial memref or tensor
rhsstatically shaped 2D polynomial memref or tensor

Results:

ResultDescription
resultvariadic of statically shaped 2D tensor of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.mul_const (heir::cheddar_gpu::MulConstOp)

Pointwise Montgomery multiplication by per-limb constants

Syntax:

operation ::= `cheddar_gpu.mul_const` operands prop-dict attr-dict `:` functional-type(operands, results)

Mirrors Cheddar’s ElementWiseHandler::MultConst in ElementWise.cu. Computes the Montgomery form multiplication of in and cst mod Q limb-wise, where the limbs of Q are defined in CheddarGPU_ParamsAttr.

Form contract:

  • in and out are in eval form.

Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
in_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
prime_offset::mlir::IntegerAttr64-bit signless integer attribute
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
cststatically shaped 1D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.mul_imag_unit (heir::cheddar_gpu::MulImaginaryUnitOp)

Pointwise multiplication by imaginary unit in evaluation domain

Syntax:

operation ::= `cheddar_gpu.mul_imag_unit` operands prop-dict attr-dict `:` functional-type(operands, results)

Mirrors Cheddar’s kernel::MultImaginaryUnit in ElementWise.cu. In evaluation domain, multiplying by the imaginary unit corresponds to multiplying first half by psi^(N/2) and second half by -psi^(N/2) = Q - psi^(N/2).

Form contract:

  • in and out are in eval form.

Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
in_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
i_unitstatically shaped 1D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.neg (heir::cheddar_gpu::NegOp)

Pointwise modular negation of a polynomial buffer

Syntax:

operation ::= `cheddar_gpu.neg` $out `,` $in prop-dict attr-dict `:` type($out)

Mirrors Cheddar’s kernel::Neg and ElementWiseHandler::Neg in ElementWise.cu. Computes out = -in mod Q limb-wise, where the limbs of Q are defined in CheddarGPU_ParamsAttr.

Form contract:

  • Valid in both coeff and eval domain.
  • Preserves representation form (in_form == out_form).

Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
in_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
out_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
in_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.neg_2 (heir::cheddar_gpu::Neg2Op)

Pointwise modular negation of two polynomial buffers

Syntax:

operation ::= `cheddar_gpu.neg_2` `ins` `(` $in_bx `,` $in_ax `)`
              `outs` `(` $out_bx `,` $out_ax `)`
              prop-dict attr-dict `:` type($out_bx)

Mirrors Cheddar’s ElementWiseHandler::Neg with two polynomials, which launches kernel::Neg<word, 2> in ElementWise.cu. Computes out_bx = -in_bx mod Q and out_ax = -in_ax mod Q limb-wise, where the limbs of Q are defined in CheddarGPU_ParamsAttr.

Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
in_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
out_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
in_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.ntt (heir::cheddar_gpu::NTTOp)

Forward Number Theoretic Transform (NTT)

Syntax:

operation ::= `cheddar_gpu.ntt` $out `,` $in ( `,` `skip_copy_src` `(` $skip_copy_src^ `)` )? prop-dict attr-dict
              `:` functional-type(operands, results)

Mirrors Cheddar’s NTTHandler::NTT and NTTHandler::NTTForModUp in NTT.cu. Computes the forward negacyclic number theoretic transform limb-wise, where the limbs of Q are defined in CheddarGPU_ParamsAttr. in is in coeff form and out is in eval form.

  • If montgomery_conversion is set, in holds standard residues, which are converted to Montgomery form. Otherwise, in must already be in Montgomery form.
  • prime_range ([offset, count]) or prime_indices optionally select which limbs of Q the active limbs are reduced by.
  • If skip_range = [start, end] is set, limbs [start, end) of out are not transformed. If skip_copy_src is also set, those limbs are instead copied verbatim from skip_copy_src, starting at its limb skip_copy_in_offset.

Traits: CheddarGPU_NTTPrimeCounts, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
montgomery_conversion::mlir::BoolAttrbool attribute
skip_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [start >= 0, end >= start]
in_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
prime_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements
prime_indices::mlir::DenseI64ArrayAttri64 dense array attribute
skip_copy_in_offset::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
skip_copy_srcstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.ntt_mod_down (heir::cheddar_gpu::NTTModDownOp)

Fused Forward NTT and ModDown epilogue

Syntax:

operation ::= `cheddar_gpu.ntt_mod_down` $out `,` $ntt_in `,` $inv_prime_prod ( `,` `src2` `(` $src2^ `)` )?
              ( `,` `src2_padding` `(` $src2_padding^ `)` )? prop-dict attr-dict
              `:` functional-type(operands, results)

Mirrors Cheddar’s NTTPhase2ForModDown in NTT.cu. Computes forward NTT on ntt_in followed by fused ModDown epilogue: out[l, x] = MontMul(ModSub(term1, NTT(ntt_in)[l, x]), inv_prime_prod[l]) mod Q_l where Q_l is the l-th limb of Q from CheddarGPU_ParamsAttr, and term1 = 0 (no src2) | src2[l - pad_start + src2_offset, x] (src2, l in [pad_start, pad_end)) | MontMul(src2[l - pad_start + src2_offset, x], src2_padding[l - pad_start]) (src2_pad, l in [pad_start, pad_end)) and 0 outside [pad_start, pad_end). ntt_in is in coeff form; src2 and out are in eval form.

Traits: AttrSizedOperandSegments, CheddarGPU_PadRangeWithinDest

Attributes:

AttributeMLIR TypeDescription
pad_start::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative
pad_end::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative
src2_offset::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative
prime_offset::mlir::IntegerAttr64-bit signless integer attribute
prime_indices::mlir::DenseI64ArrayAttri64 dense array attribute

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
ntt_instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
inv_prime_prodstatically shaped 1D memref of 32-bit signless integer or 64-bit signless integer values
src2statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
src2_paddingstatically shaped 1D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.permute (heir::cheddar_gpu::PermuteOp)

Galois automorphism permutation in eval form

Syntax:

operation ::= `cheddar_gpu.permute` $out `,` $in prop-dict attr-dict `:` type($out)

Mirrors Cheddar’s kernel::Permute and ElementWiseHandler::Permute in ElementWise.cu to compute a Galois automorphism on a polynomial.

Computes:

e = brev_{logN+1}(x) + 1 src = brev_{logN+1}(e * g - 1)

where g is either the Galois factor (galois attr, 5^k mod 2N) or complex conjugation 2N - 1 (conj unit attr).

Form contract:

  • Requires eval form for ciphertext operands.
  • in-place permutation is not supported.

Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
galois::mlir::IntegerAttr64-bit signless integer attribute
conj::mlir::UnitAttrunit attribute
in_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.permute_2 (heir::cheddar_gpu::Permute2Op)

Galois automorphism permutation for two polynomials

Syntax:

operation ::= `cheddar_gpu.permute_2` `ins` `(` $in_bx `,` $in_ax `)`
              `outs` `(` $out_bx `,` $out_ax `)`
              prop-dict attr-dict `:` type($out_bx)

Same as cheddar_gpu.permute with two polynomials.

Computes eval-form Galois automorphism on both bx and ax simultaneously.

Note in-place permutation is not supported, so all operand buffers must be distinct.

Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
galois::mlir::IntegerAttr64-bit signless integer attribute
conj::mlir::UnitAttrunit attribute
in_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.permute_accum (heir::cheddar_gpu::PermuteAccumOp)

Accumulate multiple Galois automorphism permutations

Syntax:

operation ::= `cheddar_gpu.permute_accum` $out `,` (`acc` `(` $acc^ `)` `,`)? `srcs` `(` $srcs `)` prop-dict attr-dict
              `:` functional-type(operands, results)

Mirrors Cheddar’s kernel::PermuteAccum and kernel::PermuteAccumAdd in ElementWise.cu. Computes out = (acc +) sum_k permute(srcs[k], galois_factors[k]).

Form contract:

  • Requires eval form for all operands.

Traits: AttrSizedOperandSegments, CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
galois_factors::mlir::DenseI64ArrayAttri64 dense array attribute
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
prime_offset::mlir::IntegerAttr64-bit signless integer attribute
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
accstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
srcsvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.permute_accum_2 (heir::cheddar_gpu::PermuteAccum2Op)

Accumulate multiple Galois automorphism permutations for two polynomials

Syntax:

operation ::= `cheddar_gpu.permute_accum_2` $out_bx `,` $out_ax `,` (`acc` `(` $acc_bx^ `,` $acc_ax `)` `,`)?
              `srcs_bx` `(` $srcs_bx `)` `,` `srcs_ax` `(` $srcs_ax `)` prop-dict attr-dict
              `:` functional-type(operands, results)

Mirrors Cheddar’s PermuteAccum for 2 polynomials in ElementWise.cu. Computes {out_bx, out_ax} = ({acc_bx, acc_ax} +) sum_k permute({srcs_bx[k], srcs_ax[k]}, galois_factors[k]).

Traits: AttrSizedOperandSegments, CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
galois_factors::mlir::DenseI64ArrayAttri64 dense array attribute
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
prime_offset::mlir::IntegerAttr64-bit signless integer attribute
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
acc_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
acc_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
srcs_bxvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
srcs_axvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.pseudo_mod_up (heir::cheddar_gpu::PseudoModUpOp)

Scales a polynomial buffer by p_prod = prod(P) mod Q

Syntax:

operation ::= `cheddar_gpu.pseudo_mod_up` operands prop-dict attr-dict `:` functional-type(operands, results)

Mirrors Cheddar’s ModSwitchHandler::PseudoModUp in ModSwitch.cu. Computes out[l][i] = in[l][i] * p_prod[l] mod Q_l limb-wise, where Q_l is the l-th limb of Q from CheddarGPU_ParamsAttr. Operates in evaluation (eval) domain.

Attributes:

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

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.relinearize (heir::cheddar_gpu::RelinearizeOp)

Relinearize degree-2 ciphertext

Syntax:

operation ::= `cheddar_gpu.relinearize` $out_bx `,` $out_ax `,` $in_bx `,` $in_ax `,` $in_rx `,`
              `evk_bx` `(` $evk_bx `)` `,` `evk_ax` `(` $evk_ax `)`
              prop-dict attr-dict `:` functional-type(operands, results)

Relinearizes degree-2 ciphertext (in_bx, in_ax, in_rx) using relinearization key (evk_bx, evk_ax) producing degree-1 ciphertext (out_bx, out_ax) at the same level. Operates in evaluation (eval) domain.

Traits: AttrSizedOperandSegments

Attributes:

AttributeMLIR TypeDescription
level::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_rxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_bxvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_axvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.relinearize_rescale (heir::cheddar_gpu::RelinearizeRescaleOp)

Combined Relinearize and Rescale

Syntax:

operation ::= `cheddar_gpu.relinearize_rescale` $out_bx `,` $out_ax `,` $in_bx `,` $in_ax `,` $in_rx `,`
              `evk_bx` `(` $evk_bx `)` `,` `evk_ax` `(` $evk_ax `)`
              prop-dict attr-dict `:` functional-type(operands, results)

Relinearizes degree-2 ciphertext (in_bx, in_ax, in_rx) at level and rescales down to level - 1. Operates in evaluation (eval) domain.

Traits: AttrSizedOperandSegments

Attributes:

AttributeMLIR TypeDescription
level::mlir::IntegerAttr64-bit signless integer attribute whose value is positive

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
in_rxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_bxvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
evk_axvariadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.rescale (heir::cheddar_gpu::RescaleOp)

Rescale modulus switching: drops terminal/main prime(s) from level to level - 1

Syntax:

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

Mirrors Cheddar’s ModSwitchHandler::Rescale in ModSwitch.cu. Shrinks input in (at level) down to out (at level - 1). Operates in evaluation (eval) domain.

Attributes:

AttributeMLIR TypeDescription
level::mlir::IntegerAttr64-bit signless integer attribute whose value is positive

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.sub (heir::cheddar_gpu::SubOp)

Pointwise modular subtraction of two RNS polynomials

Syntax:

operation ::= `cheddar_gpu.sub` $out `,` $lhs `,` $rhs prop-dict attr-dict `:` type($out) (`->` type($result)^)?

Mirrors Cheddar’s kernel::Sub and ElementWiseHandler::Sub in ElementWise.cu. Computes out = lhs - rhs mod Q limb-wise, where the limbs of Q are defined in CheddarGPU_ParamsAttr.

Form contract:

  • Modular subtraction is valid in both coeff and eval domain.
  • Both operands must have matching form (lhs_form == rhs_form == out_form).

Traits: CheddarGPU_NumAuxWithinOut

Interfaces: DestinationStyleOpInterface, MemoryEffectOpInterface

Attributes:

AttributeMLIR TypeDescription
lhs_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
rhs_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
out_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
outstatically shaped 2D polynomial memref or tensor
lhsstatically shaped 2D polynomial memref or tensor
rhsstatically shaped 2D polynomial memref or tensor

Results:

ResultDescription
resultvariadic of statically shaped 2D tensor of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.sub_2 (heir::cheddar_gpu::Sub2Op)

Pointwise modular subtraction of two pairs of polynomial buffers

Syntax:

operation ::= `cheddar_gpu.sub_2` `ins` `(` $lhs_bx `,` $lhs_ax `,` $rhs_bx `,` $rhs_ax `)`
              `outs` `(` $out_bx `,` $out_ax `)`
              prop-dict attr-dict `:` type($out_bx)

Mirrors Cheddar’s ElementWiseHandler::Sub with two polynomials, which launches kernel::Sub<word, 2> in ElementWise.cu. Computes out_bx = lhs_bx - rhs_bx mod Q and out_ax = lhs_ax - rhs_ax mod Q limb-wise, where the limbs of Q are defined in CheddarGPU_ParamsAttr.

Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
lhs_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
rhs_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
out_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
lhs_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
rhs_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
num_aux::mlir::IntegerAttr64-bit signless integer attribute whose value is non-negative

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
lhs_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
lhs_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
rhs_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
rhs_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.sub_const (heir::cheddar_gpu::SubConstOp)

Pointwise subtraction of per-limb constants from a polynomial buffer

Syntax:

operation ::= `cheddar_gpu.sub_const` operands prop-dict attr-dict `:` functional-type(operands, results)

Mirrors Cheddar’s kernel::SubConst and ElementWiseHandler::SubConst in ElementWise.cu. Computes out[l][i] = in[l][i] - cst[l] mod Q_l, where Q_l is the l-th limb of Q from CheddarGPU_ParamsAttr.

Form contract:

  • Valid in both coeff and eval domain (in_form == out_form).

Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
in_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
out_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
in_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
cststatically shaped 1D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.sub_opposite_const (heir::cheddar_gpu::SubOppositeConstOp)

Pointwise subtraction of polynomial from per-limb constants

Syntax:

operation ::= `cheddar_gpu.sub_opposite_const` operands prop-dict attr-dict `:` functional-type(operands, results)

Mirrors Cheddar’s kernel::SubOppositeConst and ElementWiseHandler::SubOppositeConst in ElementWise.cu. Computes out[l][i] = cst[l] - in[l][i] mod Q_l, where Q_l is the l-th limb of Q from CheddarGPU_ParamsAttr.

Form contract:

  • Valid in both coeff and eval domain (in_form == out_form).

Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
in_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
out_form::mlir::heir::cheddar_gpu::FormAttrCheddar polynomial representation form
in_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
instatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
cststatically shaped 1D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.tensor (heir::cheddar_gpu::TensorOp)

Ciphertext tensor product: (b1b2, b1a2 + a1b2, a1a2)

Syntax:

operation ::= `cheddar_gpu.tensor` `ins` `(` $src1_bx `,` $src1_ax `,` $src2_bx `,` $src2_ax `)`
              `outs` `(` $out_bx `,` $out_ax `,` $out_rx `)`
              prop-dict attr-dict `:` type($out_bx)

Mirrors Cheddar’s kernel::Tensor and ElementWiseHandler::Tensor in ElementWise.cu. Multiplies two degree-1 ciphertexts (b1, a1) and (b2, a2) into a degree-2 ciphertext (b1b2, b1a2 + a1b2, a1a2) using Karatsuba modular multiplication.

Form contract:

  • All operands are in eval form.

Traits: LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_rxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
src1_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
src1_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
src2_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
src2_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.tensor_square (heir::cheddar_gpu::TensorSquareOp)

Ciphertext tensor squaring: (b1^2, 2b1a1, a1^2)

Syntax:

operation ::= `cheddar_gpu.tensor_square` `ins` `(` $src_bx `,` $src_ax `)`
              `outs` `(` $out_bx `,` $out_ax `,` $out_rx `)`
              prop-dict attr-dict `:` type($out_bx)

Mirrors Cheddar’s kernel::TensorSquare in ElementWise.cu. Squares degree-1 ciphertext (b1, a1) into degree-2 ciphertext (b1^2, 2b1a1, a1^2).

Form contract:

  • All operands are in eval form.

Traits: LimbRangesWithin

Attributes:

AttributeMLIR TypeDescription
out_limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0]

Operands:

OperandDescription
out_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
out_rxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
src_bxstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values
src_axstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

cheddar_gpu.zero_pad (heir::cheddar_gpu::ZeroPadOp)

Zero-fill limb range [start, end) of a buffer

Syntax:

operation ::= `cheddar_gpu.zero_pad` operands prop-dict attr-dict `:` functional-type(operands, results)

Zero-fills limbs in [start, end) of the destination buffer.

Attributes:

AttributeMLIR TypeDescription
limb_range::mlir::DenseI64ArrayAttri64 dense array attribute with exactly 2 elements of the form [start >= 0, end >= start]

Operands:

OperandDescription
outstatically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values

CheddarGPU additional definitions

Form

Cheddar polynomial representation form

Cases:

SymbolValueString
Coeff0coeff
CoeffCentered1coeff_centered
Eval2eval

HoistPhaseKind

Hoist phase kind (cts or stc)

Cases:

SymbolValueString
CTS0cts
STC1stc

INTTEpilogue

INTT epilogue post-processing mode

Cases:

SymbolValueString
None0none
MultConst1mult_const
MultConstNormalize2mult_const_normalize