Expand description
Distribution dispatchers.
Distribution<T> enumerates every supported distribution; the
T parameter (f32 or f64) is enforced through
crate::dtype::RngFloatSupported. FillRequest<T> pairs a
distribution with the GpuRef<T> target and a oneshot reply
channel; it implements RngDispatch so the actor can route any
float dtype through a single mailbox variant.
§Coverage matrix
| distribution | f32 | f64 | path |
|---|---|---|---|
| Uniform | ✓ | ✓ | cudarc::curand::CudaRng::fill_with_uniform |
| Normal | ✓ | ✓ | …fill_with_normal |
| LogNormal | ✓ | ✓ | …fill_with_log_normal |
| Poisson | ✓ | ✓ | u32 fill via curandGeneratePoisson, then host-side widen |
| Exponential | ✓ | ✓ | uniform fill + caller transform (see note) |
| Beta | ✗ | ✗ | needs a custom kernel — returns LibraryError |
| Cauchy | ✗ | ✗ | needs a custom kernel — returns LibraryError |
| Gamma | ✗ | ✗ | needs a custom kernel — returns LibraryError |
| Discrete | ✗ | ✗ | needs curandCreatePoissonDistribution + custom kernel |
cuRAND’s host-API natively exposes only Uniform / Normal /
LogNormal / Poisson; the four “✗” rows depend on either NVRTC-
generated kernels or device-API calls. Phase 1’s job is to
freeze the type-level surface so callers can write code today
that auto-grows when those paths land. Each unsupported variant
returns a clearly-tagged
GpuError::LibraryError { lib: "curand", msg: "<dist> not yet wired (Phase 1: needs custom kernel)" }
so users get one consistent error to match on.
Structs§
- Fill
Request - Single typed fill request:
RngActoraccepts anyBox<FillRequest<T>>throughRngMsg::Fill(_).
Enums§
- Distribution
- Every distribution the cuRAND surface is intended to expose.
Variants that aren’t yet wired to a kernel return a tagged
LibraryErrorfromFillRequest::fill.
Traits§
- Normal
Param - Helper trait so the
enqueue_normal / log_normalpaths can convert the parameter scalar (alwaysT::Scalar) into theTvaluecudarc::curand::result::NormalFill::fillactually accepts. For bothf32andf64, scalar == self, so this is identity.