[PR #742] [CLOSED] qsa_select: FP32 tiled block scores below sm_80 (+22% 128K / +33% 248K prefill on a 2080 Ti) #2801

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

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/742
Author: @konijiwa110
Created: 10/4/2026
Status: ❌ Closed

Base: main ← Head: qsa-select-fp32-tiled-scores


📝 Commits (10+)

  • b0dda4b AMD: gfx1101 (RX 7800 XT, #254 by jhohertz) and gfx1200 (RX 9060 XT, #256 by Efeisot) as community-validated cards
  • cc97fcd setup: AMD layer splits with --gpus (every chosen card a supported AMD arch; the engine compiled for each)
  • e9e2ba3 pinned (#243 follow-up): the shared-memory-budget cap on the sliced pin is opt-in (STRATA_ARENA_PIN_GIB=auto) - by default the arena pins as in 0.1.30; on this 64 GB PC the cap pinned 26 instead of 30 GiB and cost ~20% prompt speed and 2-4% IQ3_S decode
  • cacffa9 CS-T speed: the file tier fetched in parallel, PCIe planning without file reads, a partial pin of the RAM tier, bit-exact AVX2 multi-token kernels for Q4_K / Q5_1 / Q8_0 experts, decode-only tier stats
  • a348c7a Merge branch 'f-131-srv' into r131-q4
  • b93a00c Merge branch 'f-q4-on242' into r131-q4
  • 8f5148c CS-T: the partial pin at most 24 GiB (STRATA_PARTIAL_PIN_GIB), the Q4_K/Q5_1/Q8_0 multi-token kernels from two tokens on
  • 5ffda19 CS-T: the GGUF-in-place prefetch asks Windows for all of a layer's missed slices at once (PrefetchVirtualMemory)
  • ed6c124 #253: the 8 GiB arena pin cap only under WDDM; STRATA_ARENA_PIN_GIB; the split's prompt chunk steps down
  • 450149d --split-skip-if-fits (opt-in): an auto split runs on the main card alone when it holds every profiled expert + KV

📊 Changes

5 files changed (+102 additions, -5 deletions)

View changed files

📝 CMakeLists.txt (+10 -0)
📝 include/strata/kernels/qsa_select.hpp (+1 -0)
📝 src/kernels/cuda/qsa_select.cu (+86 -1)
📝 src/kernels/qsa_select_bench.cpp (+3 -3)
📝 src/prefill/prefill.cpp (+2 -1)

📄 Description

What

Below sm_80 there is no TF32 tensor-core block scorer, so the prompt path's QSA selection scores blocks on the warp
kernel (4 products per lane, 5 shuffles): ~1 TFLOPS on an RTX 2080 Ti, 24-30% of a 128K prompt there.

qsa_block_scores_tc now runs an FP32 tiled GEMM on those cards (block_scores_simt_kernel): rows = query x indexer
head, K = 128 through shared memory, each thread 2 queries x 4 heads x 4 blocks, relu per head summed in registers.
~6.9 TFLOPS. The tail block keeps the tail kernel's arithmetic. Like the tensor-core scorer it is FP32 in another
summation order, so not bitwise equal to the warp kernel.

STRATA_SELECT_SIMT=0 (or the existing STRATA_SELECT_OLD=1) keeps the warp kernel.

qsa_select_bench is now also registered as a CUDA test: at 32K, and at 131K with STRATA_QSA_WARP=1 so the FP32
tiled scorer is exercised on any card. Gate: error vs an FP64 reference no worse than 4x the warp kernel's.

Measured

RTX 2080 Ti, qsa_select_bench (256 queries, capacity 262144):

context warp kernel FP32 tiled
32K 1.953 ms 0.303 ms (6.5x)
131K 7.831 ms 1.117 ms (7.0x)

Selections identical to the warp kernel's 256/256; FP64 error 5e-5 on a score scale of ~268. 4K-250K: 4.5-6.8x.

End to end, Swift 1.5 IQ3_XXS, same build A/B with STRATA_SELECT_SIMT=0 / unset, prefill tok/s: 128K 1016 -> 1242
(+22%), 248K 715 -> 952 (+33%), 32K +3%, 4K unchanged. qsa select at 128K: 29.9 s -> 6.4 s. Decode unchanged. (These runs had #741's FP16 path on as well.)

ctest on the 2080 Ti: qsa_topk_active_parity, qsa_select_bench, qsa_select_bench_fp32_tiled pass.

Only tested on sm_75. Independent of #741 and #743 (merges cleanly with both).

Developed with an AI coding assistant; all numbers measured on an RTX 2080 Ti 22 GB / i5-12490F / 64 GB.

🤖 Generated with Claude Code


🔄 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/742 **Author:** [@konijiwa110](https://github.com/konijiwa110) **Created:** 10/4/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `qsa-select-fp32-tiled-scores` --- ### 📝 Commits (10+) - [`b0dda4b`](https://github.com/Niko1221/Strata/commit/b0dda4b14886293575e5fe5c92e5ba6636adc4a1) AMD: gfx1101 (RX 7800 XT, #254 by jhohertz) and gfx1200 (RX 9060 XT, #256 by Efeisot) as community-validated cards - [`cc97fcd`](https://github.com/Niko1221/Strata/commit/cc97fcde526e1b2d4cbee39ba21e54a0ef7505b1) setup: AMD layer splits with --gpus (every chosen card a supported AMD arch; the engine compiled for each) - [`e9e2ba3`](https://github.com/Niko1221/Strata/commit/e9e2ba31abdc211a618b5faf7226732d40bbcf2b) pinned (#243 follow-up): the shared-memory-budget cap on the sliced pin is opt-in (STRATA_ARENA_PIN_GIB=auto) - by default the arena pins as in 0.1.30; on this 64 GB PC the cap pinned 26 instead of 30 GiB and cost ~20% prompt speed and 2-4% IQ3_S decode - [`cacffa9`](https://github.com/Niko1221/Strata/commit/cacffa95aff016939edd7c15534c0067ec0ee93c) CS-T speed: the file tier fetched in parallel, PCIe planning without file reads, a partial pin of the RAM tier, bit-exact AVX2 multi-token kernels for Q4_K / Q5_1 / Q8_0 experts, decode-only tier stats - [`a348c7a`](https://github.com/Niko1221/Strata/commit/a348c7a4ed64f5f7f24ce3f1cba2d1439f673fed) Merge branch 'f-131-srv' into r131-q4 - [`b93a00c`](https://github.com/Niko1221/Strata/commit/b93a00c65a21fcc5b6431b8091e348d2976259f0) Merge branch 'f-q4-on242' into r131-q4 - [`8f5148c`](https://github.com/Niko1221/Strata/commit/8f5148c14d34c404e8a2d6a45188088714f3c9bb) CS-T: the partial pin at most 24 GiB (STRATA_PARTIAL_PIN_GIB), the Q4_K/Q5_1/Q8_0 multi-token kernels from two tokens on - [`5ffda19`](https://github.com/Niko1221/Strata/commit/5ffda19098202b82943fc80281ce0eb34d8e08a3) CS-T: the GGUF-in-place prefetch asks Windows for all of a layer's missed slices at once (PrefetchVirtualMemory) - [`ed6c124`](https://github.com/Niko1221/Strata/commit/ed6c1244dcd31789007540cb9d8498fbd4134b7f) #253: the 8 GiB arena pin cap only under WDDM; STRATA_ARENA_PIN_GIB; the split's prompt chunk steps down - [`450149d`](https://github.com/Niko1221/Strata/commit/450149d3f248438d8a2526c600b5a75c3dbea6c6) --split-skip-if-fits (opt-in): an auto split runs on the main card alone when it holds every profiled expert + KV ### 📊 Changes **5 files changed** (+102 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+10 -0) 📝 `include/strata/kernels/qsa_select.hpp` (+1 -0) 📝 `src/kernels/cuda/qsa_select.cu` (+86 -1) 📝 `src/kernels/qsa_select_bench.cpp` (+3 -3) 📝 `src/prefill/prefill.cpp` (+2 -1) </details> ### 📄 Description ## What Below sm_80 there is no TF32 tensor-core block scorer, so the prompt path's QSA selection scores blocks on the warp kernel (4 products per lane, 5 shuffles): ~1 TFLOPS on an RTX 2080 Ti, 24-30% of a 128K prompt there. `qsa_block_scores_tc` now runs an FP32 tiled GEMM on those cards (`block_scores_simt_kernel`): rows = query x indexer head, K = 128 through shared memory, each thread 2 queries x 4 heads x 4 blocks, relu per head summed in registers. ~6.9 TFLOPS. The tail block keeps the tail kernel's arithmetic. Like the tensor-core scorer it is FP32 in another summation order, so not bitwise equal to the warp kernel. `STRATA_SELECT_SIMT=0` (or the existing `STRATA_SELECT_OLD=1`) keeps the warp kernel. `qsa_select_bench` is now also registered as a CUDA test: at 32K, and at 131K with `STRATA_QSA_WARP=1` so the FP32 tiled scorer is exercised on any card. Gate: error vs an FP64 reference no worse than 4x the warp kernel's. ## Measured RTX 2080 Ti, `qsa_select_bench` (256 queries, capacity 262144): | context | warp kernel | FP32 tiled | |---|---|---| | 32K | 1.953 ms | 0.303 ms (6.5x) | | 131K | 7.831 ms | 1.117 ms (7.0x) | Selections identical to the warp kernel's 256/256; FP64 error 5e-5 on a score scale of ~268. 4K-250K: 4.5-6.8x. End to end, Swift 1.5 IQ3_XXS, same build A/B with `STRATA_SELECT_SIMT=0` / unset, prefill tok/s: 128K 1016 -> 1242 (+22%), 248K 715 -> 952 (+33%), 32K +3%, 4K unchanged. `qsa select` at 128K: 29.9 s -> 6.4 s. Decode unchanged. (These runs had #741's FP16 path on as well.) ctest on the 2080 Ti: `qsa_topk_active_parity`, `qsa_select_bench`, `qsa_select_bench_fp32_tiled` pass. Only tested on sm_75. Independent of #741 and #743 (merges cleanly with both). Developed with an AI coding assistant; all numbers measured on an RTX 2080 Ti 22 GB / i5-12490F / 64 GB. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:03:13 +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#2801
No description provided.