Logical collection
Q tiles: [B, Hq, BM, D]
This describes all independent batch/head/query-block slices together.
One-page visual reference
How a logical B×H×L×L attention problem becomes many independent CTA tiles, how online softmax stays globally exact without storing the score matrix, and exactly where Skip Softmax saves work.
Q tiles: [B, Hq, BM, D]
This describes all independent batch/head/query-block slices together.
Q[b,h,m:m+BM,:] → [BM,D]
Batch, head and query block are fixed by the launch-grid coordinates.
[BM,D]×[D,BN]→[BM,BN]
[BM,BN]×[BN,D]→[BM,D]
The GPU processes the batch concurrently by scheduling many CTAs—not by mixing different sequences or heads into one matrix multiply.
One head's logical Lq×Lk score matrix, partitioned into BM×BN tiles.
Typical values are BM=64/128, BN=64/128, and D=64/128. Actual choices depend on architecture, datatype and kernel tuning.
If a later tile reveals a larger maximum, multiplying old state by exp(m_old−m_new) moves it into the new coordinate system.
No approximation is introduced: tile order can change, but the final global-softmax result is the same, up to floating-point numerics.
Scores [2, 1, 3, 0], scalar values [10, 20, 30, 40], processed as two 2-token tiles.
The decision scope is one batch item × head × Q block × KV block. During prefill, all valid rows in the Q block must agree. During decode, there is usually one valid query row.
| Work | Normal FlashAttention tile | Skipped tile |
|---|---|---|
| Load K and compute QK | Yes | Yes—needed to decide |
| Exponentiation / online-softmax update | Yes | Avoided |
| Load V from HBM | Yes | Avoided |
| Compute PV / BMM2 | Yes | Avoided |
BM ≈ 64/128 real query rows
Many Q tiles run in parallel. The workload is often compute-heavy. Skip Softmax saves softmax and PV, but one important query row can force the whole tile to remain dense.
one real query row per request
The query scans a long KV cache and is often bandwidth-bound. Avoiding V loads is the main Skip Softmax benefit; padded rows do not vote against skipping.
| Symbol / term | Meaning | Typical shape or scope |
|---|---|---|
| B | Inference/training batch | Parallel grid dimension, not mixed into one attention GEMM |
| Hq / Hkv | Query and KV heads | In GQA, several query heads share one KV head |
| BM | Query-token block | Rows of the score tile |
| BN | KV-token block | Columns of the score tile |
| D | Per-head dimension | Reduction axis of QK and output axis of PV |
| CTA / Triton program | Cooperating GPU work unit | Usually one b,h,qblock, looping over KV blocks |
| Online state | Enough information to merge softmax tiles | m[BM], l[BM], A[BM,D] |