fhelium.config.ntt
Configuration and compatibility checks for CPU and CUDA NTT backends.
IndexedRadix2Policy
class View source
IndexedRadix2Policy(name: str)Table-driven indexed radix-2 execution on CPU and CUDA.
CPU parallelizes the flattened batch/limb/butterfly space separately for each stage, with a stage barrier preserving transform dependencies. CUDA launches one kernel per stage. The same indexed schedule also provides the cross-device baseline for validating compact CUDA policies.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str |
CompactRadix2Policy
class View source
CompactRadix2Policy(name: str, grouped_radix2_stage_count: Literal[2, 3, 4])Grouped radix-2 execution over canonical compact twiddle rows.
grouped_radix2_stage_count counts radix-2 stages fused into a global kernel. The smem8 backend-name suffix records the current native production implementation, whose shared-memory tile and fusion depth are compiled CUDA resources rather than Python policy parameters.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str | |
grouped_radix2_stage_count | Literal[2, 3, 4] |
group_width
property
group_width: intNumber of coefficients held by one grouped radix-2 tuple.
CompactFixedRadixPolicy
class View source
CompactFixedRadixPolicy(name: str, radix: Literal[4, 8, 16])Strict execution in which every digit has exactly one radix.
Let
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str | |
radix | Literal[4, 8, 16] |
radix_bits
property
radix_bits: Literal[2, 3, 4]Return
NttBackendPolicy
data View source
NttBackendPolicy: TypeAlias = IndexedRadix2Policy | CompactRadix2Policy | CompactFixedRadixPolicyNTT_BACKEND_POLICIES
constant View source
NTT_BACKEND_POLICIES: Final = MappingProxyType({policy.name: policy for policy in _POLICY_SEQUENCE})SUPPORTED_NTT_BACKENDS
constant View source
SUPPORTED_NTT_BACKENDS: Final = tuple(NTT_BACKEND_POLICIES)DEFAULT_NTT_BACKEND
constant View source
DEFAULT_NTT_BACKEND: Final[str] = 'radix2_compact_group8_smem8'DEFAULT_CPU_NTT_BACKEND
constant View source
DEFAULT_CPU_NTT_BACKEND: Final[str] = 'radix2_indexed'resolve_ntt_backend_policy
function View source
def resolve_ntt_backend_policy(name: str) -> NttBackendPolicy: ...Return the exact policy named by configuration.
Names are deliberately not case-normalized and no compatibility aliases are accepted.
validate_ntt_backend_for_log_n
function View source
def validate_ntt_backend_for_log_n(policy: NttBackendPolicy, log_ring_dimension: int) -> None: ...Reject a named policy that cannot factor the requested ring size.
compatible_ntt_backends
function View source
def compatible_ntt_backends(log_ring_dimension: int) -> tuple[str, ...]: ...Return canonical policy names executable for one logN.
Names retain registry order. Strict fixed-radix policies whose digit width does not divide log_ring_dimension are omitted; grouped radix-2 policies remain available for every supported ring dimension. A non-positive dimension raises ValueError.