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 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

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.

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 additional definitions

Form

Cheddar polynomial representation form

Cases:

SymbolValueString
Coeff0coeff
CoeffCentered1coeff_centered
Eval2eval

INTTEpilogue

INTT epilogue post-processing mode

Cases:

SymbolValueString
None0none
MultConst1mult_const
MultConstNormalize2mult_const_normalize