pub enum ScaleLayout {
PerTensor,
BlockMxE8M0 {
block: u32,
},
Nvfp4 {
group: u32,
},
}Expand description
How scale factors are laid out for an crate::op::Op::ScaledMatMul
operand. The reconstructed value of element i is
decode(code[i]) * scale(block_of(i)).
Variants§
PerTensor
One f32 amax scale for the whole operand (classic per-tensor FP8 GEMM).
BlockMxE8M0
OCP microscaling: one power-of-two E8M0 scale per block
consecutive elements along K (MXFP8 / MXFP6 / MXFP4). Scale tensor
is DType::U8 (E8M0 bytes).
Nvfp4
NVFP4: one FP8 E4M3 scale per group (16) elements along K, plus
an optional per-tensor f32 global. Scale tensor is DType::U8.
Implementations§
Source§impl ScaleLayout
impl ScaleLayout
Sourcepub const fn scale_dtype(self) -> DType
pub const fn scale_dtype(self) -> DType
Element dtype of the scale tensor for this layout.
Sourcepub const fn block(self) -> u32
pub const fn block(self) -> u32
Number of consecutive elements sharing one scale (1 for per-tensor).
Sourcepub const fn mode_block(self) -> (u32, u32)
pub const fn mode_block(self) -> (u32, u32)
(scale_mode, block) for GPU kernels (scaled_lowp_general.cu):
per-tensor=0, block-E8M0=1, NVFP4-E4M3=2.
Trait Implementations§
Source§impl Clone for ScaleLayout
impl Clone for ScaleLayout
Source§fn clone(&self) -> ScaleLayout
fn clone(&self) -> ScaleLayout
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ScaleLayout
Source§impl Debug for ScaleLayout
impl Debug for ScaleLayout
Source§impl Display for ScaleLayout
impl Display for ScaleLayout
impl Eq for ScaleLayout
Source§impl FromStr for ScaleLayout
impl FromStr for ScaleLayout
Source§impl Hash for ScaleLayout
impl Hash for ScaleLayout
Source§impl PartialEq for ScaleLayout
impl PartialEq for ScaleLayout
Source§fn eq(&self, other: &ScaleLayout) -> bool
fn eq(&self, other: &ScaleLayout) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ScaleLayout
Auto Trait Implementations§
impl Freeze for ScaleLayout
impl RefUnwindSafe for ScaleLayout
impl Send for ScaleLayout
impl Sync for ScaleLayout
impl Unpin for ScaleLayout
impl UnsafeUnpin for ScaleLayout
impl UnwindSafe for ScaleLayout
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