feat(kda): add bitwise-aligned SM100 CuTeDSL forward - #123
Merged
Conversation
icavan
marked this pull request as draft
August 25, 2026 02:32
icavanyu
force-pushed
the
icavan/cutedsl-sm100-fwd-pr
branch
from
August 25, 2026 10:17
1fa3215 to
f658595
Compare
icavan
marked this pull request as ready for review
August 25, 2026 10:17
Signed-off-by: shuyan.ycf <shuyan.ycf@antgroup.com>
icavanyu
force-pushed
the
icavan/cutedsl-sm100-fwd-pr
branch
from
August 25, 2026 11:51
f658595 to
f57238f
Compare
KevinZeng08
reviewed
Aug 25, 2026
Collaborator
Does the acceleration come from fusing gate activation + cumsum into chunk_fwd_intra, or just the CuTeDSL speedup? |
Collaborator
Author
Gate activation and chunk cumsum are deliberately outside this correctness boundary. The gain therefore comes from the CuTeDSL implementation and scheduling, especially the persistent recompute-W/U pipeline, vectorized KG stores, and removal of unnecessary launch/scheduling overhead. Standalone recompute-W/U alone is about 4.2% faster. |
Signed-off-by: shuyan.ycf <shuyan.ycf@antgroup.com>
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.
Description
This PR adds an SM100 CuTeDSL implementation of the KDA forward intra and recompute-W/U path.
The review boundary is a one-to-one port of the csrc API that consumes the same precomputed FP32
gktensor. It preserves the csrc TF32/FP32 arithmetic order, including the single-accumulator K=32 Schur product, and is bitwise equal to csrc for the complete Aqk, Akk, KG, W, and U tensors.Included components:
The existing public csrc dispatch remains unchanged. The CuTeDSL specialization is currently limited to SM100, K=V=128, and chunk size 64.
Correctness
Tested on NVIDIA GB200 (SM100):
Results:
torch.equal, without numerical tolerance;Bitwise results at the representative
B=2,T=8192,H=64,K=V=128shape:torch.equalPerformance
Complete csrc-boundary intra, Akk inverse, and recompute-W/U on the same precomputed FP32
gkinput, with three warmup iterations and 20 CUDA-Event-timed iterations:The standalone recompute-W/U path at the same representative T=8192 shape measures 0.3261 ms for csrc and 0.3129 ms for CuTeDSL, or 1.042x csrc throughput.
Appendix: 10,000,000-replay determinism and csrc alignment
The stress harness first requires complete bitwise equality with csrc, then captures CuTeDSL intra, Akk inverse, recompute-W/U, and a comparison of every Aqk/Akk/KG/W/U element against the csrc outputs in one CUDA Graph. Every replay therefore validates the full output, not a checksum or sample.
Stress configuration and result:
B=1,T=256,H=4,K=V=128, BF16 beta;Before replay, Aqk, Akk, KG, W, and U each had zero mismatched elements and zero maximum absolute difference from csrc. FP32 beta is covered by the strict pytest suite; this long replay uses the representative BF16 beta specialization.
Reviewer notes
fp32_akk_inv=Trueis required by the csrc-boundary API. The experimental in-CTA inverse is rejected rather than being included in the bitwise claim.docs/kda_sm100_cutedsl_fwd_status.md.Checklist
pre-commit run --all-files