[PR #1096] [CLOSED] qsa_prompt_attn: the Volta kernel's latency pipeline (32K int8 12.1 -> 10.2 ms, +1.2% e2e) #3021

Closed
opened 2026-11-04 02:04:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/1096
Author: @ATIVX928
Created: 10/6/2026
Status: ❌ Closed

Base: main ← Head: v100/prompt-attn-pipeline-v2


📝 Commits (1)

  • 8bd9008 kernels (sm_70): the prompt attention's latency pipeline (mma884 kernel)

📊 Changes

3 files changed (+266 additions, -28 deletions)

View changed files

📝 CMakeLists.txt (+7 -0)
➕ bench/qsa_prompt_attn_sm70_bench.cpp (+198 -0)
📝 src/kernels/cuda/qsa_prompt_attn.cu (+61 -28)

📄 Description

Resubmitted from #1020: the original was auto-closed by the 2026-10-06 history cleanup. Rebased onto the new main (82f46a8); build and parity re-verified on 2x V100.

What

Main already runs the Volta prompt attention on prompt_attn_v70_kernel (#600). This adds the kernel's latency pipeline: the pool-row lookups are double-buffered (the next chunk's rows are prefetched under the previous chunk's p.v), and a thread's staging loads are batched before its stores. No arithmetic, layout or output changes - the sums are formed in the same order.

This is the remaining piece of the Volta prompt attention in #627 (the base kernel was already taken from #600; only the pipeline commit is left).

Gating

All changes are inside the existing #if !defined(__HIPCC__) && defined(STRATA_EXPERIMENTAL_SM60) block in src/kernels/cuda/qsa_prompt_attn.cu; the ready-made engine is untouched.

Measured

V100-SXM2-16GB, CUDA 12.8, qsa_prompt_attn_sm70_bench, 2,048 queries of a 32K selection, 5 reps:

KV before after vs FP32 before -> after
int8 12.111 ms 10.247 ms 1.73x -> 2.05x
fp16 25.700 ms 17.390 ms 0.80x -> 1.18x
K8V4 25.713 ms 24.119 ms 0.85x -> 0.91x

Tests

  • qsa_prompt_attn_parity 32768 2048 5: PASS, 0 failures. Every FP64 and new-vs-old figure is identical before/after the patch (int8 32768: new vs old 1.25e-05, 3.3e-06 of the output scale): the port is numerically bit-identical.
  • The bench's K8V4 max |old-new| is unchanged and covers mode 3, which the parity test skips on sm_70.

32K end-to-end

Same setup. Interleaved A/B (baseline / this branch, 5 rounds each): on the rebased branch against the new main, dual-card prefill 2219.9 -> 2245.5 tok/s (+1.2%); the same A/B on the pre-cleanup main read 2191.6 -> 2225.2 (+1.5%), with single-card 1557.1 -> 1575.1 (+1.2%). The branch repeats within 0.2% across sessions, and so does the baseline. Decode is unchanged (within its +-15% session noise).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/1096 **Author:** [@ATIVX928](https://github.com/ATIVX928) **Created:** 10/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `v100/prompt-attn-pipeline-v2` --- ### 📝 Commits (1) - [`8bd9008`](https://github.com/Niko1221/Strata/commit/8bd9008d5d9b1d39fe34c0457eb53862ba7a4a84) kernels (sm_70): the prompt attention's latency pipeline (mma884 kernel) ### 📊 Changes **3 files changed** (+266 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+7 -0) ➕ `bench/qsa_prompt_attn_sm70_bench.cpp` (+198 -0) 📝 `src/kernels/cuda/qsa_prompt_attn.cu` (+61 -28) </details> ### 📄 Description > Resubmitted from #1020: the original was auto-closed by the 2026-10-06 history cleanup. Rebased onto the new `main` (82f46a8); build and parity re-verified on 2x V100. ## What Main already runs the Volta prompt attention on `prompt_attn_v70_kernel` (#600). This adds the kernel's latency pipeline: the pool-row lookups are double-buffered (the next chunk's rows are prefetched under the previous chunk's p.v), and a thread's staging loads are batched before its stores. No arithmetic, layout or output changes - the sums are formed in the same order. This is the remaining piece of the Volta prompt attention in #627 (the base kernel was already taken from #600; only the pipeline commit is left). ## Gating All changes are inside the existing `#if !defined(__HIPCC__) && defined(STRATA_EXPERIMENTAL_SM60)` block in `src/kernels/cuda/qsa_prompt_attn.cu`; the ready-made engine is untouched. ## Measured V100-SXM2-16GB, CUDA 12.8, `qsa_prompt_attn_sm70_bench`, 2,048 queries of a 32K selection, 5 reps: | KV | before | after | vs FP32 before -> after | | --- | ---: | ---: | ---: | | int8 | 12.111 ms | 10.247 ms | 1.73x -> **2.05x** | | fp16 | 25.700 ms | 17.390 ms | 0.80x -> 1.18x | | K8V4 | 25.713 ms | 24.119 ms | 0.85x -> 0.91x | ## Tests - `qsa_prompt_attn_parity 32768 2048 5`: PASS, 0 failures. Every FP64 and new-vs-old figure is identical before/after the patch (int8 32768: new vs old 1.25e-05, 3.3e-06 of the output scale): the port is numerically bit-identical. - The bench's K8V4 `max |old-new|` is unchanged and covers mode 3, which the parity test skips on sm_70. ## 32K end-to-end Same setup. Interleaved A/B (baseline / this branch, 5 rounds each): on the rebased branch against the new main, dual-card prefill 2219.9 -> 2245.5 tok/s (+1.2%); the same A/B on the pre-cleanup main read 2191.6 -> 2225.2 (+1.5%), with single-card 1557.1 -> 1575.1 (+1.2%). The branch repeats within 0.2% across sessions, and so does the baseline. Decode is unchanged (within its +-15% session noise). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:04:59 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#3021
No description provided.