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
ydwu4
added a commit
that referenced
this pull request
Oct 10, 2026
Replace the raw CE callback through the existing recipe override pattern. Keep native MTP weighting, per-depth normalization, chunking and TP fallback. An explicit autograd Function saves BF16 logits plus compact row statistics; two forward kernels and one backward kernel preserve native rounding. Port the node 747954 handoff to the current Torch/Triton runtime, including FakeTensor contracts, SPMD types, compilation guards and production-shape bitwise tests. Keep model dispatch disabled until the roofline gate passes. 53 CE tests and 219 stack tests plus 24 subtests pass. Fresh local CE F+B falls from 3.734 ms to 0.554 ms, but forward reaches only 68.1% of the independently measured roof. Keep calibration and benchmarks external. ghstack-source-id: f90ce6d Pull-Request: #5261
ydwu4
added a commit
that referenced
this pull request
Oct 10, 2026
Replace the raw CE callback through the existing recipe override pattern. Keep native MTP weighting, per-depth normalization, chunking and TP fallback. An explicit autograd Function saves BF16 logits plus compact row statistics; two forward kernels and one backward kernel preserve native rounding. Port the node 747954 handoff to the current Torch/Triton runtime, including FakeTensor contracts, SPMD types, compilation guards and production-shape bitwise tests. Keep model dispatch disabled until the roofline gate passes. 53 CE tests and 224 stack tests plus 30 subtests pass. Fresh local CE F+B falls from 3.734 ms to 0.554 ms, but forward reaches only 68.1% of the independently measured roof. Keep calibration and benchmarks external. ghstack-source-id: 946298f Pull-Request: #5261
ydwu4
added a commit
that referenced
this pull request
Oct 10, 2026
Replace the raw CE callback through the existing recipe override pattern. Keep native MTP weighting, per-depth normalization, chunking and TP fallback. An explicit autograd Function saves BF16 logits plus compact row statistics; two forward kernels and one backward kernel preserve native rounding. Port the node 747954 handoff to the current Torch/Triton runtime, including FakeTensor contracts, SPMD types, compilation guards and production-shape bitwise tests. Keep model dispatch disabled until the roofline gate passes. 53 CE tests and 224 stack tests plus 30 subtests pass. Fresh local CE F+B falls from 3.734 ms to 0.554 ms, but forward reaches only 68.1% of the independently measured roof. Keep calibration and benchmarks external. ghstack-source-id: 946298f Pull-Request: #5261
This was referenced Oct 10, 2026
This was referenced Oct 14, 2026
sanketpurandare
added a commit
that referenced
this pull request
Oct 20, 2026
## Agent details (AI-generated) Adapt Yidi Wu's (@ydwu4) implementation from #5261 at 1acef59, preserving copyright/license and credit for the original kernel design. Extend the override to positive token and full-vocabulary sizes instead of restricting it to a benchmark shape. Preserve native warp/register/global softmax reduction order, BF16 forward and backward rounding, ignored labels, and device bounds assertions. Only raw cross entropy is fused. Native MTP alignment, independent objective denominators, coefficient/mean composition, and detached metrics remain unchanged. Save two FP32 row statistics (32 KiB at 4096 tokens), not FP32 vocabulary activations. Retain proven 32-bit indexing when T*V < 2^31 and widen larger addresses. Keep native TP/unsupported-layout behavior unless fusion is required. Do not add owned outputs or a competing loss-result API. Production kernels retain their existing hot instruction path. General shapes use actual fused kernel variants, not eager fallback. Original-author branches are untouched. GraphTrainer is outside scope. ## Test Plan (AI-generated) python -m pytest tests/unit_tests/cpu/test_fused_dsv3_mtp_loss.py tests/unit_tests/gpu/test_fused_dsv3_mtp_loss.py -q 75 tests passed on the current local change, including byte-exact general and production loss/gradient checks, metadata/error paths, invalid-label isolation, compile and CUDA graph replay. Current-main stack rebase, final matched performance/memory checks, distributed gates, lint/docs, and refreshed review audit remain pending; these results are not a landing or convergence claim.
sanketpurandare
added a commit
that referenced
this pull request
Oct 23, 2026
## Agent details (AI-generated) Adapt Yidi Wu's (@ydwu4) implementation from #5261 at 1acef59, preserving copyright/license and credit for the original kernel design. Extend the override to positive token and full-vocabulary sizes instead of restricting it to a benchmark shape. Preserve native warp/register/global softmax reduction order, BF16 forward and backward rounding, ignored labels, and device bounds assertions. Only raw cross entropy is fused. Native MTP alignment, independent objective denominators, coefficient/mean composition, and detached metrics remain unchanged. Save two FP32 row statistics (32 KiB at 4096 tokens), not FP32 vocabulary activations. Retain proven 32-bit indexing when T*V < 2^31 and widen larger addresses. Keep native TP/unsupported-layout behavior unless fusion is required. Do not add owned outputs or a competing loss-result API. Production kernels retain their existing hot instruction path. General shapes use actual fused kernel variants, not eager fallback. Original-author branches are untouched. GraphTrainer is outside scope. ## Test Plan (AI-generated) python -m pytest tests/unit_tests/cpu/test_fused_dsv3_mtp_loss.py tests/unit_tests/gpu/test_fused_dsv3_mtp_loss.py -q 75 tests passed on the current local change, including byte-exact general and production loss/gradient checks, metadata/error paths, invalid-label isolation, compile and CUDA graph replay. Current-main stack rebase, final matched performance/memory checks, distributed gates, lint/docs, and refreshed review audit remain pending; these results are not a landing or convergence claim.
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 log-softmax/NLL reduction and its gradient with compact saved state.
Preserve native MTP weighting, chunking, normalization and TP fallback.
Keep Gluon kernels, custom operators, autograd and override in one file,
with one CPU test file and one GPU test file.
Recorded GB300 local CE F+B: 3.734 -> 0.554 ms. Bitwise checks pass;
forward reaches 68.1% of the measured roof, so model dispatch stays off.