Skip to content

Add MXFP8 quantization kernels and OlmoMXFP8Tensor - #709

Merged
AkshitaB merged 7 commits into
akshitab/moe-v2-corefrom
akshitab/moe-mxfp8
Jun 9, 2026
Merged

AkshitaB merged 7 commits into
akshitab/moe-v2-corefrom
akshitab/moe-mxfp8

Conversation

@AkshitaB

@AkshitaB AkshitaB commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

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) — a torch.Tensor subclass holding the quantized data + scales, with high-precision fallback dispatch for generic ops. Exported from olmo_core.kernels and 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.py covers 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).

Base automatically changed from akshitab/moe-grouped-mm to akshitab/moe-v2-core June 6, 2026 00:42
@AkshitaB
AkshitaB force-pushed the akshitab/moe-mxfp8 branch from 1df30b8 to d31a2c2 Compare June 6, 2026 00:44
TianhuaTao and others added 4 commits June 8, 2026 18:02
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
AkshitaB force-pushed the akshitab/moe-mxfp8 branch from d31a2c2 to 04edb37 Compare June 9, 2026 01:05
@AkshitaB AkshitaB closed this Jun 9, 2026
@AkshitaB AkshitaB reopened this Jun 9, 2026
AkshitaB and others added 3 commits June 8, 2026 22:16
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]>
@AkshitaB
AkshitaB marked this pull request as ready for review June 9, 2026 05:43
@AkshitaB
AkshitaB merged commit 2513fec into akshitab/moe-v2-core Jun 9, 2026
24 checks passed
@AkshitaB
AkshitaB deleted the akshitab/moe-mxfp8 branch June 9, 2026 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants