cuda: zero the MMQ stream-k fixup staging buffer - #320
Merged
Conversation
The fixup buffer comes from the pool uninitialized. Zero it before the stream-k pass so any fixup cell the merge visits without a producer contributes nothing instead of stale pool bytes. Hardening found while chasing (unrelated, as it turned out) batch-1 nondeterminism in the MiniMax Music 3 flow graph.
Owner
|
@iamwavecut Thanks! This was a subtle one. You had to go pretty deep to find it, so thanks for tracking it down. PR merged! |
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.
What
launch_mul_mat_qallocates the stream-k fixup staging buffer from the pool and uses it without initialization. Pool memory is recycled, so whatever the previous op left there is what the fixup merge pass reads for any cell it visits before/without a producer. This zeroes the staging buffer first.Why we found it
We were bisecting a bitwise-reproducible corruption in the first ~4 invocations of a freshly allocated MiniMax Music 3 flow graph at batch 1. This buffer turned out not to be the culprit (that was a view-aliasing hazard, see the MM3 perf-pack PR), but the uninitialized staging is real and cheap to close: one async memset on the same stream, only when fixup is actually needed.
Validation
minimax_music3_*path tests pass.Backend tested: CUDA. Other backends untouched.