Repository navigation
Add CuTeDSL MXFP8 M-groups scale rearrange kernel - #4701
alexsamardzic wants to merge 6 commits into
Conversation
|
Stack from ghstack (oldest at bottom): |
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4701
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 Cancelled JobsAs of commit a2acc22 with merge base 9d0c494 ( CANCELLED JOBS - The following jobs were cancelled. Please retry:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| @@ -0,0 +1,201 @@ | |||
| # Copyright (c) Meta Platforms, Inc. and affiliates. | |||
There was a problem hiding this comment.
can we split the logic here to test and benchmarks
|
@claude review |
|
Claude finished @vkuzo's task in 1m 47s —— View job Code Review
Overall this is a well-structured CuTeDSL port with solid benchmarking evidence — the kernel is on par with or faster than the CUDA baseline across a wide sweep, and the correctness handling of the partial-column / non-16-multiple paths is careful. A few points below. Re: @vkuzo's comment — split
|
| (1024, 1025, 8), | ||
| ], | ||
| ) | ||
| def test_cutedsl_mx_block_rearrange_2d_M_groups( |
There was a problem hiding this comment.
is there a test we can extend instead of building a new one?
| return scales_tensor.new_empty((padded_rows, padded_cols)) | ||
|
|
||
|
|
||
| def mx_block_rearrange_2d_m_groups_cutedsl( |
|
All comments addressed. Kept the Triton and CuTeDSL tests separate, as the PyTorch reference can't express the CuTeDSL test's partial-column (non-multiple-of-4) cases. |
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
(Replaces #4585 due to incorrect ghstack base branch targeting.)
To test:
This PR adds a CuTeDSL implementation of the existing CUDA
mx_block_rearrange_2d_M_groups kernel, as well as validation/benchmark script that compares it against the current CUDA and Triton implementations. The production call sites are unchanged in this PR; the CUDA and Triton variants will be deactivated and deleted in a follow-up.Benchmarking results
Benchmarking command to produce the table above
python benchmarks/prototype/moe_training/mxfp8/bench_mx_block_rearrange_2d_M_groups.py \ 131072x37x8 \ 131072x45x8 \ 131072x64x8 \ 131072x160x8 \ 131072x224x8 \ 131072x320x8 \ 131072x512x8 \ 131072x768x8 \ 131072x1024x8 \ 131072x1025x8 \ 131072x1536x8 \ 131072x2048x8 \ 131072x2049x8 \ 131072x3072x8 \ 131072x4096x8 \ 131072x4097x8 \ --multiple-of 32 --cuda-graph-bench --graph-iters 1000 --bench-only triton cuda cutedslEdit: Some additional benchmarking results:
Benchmarking results, for R/C being powers of two
Benchmarking results, for R/C derived from some realistic (Mixtral, Qwen, Deepseek, Llama) models