[PR #3943] [CLOSED] [Engine] sm_6x prompt path: QSA attention without partials or the merge kernel, bitwise, prompt reads 2-3% faster on GP100 (opt-in, STRATA_PATTN_SM60=1) #4844

Closed
opened 2026-11-07 15:39:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3943
Author: @ruibeikaa
Created: 10/24/2026
Status: ❌ Closed

Base: main ← Head: pattn-sm60


📝 Commits (2)

  • 66df26e qsa_pattn: the prompt path's QSA attention on sm_6x without partials or the merge kernel (STRATA_PATTN_SM60=1, opt-in)
  • 61b5185 docs: OLDER_GPUS.md - STRATA_PATTN_SM60=1, the prompt path's QSA attention on sm_6x (opt-in)

📊 Changes

6 files changed (+2226 additions, -0 deletions)

View changed files

📝 CMakeLists.txt (+8 -0)
📝 docs/OLDER_GPUS.md (+7 -0)
➕ include/strata/kernels/qsa_pattn.hpp (+45 -0)
➕ src/kernels/cuda/qsa_pattn.cu (+1676 -0)
➕ src/kernels/pattn_bench.cu (+479 -0)
📝 src/prefill/prefill.cpp (+11 -0)

📄 Description

Problem and result

Measured on PH402 SKU 200 boards: four GP100 dies, 32 GB HBM2 each (128 GB in all), every expert resident in VRAM, no CPU share, no PCIe share.

Below sm_70 qsa_prompt_attn_batch returns false, so prefill.cpp reads every QSA layer's attention through the decode kernels: qsa_decode_attn_batch, 32 queries a call, one CTA per (64-cell chunk, KV head, query) of attn_chunk_kernel_pre75<1, 2> (#540's kernel), and every query's partials (33 chunks x 24 heads x 256 floats = 817 KB) written to the scratch and read back by attn_merge_kernel. For a 1,536-query prompt chunk that is 1.25 GB written and 1.25 GB read per layer. On a GP100 die both phases are bound by instruction issue, not by memory: the score phase spends ~150 instructions per cell (96 of them FFMA), mostly on reduce12's shuffles and the selects between them.

With STRATA_PATTN_SM60=1 that loop is replaced by qsa_pattn_batch: a score kernel and a value kernel per batch of ~100 queries, in the same attention scratch, with no partials and no merge kernel. Every output byte is qsa_decode_attn_batch's. One GP100 die, a 1,536-query chunk, 12 QSA layers, recorded block selections, fixed-seed int8 K/V, ms per layer (this branch, 3 repetitions each):

context qsa_decode_attn_batch, merge v1 (default) merge v2 (STRATA_ATTN_MERGE_V2=1) STRATA_PATTN_SM60=1 vs v1 vs v2
26K (real selections) 43.31 44.47 30.75 -29.0% -30.9%
88K (109K selections scaled) 43.30 44.45 30.95 -28.5% -30.4%
115K (real selections) 43.45 44.52 31.03 -28.6% -30.3%
0-1.5K (synthetic) 19.00 18.35 12.60 -33.7% -31.5%
1.5K-3K (synthetic) 41.97 41.95 29.28 -30.2% -30.2%

End to end on four GP100 dies, on a different revision (engine 0.1.47 plus my GP100 stack, details below), prompt reads took 1.8-3.2% less time from 7K to 150K tokens (8K -2.2%, 26K -3.0%, 33K -2.7%, an 88K append -3.1%, 150K -1.9% / -3.2% in two runs), decode was unchanged, and every reply hash was identical. Unset (the default) nothing changes.

Attention is only ~9-10% of a prompt read on this card (the experts and the QSA block selection, which this PR does not touch, are most of the rest), which is why a 30% faster attention gives 2-3% end to end.

No scope issue: an opt-in switch for one card family that leaves the default path alone. The bits are tied to #540's pre-Turing chunk kernel, which qsa_decode_attn_batch runs on sm_6x in the experimental build. Same card and setup as #3455, #3752 and #3867; this change is independent of them and applies to plain main.

