Code · architecture · study mode
A custom Torch operator wraps _scaled_mm with E4M3 (4 exponent, 3 mantissa) quantization for the forward pass. Weights…
Full explanation below the code →
A custom Torch operator wraps _scaled_mm with E4M3 (4 exponent, 3 mantissa) quantization for the forward pass. Weights are divided by a learned scale before quantizing — this prevents exponent overflow. The transposed layout (.T.contiguous().T) tricks _scaled_mm into using the column-major path it needs for fast H100 FP8 Tensor Cores.
Why does quantizing to E4M3 (float8) speed up training rather than just reducing memory?