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
*_formattributes; 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 inevalform is in Montgomery form (x * R mod qwhereR = 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:
| Parameter | C++ type | Description |
|---|---|---|
| value | ::mlir::heir::cheddar_gpu::Form | an enum of type Form |
HoistPhaseKindAttr
Hoist phase kind (cts or stc)
Syntax:
#cheddar_gpu.hoist_phase_kind<
`cts` | `stc` # value
>
Parameters:
| Parameter | C++ type | Description |
|---|---|---|
| value | ::mlir::heir::cheddar_gpu::HoistPhaseKind | an 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:
| Parameter | C++ type | Description |
|---|---|---|
| value | ::mlir::heir::cheddar_gpu::INTTEpilogue | an 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:
| Parameter | C++ type | Description |
|---|---|---|
| word | uint32_t | word size in bits (32 or 64) |
| log_n | uint32_t | log2 of the polynomial degree N = 2^log_n |
| ter | ::mlir::DenseI64ArrayAttr | moduli for terminal primes (ter[0 … num_ter - 1]) |
| main | ::mlir::DenseI64ArrayAttr | moduli for main primes (main[0 … num_main - 1]) |
| aux | ::mlir::DenseI64ArrayAttr | moduli for auxiliary primes (aux[0 … num_aux - 1]) |
| level_config | ::mlir::ArrayAttr | list of [m, t] pairs specifying level modulus configuration |
| alpha | uint32_t | number of auxiliary primes per digit in key-switching |
| dnum | uint32_t | number 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
coeffandevaldomain. - Both operands must have matching form (
lhs_form == rhs_form == out_form).
Traits: CheddarGPU_NumAuxWithinOut
Interfaces: DestinationStyleOpInterface, MemoryEffectOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
lhs_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
rhs_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
out_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D polynomial memref or tensor |
lhs | statically shaped 2D polynomial memref or tensor |
rhs | statically shaped 2D polynomial memref or tensor |
Results:
| Result | Description |
|---|---|
result | variadic 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:
| Attribute | MLIR Type | Description |
|---|---|---|
lhs_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
rhs_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
out_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
lhs_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
rhs_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
lhs_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
lhs_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
rhs_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
rhs_ax | statically 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
coeffandevaldomain (in_form == out_form).
Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
in_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
out_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
in_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
cst | statically 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 withmult_const_normalizeepilogue. - Output form is
coeff. tableis a memref of shape<DxSxiW>, whereDis the number of computed destination limbs (dst_len) andSis the number of active source limbs (src_len).skip_range = [skip_start, skip_end], when specified, causes destination limbsmin[0, dst_len)to map to limb index(m < skip_start) ? m : m + (skip_end - skip_start)in the destination buffer.in_limb_rangeandout_limb_rangeare optional[offset, count]ranges for slicing larger buffers.
Traits: LimbRangesWithin
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
skip_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [start >= 0, end >= start] |
in_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
dst_primes | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
table | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
num_slots | ::mlir::IntegerAttr | 64-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::ParamsAttr | Cheddar GPU scheme parameters |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 64-bit signless integer values |
out_ax | statically shaped 2D memref of 64-bit signless integer values |
in_bx | statically shaped 2D memref of 64-bit signless integer values |
in_ax | statically shaped 2D memref of 64-bit signless integer values |
consts_slab | statically shaped 1D memref of 8-bit integer values |
evk_slab | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
in_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically 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
evalform for all operands.
Traits: AttrSizedOperandSegments, CheddarGPU_NumAuxWithinOut, LimbRangesWithin
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
prime_offset | ::mlir::IntegerAttr | 64-bit signless integer attribute |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
ct_srcs | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
common_srcs | variadic 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:
| Attribute | MLIR Type | Description |
|---|---|---|
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
prime_offset | ::mlir::IntegerAttr | 64-bit signless integer attribute |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
ct_bx_srcs | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
ct_ax_srcs | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
common_srcs | variadic 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
evalform for all operands.
Traits: AttrSizedOperandSegments, CheddarGPU_NumAuxWithinOut, LimbRangesWithin
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
prime_offset | ::mlir::IntegerAttr | 64-bit signless integer attribute |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
acc | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
ct_srcs | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
common_srcs | variadic 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:
| Attribute | MLIR Type | Description |
|---|---|---|
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
prime_offset | ::mlir::IntegerAttr | 64-bit signless integer attribute |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
acc_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
acc_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
ct_bx_srcs | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
ct_ax_srcs | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
common_srcs | variadic 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:
| Attribute | MLIR Type | Description |
|---|---|---|
relin_evk_byte_offset | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative whose value is a multiple of 8 |
relin_evk_num_q | ::mlir::IntegerAttr | 64-bit signless integer attribute whose minimum value is 22 |
relin_evk_beta | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is positive |
params | ::mlir::heir::cheddar_gpu::ParamsAttr | Cheddar GPU scheme parameters |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_slab | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
level | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_bx | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_ax | variadic 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:
| Attribute | MLIR Type | Description |
|---|---|---|
galois_factors | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
evk_byte_offsets | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
evk_num_q | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
num_q | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is positive |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
prime_offset | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out_bx | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
mod_up | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_slab | statically shaped 1D memref of 8-bit integer values |
in_bx_pseudo_modup | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
pt_word_offsets | ::mlir::DenseI64ArrayAttr | i64 dense array attribute where all elements are >= -1 |
num_q | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is positive |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
prime_offset | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
pt_limbs | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
out_bx | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_bx | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_ax | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
consts_slab | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
kind | ::mlir::heir::cheddar_gpu::HoistPhaseKindAttr | Hoist phase kind (cts or stc) |
phase | ::mlir::IntegerAttr | 64-bit signless integer attribute |
num_slots | ::mlir::IntegerAttr | 64-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::ParamsAttr | Cheddar GPU scheme parameters |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
consts_slab | statically shaped 1D memref of 8-bit integer values |
evk_slab | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
level | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
rot_dist | ::mlir::IntegerAttr | 64-bit signless integer attribute |
galois | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_bx | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_ax | variadic 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:
| Attribute | MLIR Type | Description |
|---|---|---|
level | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
rot_dist | ::mlir::IntegerAttr | 64-bit signless integer attribute |
galois | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in1_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in1_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in2_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in2_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_bx | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_ax | variadic 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 (cstmust be absent). Ifmontgomery_conversionis set, the result is converted out of Montgomery form; otherwise it stays in Montgomery form.outis incoeffform.mult_const: the result is Montgomery-multiplied limb-wise by the per-limb constantcst.outis incoeffform.mult_const_normalize: asmult_const, then each residue is centered into[-(Q-1)/2, (Q-1)/2].outis incoeff_centeredform.
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:
| Attribute | MLIR Type | Description |
|---|---|---|
montgomery_conversion | ::mlir::BoolAttr | bool attribute |
epilogue | ::mlir::heir::cheddar_gpu::INTTEpilogueAttr | INTT epilogue post-processing mode |
in_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
prime_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements |
prime_indices | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
in_split | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
cst | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
level | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_bx | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_ax | variadic 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:
| Attribute | MLIR Type | Description |
|---|---|---|
level | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_bx | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_ax | variadic 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:
| Attribute | MLIR Type | Description |
|---|---|---|
level | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
pad_start | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
pad_end | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
ntt_bconv | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
inv_prime_prod | statically shaped 1D memref of 32-bit signless integer or 64-bit signless integer values |
src2 | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
src2_padding | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
level | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is positive |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
level | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
outs | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
prime_offset | ::mlir::IntegerAttr | 64-bit signless integer attribute |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically 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
evalform.
Traits: CheddarGPU_NumAuxWithinOut
Interfaces: DestinationStyleOpInterface, MemoryEffectOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D polynomial memref or tensor |
lhs | statically shaped 2D polynomial memref or tensor |
rhs | statically shaped 2D polynomial memref or tensor |
Results:
| Result | Description |
|---|---|
result | variadic 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:
inandoutare inevalform.
Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
in_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
prime_offset | ::mlir::IntegerAttr | 64-bit signless integer attribute |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
cst | statically 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:
inandoutare inevalform.
Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
in_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
i_unit | statically 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
coeffandevaldomain. - Preserves representation form (
in_form == out_form).
Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
in_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
out_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
in_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
in_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
out_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
in_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_ax | statically 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_conversionis set,inholds standard residues, which are converted to Montgomery form. Otherwise,inmust already be in Montgomery form. prime_range([offset, count]) orprime_indicesoptionally select which limbs ofQthe active limbs are reduced by.- If
skip_range = [start, end]is set, limbs[start, end)ofoutare not transformed. Ifskip_copy_srcis also set, those limbs are instead copied verbatim fromskip_copy_src, starting at its limbskip_copy_in_offset.
Traits: CheddarGPU_NTTPrimeCounts, LimbRangesWithin
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
montgomery_conversion | ::mlir::BoolAttr | bool attribute |
skip_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [start >= 0, end >= start] |
in_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
prime_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements |
prime_indices | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
skip_copy_in_offset | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
skip_copy_src | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
pad_start | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
pad_end | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
src2_offset | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
prime_offset | ::mlir::IntegerAttr | 64-bit signless integer attribute |
prime_indices | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
ntt_in | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
inv_prime_prod | statically shaped 1D memref of 32-bit signless integer or 64-bit signless integer values |
src2 | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
src2_padding | statically 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
evalform for ciphertext operands. - in-place permutation is not supported.
Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
galois | ::mlir::IntegerAttr | 64-bit signless integer attribute |
conj | ::mlir::UnitAttr | unit attribute |
in_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
galois | ::mlir::IntegerAttr | 64-bit signless integer attribute |
conj | ::mlir::UnitAttr | unit attribute |
in_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_ax | statically 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
evalform for all operands.
Traits: AttrSizedOperandSegments, CheddarGPU_NumAuxWithinOut, LimbRangesWithin
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
galois_factors | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
prime_offset | ::mlir::IntegerAttr | 64-bit signless integer attribute |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
acc | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
srcs | variadic 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:
| Attribute | MLIR Type | Description |
|---|---|---|
galois_factors | ::mlir::DenseI64ArrayAttr | i64 dense array attribute |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
prime_offset | ::mlir::IntegerAttr | 64-bit signless integer attribute |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
acc_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
acc_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
srcs_bx | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
srcs_ax | variadic 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:
| Attribute | MLIR Type | Description |
|---|---|---|
level | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
level | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_rx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_bx | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_ax | variadic 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:
| Attribute | MLIR Type | Description |
|---|---|---|
level | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is positive |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in_rx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_bx | variadic of statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
evk_ax | variadic 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:
| Attribute | MLIR Type | Description |
|---|---|---|
level | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is positive |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically 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
coeffandevaldomain. - Both operands must have matching form (
lhs_form == rhs_form == out_form).
Traits: CheddarGPU_NumAuxWithinOut
Interfaces: DestinationStyleOpInterface, MemoryEffectOpInterface
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
lhs_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
rhs_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
out_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D polynomial memref or tensor |
lhs | statically shaped 2D polynomial memref or tensor |
rhs | statically shaped 2D polynomial memref or tensor |
Results:
| Result | Description |
|---|---|
result | variadic 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:
| Attribute | MLIR Type | Description |
|---|---|---|
lhs_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
rhs_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
out_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
lhs_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
rhs_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
num_aux | ::mlir::IntegerAttr | 64-bit signless integer attribute whose value is non-negative |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
lhs_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
lhs_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
rhs_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
rhs_ax | statically 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
coeffandevaldomain (in_form == out_form).
Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
in_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
out_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
in_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
cst | statically 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
coeffandevaldomain (in_form == out_form).
Traits: CheddarGPU_NumAuxWithinOut, LimbRangesWithin
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
in_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
out_form | ::mlir::heir::cheddar_gpu::FormAttr | Cheddar polynomial representation form |
in_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
in | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
cst | statically 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
evalform.
Traits: LimbRangesWithin
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_rx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
src1_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
src1_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
src2_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
src2_ax | statically 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
evalform.
Traits: LimbRangesWithin
Attributes:
| Attribute | MLIR Type | Description |
|---|---|---|
out_limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [offset >= 0, count > 0] |
Operands:
| Operand | Description |
|---|---|
out_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_ax | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
out_rx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
src_bx | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
src_ax | statically 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:
| Attribute | MLIR Type | Description |
|---|---|---|
limb_range | ::mlir::DenseI64ArrayAttr | i64 dense array attribute with exactly 2 elements of the form [start >= 0, end >= start] |
Operands:
| Operand | Description |
|---|---|
out | statically shaped 2D memref of 32-bit signless integer or 64-bit signless integer values |
CheddarGPU additional definitions
Form
Cheddar polynomial representation form
Cases:
| Symbol | Value | String |
|---|---|---|
| Coeff | 0 | coeff |
| CoeffCentered | 1 | coeff_centered |
| Eval | 2 | eval |
HoistPhaseKind
Hoist phase kind (cts or stc)
Cases:
| Symbol | Value | String |
|---|---|---|
| CTS | 0 | cts |
| STC | 1 | stc |
INTTEpilogue
INTT epilogue post-processing mode
Cases:
| Symbol | Value | String |
|---|---|---|
| None | 0 | none |
| MultConst | 1 | mult_const |
| MultConstNormalize | 2 | mult_const_normalize |