Skip to content

ggml : add QSA sparse Flash Attention on V100 - #21

Merged
novkien merged 1 commit into
masterfrom
codex/flash9-qsa-sparse-v4
Oct 3, 2026
Merged

novkien merged 1 commit into
masterfrom
codex/flash9-qsa-sparse-v4

Conversation

@novkien

@novkien novkien commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Overview

Add an SM70-only sparse Flash Attention route for the Qwen QSA D256/GQA12/Q8_0 shape, using the 16x4 tile and the existing 2051-token mask bound. The route keeps full-Q=1024 and unsupported shapes on existing paths. Deterministic test fixtures cover disjoint and sliding-window masks.

Addresses #9

Validation

  • Native V100 candidate CPU-reference checks: 2/2 passed. RPC RTX 5060 Ti positive checks: 2/2 passed. The 14-case fallback set passed 14/14, including 11 merged-base Volta regressions and three sparse guard controls.
  • Five alternating operator pairs cover all eight KV-length, query-batch, and mask-pattern cells. Speedup is baseline time divided by candidate time; intervals use exact enumeration of 3,125 paired resamples.
KV length Queries Mask pattern Speedup [95% CI]
131072 512 Disjoint regions 2.2763 [2.2716, 2.2805]
200704 512 Disjoint regions 3.4384 [3.4294, 3.4475]
131072 512 Sliding window 28.6091 [28.5778, 28.6405]
200704 512 Sliding window 36.9951 [36.8919, 37.0777]
131072 1024 Disjoint regions 1.0005 [0.9999, 1.0011]
200704 1024 Disjoint regions 0.9994 [0.9985, 1.0004]
131072 1024 Sliding window 0.9981 [0.9940, 1.0017]
200704 1024 Sliding window 1.0014 [0.9970, 1.0075]

A bounded trace of an actual long-context proxy prefill recorded 20 sparse Flash launches across all four V100s, including Q=1020 with KV=70144 and Q=326 with KV=69120. This confirms route selection for the traced shapes; the trace package was excluded from performance measurements. Cold 8k/32k K/V lengths remain below the sparse threshold, and full Q=1024 is explicitly excluded. These operator results do not claim an end-to-end model speedup.

The PR is ready for review. Final combined deployment, near-full-context, and performance acceptance remain with the root owner; issue #9 stays open until that work is recorded.

Requirements

  • I have read and agree with the contributing guidelines.
  • AI usage disclosure: YES. Codex implemented and reviewed this change under the owner's approved plan. The owner authorized publication and is responsible for the submission; owner code review is not claimed.

Add the V100-only sparse 16x4 D256 Flash Attention route for the QSA Q8_0 shape while retaining existing dense fallbacks and 1024-query behavior. Add deterministic sparse fixtures, positive cases, controls, and performance cells.

Assisted-by: Codex
@novkien

novkien commented Oct 3, 2026

Copy link
Copy Markdown
Owner Author

CI triage and handoff (2026-10-03)

The two completed Windows failures repeat the same signatures seen on PR17:

  • The current Windows Server job fails unit/test_completion.py::test_completion_unified[256-4-n_predict_vals3-expected_success3] with HTTP 500, Failed to restore prompt cache state; the same case, result, and 334-passed/4-skipped count appear in the PR17 Server job. PR21 changes CUDA attention and backend-op tests, not the server prompt-cache path.
  • The current Windows x64 OpenBLAS job fails test-thread-safety using tinyllamas/stories15M-q4_0.gguf: it reports all threads finished without errors, then exits with 0xc0000374. The same test/model/outcome appears in the PR17 OpenBLAS job. PR21 does not change that test or its CPU code path.

These are recurring signatures, not a confirmed root cause or proof of an infrastructure failure. The owner authorized marking this reviewed head ready and squash-merging it after the exact-head, issue, and base checks. Root retains the combined build, deployment, performance, and context acceptance; issue #9 remains open.

@novkien
novkien marked this pull request as ready for review October 3, 2026 12:54
@novkien
novkien merged commit c7de202 into master Oct 3, 2026
13 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants