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 carries a required representation form:
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 |
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.
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 additional definitions
Form
Cheddar polynomial representation form
Cases:
| Symbol | Value | String |
|---|---|---|
| Coeff | 0 | coeff |
| CoeffCentered | 1 | coeff_centered |
| Eval | 2 | eval |
INTTEpilogue
INTT epilogue post-processing mode
Cases:
| Symbol | Value | String |
|---|---|---|
| None | 0 | none |
| MultConst | 1 | mult_const |
| MultConstNormalize | 2 | mult_const_normalize |