Skip to content

Wire MoE and MXFP8Linear training paths to CuTeDSL by default - #4705

Open
alexsamardzic wants to merge 1 commit into
gh/alexsamardzic/13/headfrom
gh/alexsamardzic/14/head
Open

Wire MoE and MXFP8Linear training paths to CuTeDSL by default#4705
alexsamardzic wants to merge 1 commit into
gh/alexsamardzic/13/headfrom
gh/alexsamardzic/14/head

Conversation

@alexsamardzic

@alexsamardzic alexsamardzic commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

(Replaces #4620 due to incorrect ghstack base branch targeting.)

This PR wires the MXFP8 MoE grouped-mm and MXFP8Linear training paths to use the CuTeDSL backend by default, while keeping the legacy CUDA/Triton backend selectable for validation and benchmarking. It adds end-to-end correctness tests for grouped-mm, padded grouped-mm, prequantized MXTensor grouped-mm, and MXFP8Linear fwd/bwd, plus benchmark support for comparing CuTeDSL against the legacy backend. This prepares the next PR to delete torchao._C_mxfp8 and the now-obsolete legacy CUDA/Triton paths.


To run tests:

pytest -q \
    test/prototype/moe_training/test_mxfp8_grouped_mm.py::test_mxfp8_grouped_gemm_backend_fwd_bwd \
    test/prototype/moe_training/test_mxfp8_grouped_mm.py::test_mxfp8_grouped_gemm_padded_backend_fwd_bwd \
    test/prototype/moe_training/test_mxfp8_grouped_mm.py::test_mxfp8_grouped_gemm_mxtensor_backend_forward \
    test/prototype/moe_training/test_mxfp8_grouped_mm.py::test_mxfp8_grouped_gemm_with_dq_fwd_bwd \
    test/prototype/moe_training/test_mxfp8_linear.py::test_mxfp8_linear_fwd_bwd_sqnr

To run MoE grouped-mm fwd/bwd recipe benchmark:

python benchmarks/prototype/moe_training/mxfp8/roofline_unified.py \
    --backend=both --K=4096 --N=4096 --G=8 --breakdown_M=16384 \
    --outfile_speedup=roofline_speedup_K4096_N4096.csv \
    --outfile_quant_2d=roofline_quant_2d_K4096_N4096.csv \
    --outfile_quant_3d=roofline_quant_3d_K4096_N4096.csv \
    --plot_file=roofline_K4096_N4096.png

Results of benchmark above:
roofline_K4096_N4096


To run MXFP8Linear fwd/bwd recipe benchmark:

python scripts/validate_mxfp8_linear_cutedsl.py \
    --M 4096 --N 4096 --K 2048 \
    --cuda-graph-bench --graph-iters 100

Would be good to run on multi-GPU machine:

torchrun --nproc-per-node=2 --local-ranks-filter=0 \
    benchmarks/prototype/moe_training/mxfp8/bench_ep_pipeline.py --backend=legacy

torchrun --nproc-per-node=2 --local-ranks-filter=0 \
    benchmarks/prototype/moe_training/mxfp8/bench_ep_pipeline.py --backend=cutedsl

[ghstack-poisoned]
@alexsamardzic

alexsamardzic commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator Author

@pytorch-bot

pytorch-bot Bot commented Aug 5, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4705

Note: Links to docs will display an error until the docs builds have been completed.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 2 New Failures, 1 Unrelated Failure

As of commit da0c29d with merge base 33ba9f7 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following job failed but were present on the merge base:

👉 Rebase onto the `viable/strict` branch to avoid these failures

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 5, 2026
@alexsamardzic alexsamardzic added the module: training quantize_ api training flow label Aug 5, 2026
@alexsamardzic
alexsamardzic changed the base branch from gh/alexsamardzic/13/head to main August 5, 2026 19:07
@alexsamardzic
alexsamardzic changed the base branch from main to gh/alexsamardzic/13/head August 6, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: training quantize_ api training flow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant