Skip to content

cuda: zero the MMQ stream-k fixup staging buffer - #320

Merged
0xShug0 merged 1 commit into
0xShug0:mainfrom
iamwavecut:pr/mmq-fixup-zeroing
Aug 27, 2026
Merged

cuda: zero the MMQ stream-k fixup staging buffer#320
0xShug0 merged 1 commit into
0xShug0:mainfrom
iamwavecut:pr/mmq-fixup-zeroing

Conversation

@iamwavecut

Copy link
Copy Markdown
Contributor

What

launch_mul_mat_q allocates 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

  • Built and ran the full MiniMax Music 3 CUDA path (A40, driver 580.159.04) before/after: outputs byte-identical, no measurable wall change (memset is ~µs against multi-ms GEMM waves).
  • minimax_music3_* path tests pass.

Backend tested: CUDA. Other backends untouched.

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.
@0xShug0
0xShug0 merged commit 17751c0 into 0xShug0:main Aug 27, 2026
6 checks passed
@0xShug0

0xShug0 commented Aug 27, 2026

Copy link
Copy Markdown
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants