Repository navigation
Add MXFP8 quantization kernels and OlmoMXFP8Tensor - #709
Merged
Merged
Conversation
AkshitaB
force-pushed
the
akshitab/moe-mxfp8
branch
from
June 6, 2026 00:44
1df30b8 to
d31a2c2
Compare
MXFP8 (OCP microscaling FP8) quantize/dequantize utilities (mxfp8_utils) and the OlmoMXFP8Tensor subclass (mxfp8_tensor), exported from olmo_core.kernels. The quantize/dequantize paths are Triton-backed on GPU, with both Triton and nvtx imports guarded so the module imports cleanly on CPU without either installed. Co-Authored-By: Akshita Bhagia <[email protected]> Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Roundtrip / fallback dispatch, use as a backward gradient object, forward/backward edges, and torch.compile (eager + a CUDA inductor smoke test). The as_scaled_grouped_mm_prequantized_lhs bridge assertions are covered with the scaled_grouped_mm tests, where that module is available. Co-Authored-By: Akshita Bhagia <[email protected]> Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Generic torch ops dequantize the tensor to high precision, silently discarding the MXFP8 representation. Emit a warning so this accidental loss of the FP8 path is visible rather than a silent perf/precision cliff. Co-Authored-By: Tianhua Tao <[email protected]> Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
AkshitaB
force-pushed
the
akshitab/moe-mxfp8
branch
from
June 9, 2026 01:05
d31a2c2 to
04edb37
Compare
The inline skipif(not cuda) lacked the pytest.mark.gpu marker, so the test was deselected on the GPU lane (which runs -m gpu) and skipped on CPU -- meaning it never ran anywhere. requires_gpu adds both the gpu marker and the CUDA skip, matching the rest of the suite. Co-Authored-By: Tianhua Tao <[email protected]> Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The fp8e4nv (e4m3) Triton store generated by the compiled path is not supported below sm89, so the test fails when it lands on an A100 (sm80). Gate it with requires_compute_capability(min_cc=9) so it runs only on Hopper, matching how the attention tests exclude A100s. Co-Authored-By: Tianhua Tao <[email protected]> Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
MXFP8 (OCP microscaling FP8) quantization support:
olmo_core.kernels.mxfp8_utils— Triton-backed quantize/dequantize to block-scaled FP8 (e4m3 data + e8m0 scales).OlmoMXFP8Tensor(olmo_core.kernels.mxfp8_tensor) — atorch.Tensorsubclass holding the quantized data + scales, with high-precision fallback dispatch for generic ops. Exported fromolmo_core.kernelsand marked@beta_feature.Import-safety / testing
Triton is import-guarded and the dtypes used (
float8_e4m3fn,float8_e8m0fnu) are available on the supported torch range, so the module imports on CPU without a GPU.mxfp8_tensor_subclass_test.pycovers the roundtrip / fallback dispatch, gradient-object use, forward/backward edges, and torch.compile (the quant/dequant cases run on CPU; the inductor case is CUDA-gated).