Approach

  • src/kernels/cuda/qsa_pattn.cu, include/strata/kernels/qsa_pattn.hpp: pattn_mode() (reads STRATA_PATTN_SM60 once and says so on stderr) and qsa_pattn_batch().
    • ps_score_x_kernel, one CTA per (chunk, KV head, query), 256 threads: q in registers, loaded once in a per-lane slot order; the chunk's 64 K rows (codes and scales) staged in shared memory with 16-byte loads; two cells at a time through one reduce-scatter. In reduce12 the two lanes of an exchange send different slots, which costs ~30 selects per cell; here the lane-dependent part is moved into which head a register slot holds (fixed when q is loaded) and which cell counts as the first, so every lane keeps and sends the same slots: 25 shuffles, 25 adds and 4 selects per pair of cells instead of 2 x (15 + 15 + ~30). Each level's value on lane L is still "its partial on L + its partial on L xor o", the pairing of warp_sum, and the per-lane 8-dimension products, the dequantization (float) code * sc and * scale are the decode kernel's expressions. The chunk softmax is the decode kernel's (warp_max(fmaxf(a, b)), __expf(s - m), warp_sum(ea + eb)). It writes the chunk's probabilities, cell rows, m and l to the scratch.
    • ps_value_d4_kernel, one CTA per (KV head, query), 64 threads: 4 dims x 12 heads a thread, a cell's 4 V codes in one 32-bit load, the 12 weights in 3 broadcast float4 loads, the cells of a chunk folded in ascending order with fmaf as the decode kernel does. The merge is done while folding, in attn_merge_kernel's operations and order: M = fmaxf over the chunks' m, then per chunk in order w = __expf(m - M), L = fmaf(l, w, L), acc = fmaf(acc_c, w, acc), skipping chunks with m == -FLT_MAX, and finally L > 0 ? acc / L : 0. Merge v1 and v2 give the same bits, so the output equals either.
    • The batch size comes from the existing scratch (attn_batch x qsa_decode_attn_scratch_floats), so no VRAM is added.
  • src/prefill/prefill.cpp: four lines in front of the existing 32-query loop; when qsa_pattn_batch returns false the loop runs as before.
  • Gating: the kernels are compiled only in the CUDA build with STRATA_EXPERIMENTAL_SM60 (not HIP, not Metal; the call site is outside the Metal build). At run time only with STRATA_PATTN_SM60=1, on a compute capability 6.x device, with int8 K and V (no q4 pools), and cap <= 2,112 (33 chunks). Anything else returns false and nothing is launched.
  • Resources (ptxas, sm_60): ps_score_x_kernel 128 registers, 20,992 B shared, no spill, 2 CTAs per SM; ps_value_d4_kernel 143 registers, 8,388 B shared, no spill, 7 CTAs per SM.
  • src/kernels/pattn_bench.cu (-DSTRATA_PATTN_BENCH=ON, one GPU, no model): replays a STRATA_QSA_DUMP selection file with fixed-seed int8 K/V and queries, times qsa_decode_attn_batch exactly as prefill.cpp calls it, and memcmps every candidate's output against it, all 12 layers. qsa_pattn.cu also keeps the other variants I measured (a per-chunk kernel, a fused persistent kernel, register and shared-memory score phases, staged V) as bench-only variants; I can drop them from the PR if you prefer only the default.
  • docs/OLDER_GPUS.md: one bullet in the GP100 section.

Validation

Environment note: measured only on PH402 SKU 200 boards - four GP100 dies of 48 SMs and 32 GB HBM2 each (128 GB in all), application clocks 715 / 1050 MHz - with every expert resident in VRAM (no CPU share, no PCIe share, no adaptive tier). The single-die numbers use one of those dies.

Rig: Windows 11, driver 581.80 (TCC), CUDA 12.9, VS 2022; build -DSTRATA_EXPERIMENTAL_SM60=ON -DCMAKE_CUDA_ARCHITECTURES=60, ggml at the pinned 3cf03257f. Model: Swift 1.5 IQ3_S GGUF, --kv int8.

