Repository navigation
Conversation
ydwu4
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
October 10, 2026 04:01
This was referenced Oct 10, 2026
ydwu4
marked this pull request as draft
October 10, 2026 04:03
This was referenced Oct 10, 2026
Contributor
was this speed up measured against local compile? this looks like huge improvement! also could you provide numerics comparison? |
This was referenced Oct 14, 2026
Contributor
Author
|
It's against eager. yes, bitwise check passes see test_bitwise_forward_and_backward! |
sanketpurandare
added a commit
that referenced
this pull request
Oct 20, 2026
## Agent details (AI-generated) Adapted from Yidi Wu (@ydwu4), #5259, revision 25dafa9. Preserve original attribution and license; this change includes integration and generalization, not just a port. Keep provided-map/L1 and unbiased top-k objectives distinct. Preserve native coefficient/token normalization, gradient injection, metric accumulation and DP-local training ownership. Padding contributes no counts, score sums or gradients; unbiased selection is independent of biased/group-limited routing. General fused CUDA kernels support positive T/E and configured top-k, while the aligned production geometry keeps the tuned CuTe launch. Derive scratch and native CTA partitioning from shapes and device resources. Explicitly fold block.y partials in native order, independent of Triton layout; preserve unaligned score-base offsets and scalar clamp-min's strict boundary derivative. Temporary normalized scores/maps and partial buffers are not autograd saved state. Save only original scores, frequencies and an optional padding mask. The general implementation does not fall back to eager ATen for shape/tails. ## Test Plan (AI-generated) python -m pytest tests/unit_tests/cpu/test_fused_dsv3_router.py tests/unit_tests/gpu/test_fused_dsv3_router.py tests/unit_tests/cpu/test_fused_dsv3_seqwise_loss.py tests/unit_tests/gpu/test_fused_dsv3_seqwise_loss.py -q pre-commit run --all-files 86 combined CPU/GPU tests passed, covering exact gradients/losses, signed and tiny scores, clamp equality, all-padding rows, odd experts, native CTA-split boundaries, offset1/2/3 storage, FakeTensor metadata and fullgraph/capture/replay. The benchmark's post-hot seed14536 failure is preserved as an exact regression test; fixing native reduction order removed its one-ULP raw-loss mismatch. Strict relevant docs passed. All non-type lint hooks passed; only unchanged baseline type findings remained. Matched graph-replay F+B general cases beat the same native reference by 2.662x (T8193/E64/K6), 3.064x (T4097/E512/K8) and 2.517x (T33/E129/K8), with exact reference checks and separate eager GPU trace collection. The production path retains the same kernels; latest median20.933us versus 20.701us before overlaps the observed trial spread. A longer final matched hot-path comparison and complete PP2/PP4/memory gates remain pending. No distributed-throughput or full-model convergence claim follows here.
sanketpurandare
added a commit
that referenced
this pull request
Oct 23, 2026
## Agent details (AI-generated) Adapted from Yidi Wu (@ydwu4), #5259, revision 25dafa9. Preserve original attribution and license; this change includes integration and generalization, not just a port. Keep provided-map/L1 and unbiased top-k objectives distinct. Preserve native coefficient/token normalization, gradient injection, metric accumulation and DP-local training ownership. Padding contributes no counts, score sums or gradients; unbiased selection is independent of biased/group-limited routing. General fused CUDA kernels support positive T/E and configured top-k, while the aligned production geometry keeps the tuned CuTe launch. Derive scratch and native CTA partitioning from shapes and device resources. Explicitly fold block.y partials in native order, independent of Triton layout; preserve unaligned score-base offsets and scalar clamp-min's strict boundary derivative. Temporary normalized scores/maps and partial buffers are not autograd saved state. Save only original scores, frequencies and an optional padding mask. The general implementation does not fall back to eager ATen for shape/tails. ## Test Plan (AI-generated) python -m pytest tests/unit_tests/cpu/test_fused_dsv3_router.py tests/unit_tests/gpu/test_fused_dsv3_router.py tests/unit_tests/cpu/test_fused_dsv3_seqwise_loss.py tests/unit_tests/gpu/test_fused_dsv3_seqwise_loss.py -q pre-commit run --all-files 86 combined CPU/GPU tests passed, covering exact gradients/losses, signed and tiny scores, clamp equality, all-padding rows, odd experts, native CTA-split boundaries, offset1/2/3 storage, FakeTensor metadata and fullgraph/capture/replay. The benchmark's post-hot seed14536 failure is preserved as an exact regression test; fixing native reduction order removed its one-ULP raw-loss mismatch. Strict relevant docs passed. All non-type lint hooks passed; only unchanged baseline type findings remained. Matched graph-replay F+B general cases beat the same native reference by 2.662x (T8193/E64/K6), 3.064x (T4097/E512/K8) and 2.517x (T33/E129/K8), with exact reference checks and separate eager GPU trace collection. The production path retains the same kernels; latest median20.933us versus 20.701us before overlaps the observed trial spread. A longer final matched hot-path comparison and complete PP2/PP4/memory gates remain pending. No distributed-throughput or full-model convergence claim follows here.
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.
Stack from ghstack (oldest at bottom):
Fuse expert frequencies, score normalization, raw-loss reduction and score
gradients. Preserve native loss injection, metrics, scaling and MoE layout.
Keep kernels, custom operators, autograd and override in one file, with
one CPU test file and one GPU test file. Compose with the router factory
without changing either module's ownership.
Recorded GB300 FP32 [4096,256], native -> CuTeDSL:
Fwd 49.19 -> 7.48 us; Bwd 32.45 -> 3.50 us; F+B 79.98 -> 10.20 us.
Bitwise checks pass; roofline acceptance remains open. Requires CuTeDSL 4.8+.