pub struct Element {
pub dtype: DType,
pub subtype: ElementSubtype,
pub saturating: bool,
}Expand description
Per-element semantics that don’t fit into a flat DType enum
(plan #40). Mirrors MAX’s layout/element.mojo Element type:
DType says “f8”, but two FP8 variants exist (e4m3 and e5m2)
with different range/precision tradeoffs. Saturation policy
(clamp on overflow vs. wrap) is similarly orthogonal.
Today most ops only care about dtype; downstream quantization
kernels read subtype and saturating to pick the right
dequant. Building this in early prevents the “every op grew its
own ad-hoc fp8 flag” mess MAX hit in v1.
Fields§
§dtype: DType§subtype: ElementSubtypeSubtype within dtype for FP8 variants etc. Standard
for everything else.
saturating: boolWhether arithmetic saturates on overflow (true for the quantized accumulator paths) or wraps (default).
Implementations§
Trait Implementations§
impl Copy for Element
impl Eq for Element
impl StructuralPartialEq for Element
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnsafeUnpin for Element
impl UnwindSafe for Element
Blanket Implementations§
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
Mutably borrows from an owned value. Read more