Repository navigation
Conversation
_mix runs one program per row over all 8192 (padded) columns, so a decode step with 1-16 rows keeps 1-16 SMs busy and is single-SM ALU/L2 bound (~0.6 us per committed source; 5.2-5.8 us per call over the 187-call K3 sequence). With FLARE_KIMI3_MIX_SPLIT_ROWS=N (default 0 = off), ResidualStreams of at most N rows launch _mix_split on rows x ceil(hidden / FLARE_KIMI3_MIX_SPLIT_CHUNK) programs (chunk 1024, 4 warps by default; FLARE_KIMI3_MIX_SPLIT_WARPS). Each program loads all of its sources at once, publishes per-chunk FP32 square/dot partials and the mixture square sum as 64-bit (value, call tag) words and polls them back in one volatile round trip; partials are added in chunk order, so every program of a row (and every TP rank) sees identical scores and norms. A per-row int32 epoch, advanced by chunk 0 after all programs of the row have read it, tags each call, so nothing is reset between calls or CUDA graph replays. Elementwise steps and BF16 rounding points are those of _mix. Prefix and committed blocks are bit-identical to _mix. The mixture is within 1 BF16 ulp and the normalized output within 3 ulp wherever |y| >= row max / 64 (FP32 reduction order; near-zero cancellations as in test_kimi3_residual_cuda), FP64-canonical error unchanged. 187-call sequence on RTX PRO 6000: 5.20/5.66/5.83 -> 3.38/3.44/3.66 us per call at 1/8/16 rows; 10,000 CUDA graph replays reproduce the eager hash.
Author
|
GPU validation of this branch as published (base Tests.
Exactness (external validator, split kernel vs
Timing (187-call decoder
The off path is about 0.4 us faster in this run than in the description, so the saving per decode step is about 0.30-0.37 ms rather than 0.41 ms. The design note about cross-CTA spin-waiting still applies. We saw no hang in any run. |
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
_mix(AttnRes residual add + commit + mix + RMSNorm) runs one Triton program per row over all 8192 padded columns. A decode step with 1-16 rows therefore keeps only 1-16 SMs busy, and the call is bound by a single SM's ALU/L2 throughput. There are 187 calls per step, at 5.2-5.8 us each.With
FLARE_KIMI3_MIX_SPLIT_ROWS=N(default 0 = off), ResidualStreams of at most N rows launch_mix_spliton rows x ceil(hidden /FLARE_KIMI3_MIX_SPLIT_CHUNK) programs. Defaults are chunk 1024 and 4 warps (FLARE_KIMI3_MIX_SPLIT_WARPS).187-call sequence on RTX PRO 6000, us per call at 1/8/16 rows: 5.20/5.66/5.83 -> 3.38/3.44/3.66, about -0.41 ms per decode step.
Exactness: prefix and committed blocks are bit-identical to
_mix. The mixture is within 1 BF16 ulp. The normalized output is within 3 ulp wherever |y| >= row max / 64 (FP32 reduction order). The FP64-canonical error is unchanged. 10,000 CUDA graph replays reproduce the eager hash.Default-off guarantee: with N=0,
_mixruns exactly as before.🧪 Tests
tests/recipes/test_kimi3_residual_split_cuda.py(GPU). On this branch it was collected and skipped on a CPU-only machine (56 skipped). The other kimi3 CPU tests have the same failure set as the release branch.Topology assumptions
Generic (single GPU).
Reviewer Notes / risk