Skip to content

Accumulate ARM matrix-accumulation flash attention directly into att_out. - #1076

Merged
copybara-service[bot] merged 1 commit into
devfrom
test_1012917607
Nov 4, 2026
Merged

copybara-service[bot] merged 1 commit into
devfrom
test_1012917607

Conversation

@copybara-service

Copy link
Copy Markdown

Accumulate ARM matrix-accumulation flash attention directly into att_out.

Follow-up to the generic kernel change: the matrix accumulation kernel
(TileFlashAttentionReturnExpSumsAndMaxLogitsBF16_Impl, used by the
MatrixAccumulation and MatrixAccumulationInt8 dispatches) now uses the IN/OUT
att_out directly as its online-softmax accumulator.

  • TileFlashAttentionSVBlock{,BF16,Int8} take att_out's base pointer and row
    stride instead of a packed C buffer. The caller always passes
    kNumQueries == actual query count, and the odd row of a query pair is
    already guarded, so no row >= q_count is touched.
  • Remove the C region from MatrixAccumulationWorkspaceLayout, its per-call
    zero fill and the final C -> att_out copy.
  • HWY_DASSERT that att_out has q_count rows and qkv_dim is a multiple of 8,
    since rows are now addressed directly.
  • Extend the shared test setup to the matrix accumulation kernels (renaming
    MixedRangesQueryType to TiledTestKernel, since it now selects kernels rather
    than query types) and add
    TestTiledFlashAttentionMatrixAccumulationChainedCalls, which runs the
    chaining check on them.

…out.

Follow-up to the generic kernel change: the matrix accumulation kernel
(TileFlashAttentionReturnExpSumsAndMaxLogitsBF16_Impl, used by the
MatrixAccumulation and MatrixAccumulationInt8 dispatches) now uses the IN/OUT
att_out directly as its online-softmax accumulator.

- TileFlashAttentionSVBlock{,BF16,Int8} take att_out's base pointer and row
  stride instead of a packed C buffer. The caller always passes
  kNumQueries == actual query count, and the odd row of a query pair is
  already guarded, so no row >= q_count is touched.
- Remove the C region from MatrixAccumulationWorkspaceLayout, its per-call
  zero fill and the final C -> att_out copy.
- HWY_DASSERT that att_out has q_count rows and qkv_dim is a multiple of 8,
  since rows are now addressed directly.
- Extend the shared test setup to the matrix accumulation kernels (renaming
  MixedRangesQueryType to TiledTestKernel, since it now selects kernels rather
  than query types) and add
  TestTiledFlashAttentionMatrixAccumulationChainedCalls, which runs the
  chaining check on them.

PiperOrigin-RevId: 1013854379
@copybara-service
copybara-service Bot merged commit 2dcef09 into dev Nov 4, 2026
9 of 11 checks passed
@copybara-service
copybara-service Bot deleted the test_1012917607 branch November 4, 2026 15:59
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