Skip to content

Barrier before reusing GQA reduction scratch - #63

Open
quantz8a wants to merge 1 commit into
antirez:mainfrom
quantz8a:fix/52-gqa-softmax-barrier
Open

Barrier before reusing GQA reduction scratch#63
quantz8a wants to merge 1 commit into
antirez:mainfrom
quantz8a:fix/52-gqa-softmax-barrier

Conversation

@quantz8a

@quantz8a quantz8a commented Sep 12, 2026

Copy link
Copy Markdown

Summary

  • Add a threadgroup_barrier after reading the reduced max in h3_gqa_causal_bf16 before reusing reductions[] for the softmax sum.

Fixes #52

Test plan

  • make -j && ./h3_tests
  • Repeat identical causal-GQA dispatches at long sequence (issue reports nondeterminism around seq ≥662); outputs should match bit-for-bit

After the max reduction, reductions[0] must be read by every thread
before the array is overwritten for the sum pass. Missing the barrier
made causal GQA softmax nondeterministic at long sequences (antirez#52).
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.

A potential nondeterministic issue

1 participant