Skip to content

Replaces the second ParallelFor barrier/reduction loop in LocalAttentionForAllHeadsTokensAndBatch (tiled_attention.cc) with a lock-free 64-bit atomic compare-and-exchange state machine (AtomicGroupMergeSlot) partitioned into groups of up to 32 queries (kMergeGroupSize = 32). Subtasks hand off completed 32-query group pointers immediately via CAS or claim and merge waiting groups outside any lock. Uses Highway SIMD vectorization (MergeOnlineSoftmaxGroup32, hn::FastExpMinusOrZero) to compute online softmax exponents and scaling factors across all 32 queries simultaneously and combine attention outputs in a single FMA pass. - #1028

Merged
copybara-service[bot] merged 1 commit into
devfrom
test_979178229
Sep 14, 2026

Conversation

@copybara-service

Copy link
Copy Markdown

Replaces the second ParallelFor barrier/reduction loop in LocalAttentionForAllHeadsTokensAndBatch (tiled_attention.cc) with a lock-free 64-bit atomic compare-and-exchange state machine (AtomicGroupMergeSlot) partitioned into groups of up to 32 queries (kMergeGroupSize = 32). Subtasks hand off completed 32-query group pointers immediately via CAS or claim and merge waiting groups outside any lock. Uses Highway SIMD vectorization (MergeOnlineSoftmaxGroup32, hn::FastExpMinusOrZero) to compute online softmax exponents and scaling factors across all 32 queries simultaneously and combine attention outputs in a single FMA pass.

…entionForAllHeadsTokensAndBatch` (`tiled_attention.cc`) with a lock-free 64-bit atomic compare-and-exchange state machine (`AtomicGroupMergeSlot`) partitioned into groups of up to 32 queries (`kMergeGroupSize = 32`). Subtasks hand off completed 32-query group pointers immediately via CAS or claim and merge waiting groups outside any lock. Uses Highway SIMD vectorization (`MergeOnlineSoftmaxGroup32`, `hn::FastExpMinusOrZero`) to compute online softmax exponents and scaling factors across all 32 queries simultaneously and combine attention outputs in a single FMA pass.

PiperOrigin-RevId: 981156349
@copybara-service
copybara-service Bot merged commit 10ebbdd into dev Sep 14, 2026
6 checks passed
@copybara-service
copybara-service Bot deleted the test_979178229 branch September 14, 2026 15:08
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.

1 participant