pub trait KernelDtype:
DeviceRepr
+ Sealed
+ Copy
+ 'static {
const KIND: ElementKind;
}Expand description
Umbrella marker trait for every dtype usable as a kernel input or output.
The bound captures the three minimum properties a kernel dtype
needs: a fixed memory layout (DeviceRepr) so the host can ship
bytes to the device verbatim, Copy + 'static so the type can
flow through plan / args structs without an &mut self, and a
runtime tag (ElementKind) for dispatch.
KernelDtype is wider than Element: it covers the
sub-byte / FP8 / packed-bit newtypes (S4, U4, S8, U8,
Fp8E4M3, Fp8E5M2, Bin) that have their own kernel families
and don’t fit the <T: Element> plan shape. Every Element,
IntElement, FpElement, and BinElement type also
implements KernelDtype (the sibling traits all use it as a
supertrait), so a function bounded by <T: KernelDtype> accepts
any kernel-usable type.
Sealed because adding a new dtype requires a matching kernel
instantiation in baracuda-kernels-sys.
§When to use
Prefer Element when you’re parameterizing a plan that lives in
the elementwise / reduce / scan / norm / loss families — those
plan shapes are written against <T: Element> and use the
type Scalar projection. Reach for KernelDtype only when you
genuinely want the union of every kernel dtype (sub-byte +
FP8 + packed-bit included) — e.g. a generic dtype-size helper,
telemetry function, or downstream wrapper.
Required Associated Constants§
Sourceconst KIND: ElementKind
const KIND: ElementKind
Runtime tag for this dtype. Stable across the workspace —
keyed by this same enum in crate::KernelSku::element.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".