Skip to main content

Module dtype

Module dtype 

Source
Expand description

Runtime element type tag for typed device buffers.

Used by the typed buffer handles (MetalBuf, CpuBuf, CudaBuf) to carry a dtype alongside the raw byte storage. This lets the existing Backend trait surface (which today exposes a monomorphic Self::Buffer and a pile of from_slice_i32 / alloc_u32 / write_u32 / from_slice_f32 etc. helpers) move toward a single Self::alloc(Dtype, n) / Self::write(buf, &[T]) API without breaking callers in one PR.

Phase A (PR A): defined here + Metal MetalBuf re-uses it (was Metal-internal previously). CPU CpuBuf and CUDA CudaBuf not yet wired — see Phase B for the migration.

Enums§

Dtype

Traits§

HostDtype
Marker trait connecting a host element type T to its runtime Dtype tag. Used by the typed Backend allocator + uploader so the trait surface has ONE alloc_typed(Dtype, n) / from_slice_typed<T>(&[T]) / write_typed<T>(buf, &[T]) instead of the per-dtype-named family (alloc_u32, from_slice_i32, write_i32_into, write_f32_into, …).