pub enum DType {
Show 18 variants
U8,
I8,
U32,
I16,
I32,
I64,
BF16,
F16,
F32,
F64,
F8E4M3,
F8E5M2,
F6E2M3,
F6E3M2,
F4,
F8E8M0,
F8E6M2,
Bool,
}Expand description
The different types of elements allowed in tensors.
Variants§
U8
Unsigned 8-bit integer.
I8
Signed 8-bit integer. Added 2026-05-19 for int8 GEMM (W8A8
inference) support — baracuda’s gemm_s8_* family accepts
i8 operands and mma.sync .s8.s8.s32 instructions.
U32
Unsigned 32-bit integer.
I16
Signed 16-bit integer.
I32
Signed 32-bit integer.
I64
Signed 64-bit integer.
BF16
Brain floating-point using half precision (16 bits).
F16
Floating-point using half precision (16 bits).
F32
Floating-point using single precision (32 bits).
F64
Floating-point using double precision (64 bits).
F8E4M3
8-bit floating point, 4-bit exponent + 3-bit mantissa — specifically
OCP finite E4M3FN: bias 7, max-finite ±448, no infinities, single
NaN. This is the only E4M3 format Fuel represents, so the bare name is
unambiguous today (enforced by
reserved_token_tests::exactly_one_e4m3_family_dtype_or_revisit_gap_169).
The identity F8E4M3 == OCP E4M3FN is committed and tested at three
independent sites: the structure-key path (fuel-dispatch
telemetry::baracuda_provider::map_element_kind), the JIT seam
(fuel-dispatch jit_adopt::fp8_maps_to_baracuda_ocp_element_kinds),
and the external-contract parser (fuel-dispatch fkc::lower’s
“F8E4M3FNUZ must not lower to F8E4M3” prefix rejection).
The name is deliberately NOT F8E4M3FN (GAP-169). A rename would
touch ~110 sites across every backend, cascade through the
cuda_dtype! / ctor! macros into CudaStorageSlice / PinnedBuffer,
and break 3 fuel-metal-backend sites that cannot be compiled on the
primary dev box — all for reader clarity only. The interop token is
already f8e4m3fn on the sk4 path (token_kind), and this dtype’s own
token stays f8e4m3 for the checked-in .fkc.md contracts that author
it (see the RESERVED_DTYPE_TOKENS note below). Revisit only when a
second E4M3-family variant (e.g. F8E4M3FNUZ) actually lands — the
witness above fires then.
F8E5M2
8-bit floating point with 5-bit exponent and 2-bit mantissa — the OCP-standard FP8 pair’s other half.
E4M3 (above) carries more mantissa and is the forward-pass format;
E5M2 trades mantissa for exponent range and is the gradient format.
Shipping one without the other leaves FP8 training unrepresentable,
and fuel-cuda-backend’s cast table already documents six baracuda
cast pairs it skips for want of this variant. Distinct from
F8E6M2, which is a non-OCP block-scale type.
F6E2M3
6-bit float with 2 exponent bits and 3 mantissa bits (MX6 format).
F6E3M2
6-bit float with 3 exponent bits and 2 mantissa bits (MX6 format).
F4
4-bit float (MX4 format).
F8E8M0
8-bit float with 8 exponent bits and 0 mantissa bits.
F8E6M2
Unsigned 8-bit block-scale: 6 exponent bits, 2 mantissa bits, no sign
(0+6+2=8). A finer-granularity sibling of F8E8M0 —
trades 2 exponent bits for 2 mantissa — so a scale type, not a signed
value dtype. (The “8-bit float, 6 exp, 2 mant” framing it shipped with in
e275538c was a misread: 1+6+2=9 doesn’t fit a signed byte.)
Bool
Boolean truth value, one byte per element (0 = false, 1 = true).
The output dtype of the element-wise comparisons
(eq/ne/lt/le/gt/ge) — GAP-168(c) / CireSnave’s 2026-08-12
ruling that Fuel “uses Bool where possible and casts to U8 when
necessary”. Storage width equals u8 (KISS-CLASSIFY bool: “1-byte
truth value; storage width equals u8”), so a backend may store it in
a U8 buffer — but it is a DISTINCT logical dtype: neither an integer
nor a floating-point value (is_int and is_float are both false),
so using a mask AS A NUMBER (multiply/sum/accumulate) is rejected at
build time and extracting a number requires an explicit .cast(U8).
Implementations§
Source§impl DType
impl DType
Sourcepub const ALL: &'static [DType]
pub const ALL: &'static [DType]
Every DType variant, in declaration order.
Completeness is REMINDED, not compiler-derived (GAP-248). _all_variants_witness
below is a wildcard-free match, so adding a DType fails to compile THERE — a
variant cannot be added without being dragged to this file. But extending THIS
list in the same edit is then convention: nothing ties ALL to the witness, so a
variant added to the match yet forgotten here would still compile. A hand-written
const (not a derived iterator) because the anchor is a compile-time tripwire —
the residual gap is that it reminds rather than derives. Measured complete at head
(ALL = witness = enum = 18). The enforced version is a single-source macro
declaring the enum and ALL together; see GAP-248.
Trait Implementations§
impl Copy for DType
Source§impl<'de> Deserialize<'de> for DType
impl<'de> Deserialize<'de> for DType
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<DType, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<DType, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for DType
Source§impl Serialize for DType
impl Serialize for DType
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for DType
Auto Trait Implementations§
impl Freeze for DType
impl RefUnwindSafe for DType
impl Send for DType
impl Sync for DType
impl Unpin for DType
impl UnsafeUnpin for DType
impl UnwindSafe for DType
Blanket Implementations§
impl<T> Boilerplate for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more