Passed:

  • This branch (main 8183c6b6 + this PR), one GP100 die, STRATA_SCORES_THREAD=1 PATTN_SPLIT=1463: pattn_bench <dump> 3 attn 26k,88k,115k,s0,s2k s1463, once with merge v1 (the default) and once with STRATA_ATTN_MERGE_V2=1. The dump holds the selections of 12 QSA layers of real prompt reads at 26K, 109K and 112K tokens (88K is the 109K record's blocks scaled; s0 / s2k are synthetic 0-1.5K and 1.5K-3K contexts, so a selection narrower than the cap, a partial last chunk and absent chunks are covered). Every case, both runs: parity split 1463 IDENTICAL (memcmp, 12 layers) (0 of 12 layers differ, 0 words), i.e. all 12 x 1,536 x 6,144 output floats equal to qsa_decode_attn_batch's, with merge v1 and with merge v2. The table above is from these two runs (the "with the switch" column from the merge v1 run; the merge v2 run gave the same times within 0.03 ms).
  • The same with PATTN_MASK_PAGES=3,100,2000,5000,6000,6400 (those pages unresident, page -1), cases 26k and s0: IDENTICAL on both (26K: 44.60 -> 30.89 ms per layer; 0-1.5K: 18.50 -> 12.88).
  • The comparison is not vacuous: during development, in the same bench, a timing variant that runs only one of the two kernels reported DIFFERENT on every run (about 110 million words differ).
  • Build: sm_60 with STRATA_EXPERIMENTAL_SM60 (strata, pattn_bench), clean.
  • End to end, four GP100 dies, not this branch's revision: engine 0.1.47 (main 011c9e60) plus about 35 opt-in GP100 commits of mine (#3455, #3752, a variant of #3867, --pipeline-windows 3 and others not posted), Swift 1.5 IQ3_S, 1M context, --layer-split 12,24,36, MTP, --kv int8, conversation cache on, the launcher's STRATA_SCORES_THREAD=1 STRATA_ATTN_MERGE_V2=1, one fresh engine per arm, 13 requests per arm (five short prompts, 8K / 26K / 88K-token contexts with 300-400 tokens of decode, 1K / 2K / 6.9K / 30K reads, a 151K read with 800 tokens of decode). Two runs. Every reply hash with the switch equal to the same stack's without this change (13/13 in both runs; the same build with the switch off matched too) and the draft acceptance identical. Prompt read time, without -> with (ms; without = the mean of its two clean runs, with = run 2): 1K 2,370 -> 2,359, 2K 3,175 -> 3,161, 6.9K 9,371 -> 9,206, 8K 11,490 -> 11,241, 26K 27,026 -> 26,219, 33K 33,881 -> 32,956, 88K append 84,045 -> 81,478, 150K 142,379 -> 139,680 (run 1: 137,752). Decode within 0.1 ms per window. VRAM per die unchanged. In an arm with this switch and two other opt-in items on, the state hashes after every request (GDN, KV, index, PLE, draft-layer K/V; with forced wrong guesses), after 8K / 26K / 88K reads among others, were equal to the arm without them on 8 of 8 requests.

Failed: none observed.

Not run:

  • HIP (gfx906), SYCL and Metal builds (no such machine here; the kernels are inside the STRATA_EXPERIMENTAL_SM60 CUDA-only guard and the call site is outside the Metal build). An sm_86 build without STRATA_EXPERIMENTAL_SM60 (the new file then compiles only the two stub functions).
  • An end-to-end run on this branch's own revision.
  • Compute capability 6.1 (P40, P4, GTX 10): the switch turns on there too (it checks major 6), but its output was compared with qsa_decode_attn_batch on GP100 only.
  • --kv modes other than int8 (the switch declines them), contexts whose selection cap exceeds 2,112 (declined).
  • A single Tesla P100 16 GB with experts partly in RAM (the attention does not depend on where the experts are, but that setup was not measured).

Limits

  • sm_6x, STRATA_EXPERIMENTAL_SM60 CUDA builds, int8 K/V, cap <= 2,112 only.
  • Measured only on PH402 dies with every expert resident in VRAM.
  • Attention is ~9-10% of a prompt read here, so the end-to-end gain is 2-3%; the QSA block selection (~8 ms per layer at 26K, ~24 ms at 115K for 1,536 queries) is unchanged.
  • A larger scratch would let the value kernel take bigger batches (in the bench, 3x the scratch: value kernel 13.0 -> 11.6 ms per layer, about 52 MB more per die); not done here, the scratch is the existing one.
  • pattn_bench needs a STRATA_QSA_DUMP file with records at the contexts its cases name.

CI note: the red metal-link check is not caused by this PR. The job fails while compiling upstream's metal/src/mtl_rt.mm (lines 69 and 92: MTLGPUFamilyMetal4, MTLCompileOptions.mathMode, MTLMathModeFast / MTLMathModeSafe), which the macos-14 runner's SDK does not provide. The workflow runs on any pull request that touches src/ or include/; this PR changes no file under metal/.


🔄 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/3943 **Author:** [@ruibeikaa](https://github.com/ruibeikaa) **Created:** 10/24/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pattn-sm60` --- ### 📝 Commits (2) - [`66df26e`](https://github.com/Niko1221/Strata/commit/66df26e54dae1c84653ea3ba9976159aeded6bd2) qsa_pattn: the prompt path's QSA attention on sm_6x without partials or the merge kernel (STRATA_PATTN_SM60=1, opt-in) - [`61b5185`](https://github.com/Niko1221/Strata/commit/61b5185c648f94fbc50eaa130df2239675d7eee9) docs: OLDER_GPUS.md - STRATA_PATTN_SM60=1, the prompt path's QSA attention on sm_6x (opt-in) ### 📊 Changes **6 files changed** (+2226 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+8 -0) 📝 `docs/OLDER_GPUS.md` (+7 -0) ➕ `include/strata/kernels/qsa_pattn.hpp` (+45 -0) ➕ `src/kernels/cuda/qsa_pattn.cu` (+1676 -0) ➕ `src/kernels/pattn_bench.cu` (+479 -0) 📝 `src/prefill/prefill.cpp` (+11 -0) </details> ### 📄 Description ## Problem and result **Measured on PH402 SKU 200 boards: four GP100 dies, 32 GB HBM2 each (128 GB in all), every expert resident in VRAM, no CPU share, no PCIe share.** Below sm_70 `qsa_prompt_attn_batch` returns false, so `prefill.cpp` reads every QSA layer's attention through the decode kernels: `qsa_decode_attn_batch`, 32 queries a call, one CTA per (64-cell chunk, KV head, query) of `attn_chunk_kernel_pre75<1, 2>` (#540's kernel), and every query's partials (33 chunks x 24 heads x 256 floats = 817 KB) written to the scratch and read back by `attn_merge_kernel`. For a 1,536-query prompt chunk that is 1.25 GB written and 1.25 GB read per layer. On a GP100 die both phases are bound by instruction issue, not by memory: the score phase spends ~150 instructions per cell (96 of them FFMA), mostly on `reduce12`'s shuffles and the selects between them. With `STRATA_PATTN_SM60=1` that loop is replaced by `qsa_pattn_batch`: a score kernel and a value kernel per batch of ~100 queries, in the same attention scratch, with no partials and no merge kernel. Every output byte is `qsa_decode_attn_batch`'s. One GP100 die, a 1,536-query chunk, 12 QSA layers, recorded block selections, fixed-seed int8 K/V, ms per layer (this branch, 3 repetitions each): | context | `qsa_decode_attn_batch`, merge v1 (default) | merge v2 (`STRATA_ATTN_MERGE_V2=1`) | `STRATA_PATTN_SM60=1` | vs v1 | vs v2 | |---|---:|---:|---:|---:|---:| | 26K (real selections) | 43.31 | 44.47 | **30.75** | -29.0% | -30.9% | | 88K (109K selections scaled) | 43.30 | 44.45 | **30.95** | -28.5% | -30.4% | | 115K (real selections) | 43.45 | 44.52 | **31.03** | -28.6% | -30.3% | | 0-1.5K (synthetic) | 19.00 | 18.35 | **12.60** | -33.7% | -31.5% | | 1.5K-3K (synthetic) | 41.97 | 41.95 | **29.28** | -30.2% | -30.2% | End to end on four GP100 dies, on a different revision (engine 0.1.47 plus my GP100 stack, details below), prompt reads took 1.8-3.2% less time from 7K to 150K tokens (8K -2.2%, 26K -3.0%, 33K -2.7%, an 88K append -3.1%, 150K -1.9% / -3.2% in two runs), decode was unchanged, and every reply hash was identical. Unset (the default) nothing changes. Attention is only ~9-10% of a prompt read on this card (the experts and the QSA block selection, which this PR does not touch, are most of the rest), which is why a 30% faster attention gives 2-3% end to end. ## Related discussion No scope issue: an opt-in switch for one card family that leaves the default path alone. The bits are tied to #540's pre-Turing chunk kernel, which `qsa_decode_attn_batch` runs on sm_6x in the experimental build. Same card and setup as #3455, #3752 and #3867; this change is independent of them and applies to plain main. ## Approach - `src/kernels/cuda/qsa_pattn.cu`, `include/strata/kernels/qsa_pattn.hpp`: `pattn_mode()` (reads `STRATA_PATTN_SM60` once and says so on stderr) and `qsa_pattn_batch()`. - `ps_score_x_kernel`, one CTA per (chunk, KV head, query), 256 threads: q in registers, loaded once in a per-lane slot order; the chunk's 64 K rows (codes and scales) staged in shared memory with 16-byte loads; two cells at a time through one reduce-scatter. In `reduce12` the two lanes of an exchange send different slots, which costs ~30 selects per cell; here the lane-dependent part is moved into which head a register slot holds (fixed when q is loaded) and which cell counts as the first, so every lane keeps and sends the same slots: 25 shuffles, 25 adds and 4 selects per pair of cells instead of 2 x (15 + 15 + ~30). Each level's value on lane L is still "its partial on L + its partial on L xor o", the pairing of `warp_sum`, and the per-lane 8-dimension products, the dequantization `(float) code * sc` and `* scale` are the decode kernel's expressions. The chunk softmax is the decode kernel's (`warp_max(fmaxf(a, b))`, `__expf(s - m)`, `warp_sum(ea + eb)`). It writes the chunk's probabilities, cell rows, m and l to the scratch. - `ps_value_d4_kernel`, one CTA per (KV head, query), 64 threads: 4 dims x 12 heads a thread, a cell's 4 V codes in one 32-bit load, the 12 weights in 3 broadcast float4 loads, the cells of a chunk folded in ascending order with `fmaf` as the decode kernel does. The merge is done while folding, in `attn_merge_kernel`'s operations and order: M = fmaxf over the chunks' m, then per chunk in order w = `__expf(m - M)`, L = fmaf(l, w, L), acc = fmaf(acc_c, w, acc), skipping chunks with m == -FLT_MAX, and finally L > 0 ? acc / L : 0. Merge v1 and v2 give the same bits, so the output equals either. - The batch size comes from the existing scratch (`attn_batch x qsa_decode_attn_scratch_floats`), so no VRAM is added. - `src/prefill/prefill.cpp`: four lines in front of the existing 32-query loop; when `qsa_pattn_batch` returns false the loop runs as before. - Gating: the kernels are compiled only in the CUDA build with `STRATA_EXPERIMENTAL_SM60` (not HIP, not Metal; the call site is outside the Metal build). At run time only with `STRATA_PATTN_SM60=1`, on a compute capability 6.x device, with int8 K and V (no q4 pools), and cap <= 2,112 (33 chunks). Anything else returns false and nothing is launched. - Resources (ptxas, sm_60): `ps_score_x_kernel` 128 registers, 20,992 B shared, no spill, 2 CTAs per SM; `ps_value_d4_kernel` 143 registers, 8,388 B shared, no spill, 7 CTAs per SM. - `src/kernels/pattn_bench.cu` (`-DSTRATA_PATTN_BENCH=ON`, one GPU, no model): replays a `STRATA_QSA_DUMP` selection file with fixed-seed int8 K/V and queries, times `qsa_decode_attn_batch` exactly as `prefill.cpp` calls it, and memcmps every candidate's output against it, all 12 layers. `qsa_pattn.cu` also keeps the other variants I measured (a per-chunk kernel, a fused persistent kernel, register and shared-memory score phases, staged V) as bench-only variants; I can drop them from the PR if you prefer only the default. - `docs/OLDER_GPUS.md`: one bullet in the GP100 section. ## Validation **Environment note: measured only on PH402 SKU 200 boards - four GP100 dies of 48 SMs and 32 GB HBM2 each (128 GB in all), application clocks 715 / 1050 MHz - with every expert resident in VRAM (no CPU share, no PCIe share, no adaptive tier).** The single-die numbers use one of those dies. Rig: Windows 11, driver 581.80 (TCC), CUDA 12.9, VS 2022; build `-DSTRATA_EXPERIMENTAL_SM60=ON -DCMAKE_CUDA_ARCHITECTURES=60`, ggml at the pinned 3cf03257f. Model: Swift 1.5 IQ3_S GGUF, `--kv int8`. **Passed:** - This branch (main 8183c6b6 + this PR), one GP100 die, `STRATA_SCORES_THREAD=1 PATTN_SPLIT=1463`: `pattn_bench <dump> 3 attn 26k,88k,115k,s0,s2k s1463`, once with merge v1 (the default) and once with `STRATA_ATTN_MERGE_V2=1`. The dump holds the selections of 12 QSA layers of real prompt reads at 26K, 109K and 112K tokens (88K is the 109K record's blocks scaled; s0 / s2k are synthetic 0-1.5K and 1.5K-3K contexts, so a selection narrower than the cap, a partial last chunk and absent chunks are covered). Every case, both runs: `parity split 1463 IDENTICAL (memcmp, 12 layers) (0 of 12 layers differ, 0 words)`, i.e. all 12 x 1,536 x 6,144 output floats equal to `qsa_decode_attn_batch`'s, with merge v1 and with merge v2. The table above is from these two runs (the "with the switch" column from the merge v1 run; the merge v2 run gave the same times within 0.03 ms). - The same with `PATTN_MASK_PAGES=3,100,2000,5000,6000,6400` (those pages unresident, page -1), cases 26k and s0: IDENTICAL on both (26K: 44.60 -> 30.89 ms per layer; 0-1.5K: 18.50 -> 12.88). - The comparison is not vacuous: during development, in the same bench, a timing variant that runs only one of the two kernels reported DIFFERENT on every run (about 110 million words differ). - Build: sm_60 with `STRATA_EXPERIMENTAL_SM60` (`strata`, `pattn_bench`), clean. - End to end, four GP100 dies, **not this branch's revision**: engine 0.1.47 (main 011c9e60) plus about 35 opt-in GP100 commits of mine (#3455, #3752, a variant of #3867, `--pipeline-windows 3` and others not posted), Swift 1.5 IQ3_S, 1M context, `--layer-split 12,24,36`, MTP, `--kv int8`, conversation cache on, the launcher's `STRATA_SCORES_THREAD=1 STRATA_ATTN_MERGE_V2=1`, one fresh engine per arm, 13 requests per arm (five short prompts, 8K / 26K / 88K-token contexts with 300-400 tokens of decode, 1K / 2K / 6.9K / 30K reads, a 151K read with 800 tokens of decode). Two runs. Every reply hash with the switch equal to the same stack's without this change (13/13 in both runs; the same build with the switch off matched too) and the draft acceptance identical. Prompt read time, without -> with (ms; without = the mean of its two clean runs, with = run 2): 1K 2,370 -> 2,359, 2K 3,175 -> 3,161, 6.9K 9,371 -> 9,206, 8K 11,490 -> 11,241, 26K 27,026 -> 26,219, 33K 33,881 -> 32,956, 88K append 84,045 -> 81,478, 150K 142,379 -> 139,680 (run 1: 137,752). Decode within 0.1 ms per window. VRAM per die unchanged. In an arm with this switch and two other opt-in items on, the state hashes after every request (GDN, KV, index, PLE, draft-layer K/V; with forced wrong guesses), after 8K / 26K / 88K reads among others, were equal to the arm without them on 8 of 8 requests. **Failed:** none observed. **Not run:** - HIP (gfx906), SYCL and Metal builds (no such machine here; the kernels are inside the `STRATA_EXPERIMENTAL_SM60` CUDA-only guard and the call site is outside the Metal build). An sm_86 build without `STRATA_EXPERIMENTAL_SM60` (the new file then compiles only the two stub functions). - An end-to-end run on this branch's own revision. - Compute capability 6.1 (P40, P4, GTX 10): the switch turns on there too (it checks major 6), but its output was compared with `qsa_decode_attn_batch` on GP100 only. - `--kv` modes other than int8 (the switch declines them), contexts whose selection cap exceeds 2,112 (declined). - A single Tesla P100 16 GB with experts partly in RAM (the attention does not depend on where the experts are, but that setup was not measured). ## Limits - sm_6x, `STRATA_EXPERIMENTAL_SM60` CUDA builds, int8 K/V, cap <= 2,112 only. - Measured only on PH402 dies with every expert resident in VRAM. - Attention is ~9-10% of a prompt read here, so the end-to-end gain is 2-3%; the QSA block selection (~8 ms per layer at 26K, ~24 ms at 115K for 1,536 queries) is unchanged. - A larger scratch would let the value kernel take bigger batches (in the bench, 3x the scratch: value kernel 13.0 -> 11.6 ms per layer, about 52 MB more per die); not done here, the scratch is the existing one. - `pattn_bench` needs a `STRATA_QSA_DUMP` file with records at the contexts its cases name. **CI note:** the red `metal-link` check is not caused by this PR. The job fails while compiling upstream's `metal/src/mtl_rt.mm` (lines 69 and 92: `MTLGPUFamilyMetal4`, `MTLCompileOptions.mathMode`, `MTLMathModeFast` / `MTLMathModeSafe`), which the `macos-14` runner's SDK does not provide. The workflow runs on any pull request that touches `src/` or `include/`; this PR changes no file under `metal/`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:39:25 +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#4844
No description provided.