Repository navigation
Add CuTeDSL MXFP8 pad/unpad kernels - #4703
Open
alexsamardzic wants to merge 6 commits into
Open
alexsamardzic wants to merge 6 commits into
alexsamardzic wants to merge 6 commits into
Conversation
Collaborator
Author
|
Stack from ghstack (oldest at bottom): |
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/4703
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 78e70ef with merge base 9d0c494 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
vkuzo
reviewed
Aug 13, 2026
| @@ -0,0 +1,298 @@ | |||
| # Copyright (c) Meta Platforms, Inc. and affiliates. | |||
Contributor
There was a problem hiding this comment.
split to test and benchmarks
vkuzo
reviewed
Aug 13, 2026
| @pytest.mark.parametrize("num_groups", [1, 8]) | ||
| @pytest.mark.parametrize("alignment_size", [32]) | ||
| @pytest.mark.parametrize("dtype", [torch.bfloat16]) | ||
| def test_cutedsl_pad_token_groups( |
Contributor
There was a problem hiding this comment.
are there tests we can extend instead of adding new ones?
vkuzo
reviewed
Aug 13, 2026
| ) | ||
|
|
||
|
|
||
| def pad_token_groups_cutedsl( |
vkuzo
reviewed
Aug 13, 2026
| return output, padded_group_start_offsets, padded_group_end_offsets | ||
|
|
||
|
|
||
| def unpad_token_groups_cutedsl( |
Collaborator
Author
|
All comments addressed. |
[ghstack-poisoned]
[ghstack-poisoned]
[ghstack-poisoned]
This branch has not been deployed
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.
(Replaces #4594 due to incorrect ghstack base branch targeting.)
PR contains CuTeDSL implementations of the MXFP8 pad/unpad kernels and correspondign tests and validate/benchmark script comparing them against the existing CUDA and PyTorch paths. The kernels performance is on par with CUDA kernels performance, see below.
To test:
Benchmarking results, for input dims derived from some realistic models
Benchmarking command to produce the table above
python benchmarks/prototype/moe_training/mxfp8/bench_pad_unpad_token_groups.py \ 131072x2048x8 \ 131072x4096x8 \ 131072x5120x8 \ 131072x7168x8 \ 131072x8192x8 \ 131072x10240x8 \ 131072x12288x8 \ 131072x16384x8 \ --alignment-size 32 --multiple-of 1 --cuda-graph-bench --graph-iters 1000Benchmarking results, for input dims being powers of two