Expand description
FftActor — wraps [cudarc::cufft::CudaFft] with an LRU cache of
plans keyed by shape + transform kind + dtype + batch.
cuFFT’s plan creation can take milliseconds; the cache amortizes that across many transforms of the same shape.
§Phase 1 surface
Phase 1 of the cuFFT slice expands the actor from the F2 sketch (1D R2C/C2R/C2C f32 + 2D R2C f32) to:
- full 1D / 2D / 3D transform ranks,
- f32 (R2C / C2R / C2C) and f64 (D2Z / Z2D / Z2Z),
- a true
cufftPlanMany-style batched plan builder (FftPlanMany) — arbitrary(rank, dims, in_embed, in_stride, in_dist, out_embed, out_stride, out_dist, batch), - an optional callback hook (
FftCallbackKind) plumbed throughcufftXtSetCallback(defined incrate::sys::cufft). PTX/cubin provisioning of the device-side callback is deferred to the caller; this layer just stores/forwards the function pointer.
§Message API: Option C hybrid
Per Phase 0.2 the canonical typed API runs through
[FftMsg::Exec(Box<dyn FftDispatch>)]. Each typed
FftRequest<T> carries the dtype-aware GpuRef<T> payload and
erases at the enum boundary, so FftActor::Msg stays a single
non-generic enum (one mailbox per actor) while the public surface
is dtype-typed.
The legacy F2 variants (Forward1dR2C, Inverse1dC2R,
Exec1dC2C, Forward2dR2C) are kept under #[deprecated] aliases
so existing examples / external callers compile.
Inverse normalization: cuFFT does NOT normalize inverse transforms by 1/N — caller’s responsibility (typically folded into a downstream kernel).
Structs§
- FftActor
- FftPlan
- Opaque handle to a cuFFT plan (already materialized through the
LRU cache). Callers obtain one via
FftActor::ensure_planor by caching thePlanKeyreturned fromFftPlanMany::key. - FftPlan
Many - Builder for advanced batched plans. Mirrors
cufftPlanMany’s argument list: arbitraryrank(1, 2, or 3), per-dim sizes, optional in/out embed dims with strides and per-batch distances. - FftRequest
- Typed cuFFT request — the canonical Phase-1 entry point.
- PlanKey
- Plan-cache key. Captures everything cuFFT cares about for both
the simple
cufftPlan{1,2,3}dconstructors and the advancedcufftPlanManybuilder.dims[i] == 0fori >= rank(unused dimensions are zeroed for hashability).
Enums§
- FftCallback
Kind - Optional callback hook attached to a plan. cuFFT’s load callback
is invoked while reading inputs; the store callback is invoked
while writing outputs. The
kindfield tells cuFFT which signal the device-resident callback expects. - FftDirection
- Direction of a complex transform. Mirrors cudarc’s
[
cudarc::cufft::FftDirection] but lives in our module so callers canuse atomr_accel_cuda::FftDirection. - FftKind
- Transform kind. Covers the six cuFFT type codes the v0.19 cudarc safe surface exposes.
- FftMsg