Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

bench/results: V100 decode kernels (GPU work per verify window 22.8 -> 21.2 ms); docs/NVIDIA_V100.md: the decode side; tools/ab_engine.py

NoxestNozb04507c12fc4
diff --git a/bench/results/2026-10-07-v100-decode-kernels/README.md b/bench/results/2026-10-07-v100-decode-kernels/README.md
new file mode 100644
index 000000000..f69d1ac62
--- /dev/null
+++ b/bench/results/2026-10-07-v100-decode-kernels/README.md
@@ -0,0 +1,102 @@
+# V100 (sm_70): three decode kernels that were built for other cards (2026-10-07)
+
+On a V100 a verify window's GPU work is mostly memory-bound GEMVs that ran at a third to a half of the card's HBM2
+bandwidth. Three kernels Strata already has for other cards are now Volta's defaults, each with exactly the old
+arithmetic, so every output is bitwise the old one:
+
+| What | Was on sm_70 | Now on sm_70 | Switch (old path) |
+| --- | --- | --- | --- |
+| Routed experts in VRAM (`native_expert_grouped`) | the CUDA layout (mode 0) | gfx906's mode 8: the codebook grid and the group's q8_1 activations in shared memory, SwiGLU + q8_1 in the gate/up epilogue; IQ2_XXS gate/up added to it (CUDA only) | `STRATA_EXP_MODE=0` |
+| Dense 2-4 column GEMVs and the head (`native_mmvq_il`) | `native_mmvq` (the interleaved kernel was sm_80+) | the interleaved kernel with a rows table read off a V100 | `STRATA_MMVQ_IL=0` |
+| Hyper-connection read, up projection | `gr_up_multi_kernel` | gfx906's `gr_up_fast_kernel` (built for CUDA, now also writes the QFUSE q8_1 tail) | `STRATA_GR_FAST=0` |
+
+Every other card keeps what it ran: the new paths are picked only when the device is sm_70 (and gfx906 keeps its own
+defaults). The idea of putting the lattice codebook in shared memory on Volta comes from 1Cat-vLLM's SM70 GGUF kernels
+(`csrc/sm70_turbomind/ops/gguf_dp4a.cuh`); Strata's gfx906 kernels already did the same, so no 1Cat code was copied.
+
+## Rig
+
+- Tesla V100-SXM2-32GB (sm_70, PCIe gen3 x16), driver 580.159, a rented container (vast.ai): 2x Xeon Gold 6130, a
+ cgroup quota of ~15 CPUs, 180 GB RAM. CUDA 12.8, GCC 11.4, Ubuntu 22.04.
+- Engine: `main` at `e8ca9af` (0.1.40.2) with this change, `-DCMAKE_CUDA_ARCHITECTURES=70 -DSTRATA_EXPERIMENTAL_SM60=ON`.
+- Model: setup's IQ2_XS (`./setup.sh --cuda 12 --build --model IQ2_XS`), setup's config (`--spec 4 --kv int8
+ --kv-resident 32768 --max-context 131072 --expert-cache auto`) plus `--pool-workers 14` (the container's quota; with
+ setup's default of 32 workers the pool is throttled and decode halves).
+
+## Kernels (synthetic or real rows, no engine)
+
+**Experts**, `native_expert_bench <shard1> <layers> 28 T 0 8` (28 groups = a verify window's VRAM call, the model's
+real rows; mode 0 vs mode 8, bitwise equal on all 48 layers):
+
+| Layer gate/up / down | T = 1 | T = 3 |
+| --- | ---: | ---: |
+| IQ2_S / Q2_0 (34 layers, e.g. 24) | 118.5 -> 104.8 us | 180.4 -> 150.4 us |
+| IQ2_XXS / Q2_0 (11 layers, e.g. 10) | 117.6 -> 91.4 us | 169.9 -> 134.1 us |
+| IQ1_M / Q2_0 (3 layers; gate/up keeps the CUDA layout) | | 159.0 -> 144.7 us |
+
+A strided call (the window's PCIe call, `grid_groups` 1..cap) keeps the CUDA layout: the AMD layouts launch a block
+row per possible group, which cost the empty call 11.3 vs 6.5 us. A format without a shared-memory kernel falls back
+to the CUDA layout on CUDA, not to R2 (R2 on IQ2_XXS gate/up: 183 vs 113 us). The nib_mask sign handling gfx906 uses
+was also the faster one here (158.5 vs 162.2 us on `native_grouped_parity --bench`'s VRAM call).
+
+**Dense GEMVs**, `mmvq_il_parity --bench` (two runs, mean; `il_rows1/2/4` all bitwise `native_mmvq`'s output), a few
+of the cells the table picks (3 columns):
+
+| Shape | `native_mmvq` | interleaved |
+| --- | ---: | ---: |
+| Q5_K head 2560 x 248,320 | 1,094 us | 821 us (rows 2) |
+| Q6_K 2560 x 12,288 | 68.9 us | 47.9 us (rows 2) |
+| Q4_K 2560 x 10,240 | 43.9 us | 32.5 us (rows 2) |
+| IQ4_XS 2560 x 6,144 | 28.2 us | 19.3 us (rows 2) |
+| Q6_K 2560 x 512 | 7.0 us | 9.2 us (rows 2): the table keeps `native_mmvq` below 2,048 rows |
+
+**Hyper-connection read**, `fused_gr_bench` (bitwise): the fast norm/up take 4-6 us off a 51-72 us read in the
+plain variant. The engine runs the staged variant, whose norm is the split one, so only the up projection changes
+there (below).
+
+## Engine: GPU time per verify window
+
+`STRATA_DECODE_TIMING=1 STRATA_VERIFY_PROFILE=1`, `tools/ab_engine.py`: one server start per arm and round, the arms'
+order alternating, 3 rounds; per round three short chats (256 tokens) and one 6,345-token prompt (122-128 tokens).
+`orig` is `e8ca9af` as setup built it, `off` this branch with the three switches above set to the old paths, `v70`
+this branch. Medians over the rounds of the engine's own stage table (ms per window, GDN + QSA layers):
+
+| Stage | orig | off | v70 |
+| --- | ---: | ---: | ---: |
+| VRAM hits (routed experts) | 4.50 | 4.44 | 3.73 |
+| q8 + qkv / q-idx GEMV | 1.60 | 1.57 | 1.40 |
+| z | 1.03 | 1.02 | 0.87 |
+| head | 0.99 | 0.97 | 0.69 |
+| hc-read0 up | 1.08 | 1.08 | 0.96 |
+| q + q-idx | 0.76 | 0.75 | 0.68 |
+| out-proj | 1.35 | 1.34 | 1.40 |
+| everything else on the GPU | 11.49 | 11.49 | 11.51 |
+| **GPU work, the waits (A, B, CPU) left out** | **22.80** | **22.66** | **21.24 (-6.8%)** |
+
+Decode tokens per second over the same runs (medians):
+
+| Request | orig | off | v70 |
+| --- | ---: | ---: | ---: |
+| chat 0 | 65.8 | 67.1 | 74.7 |
+| chat 1 | 55.0 | 58.1 | 62.7 |
+| chat 2 | 57.1 | 58.0 | 59.7 |
+| 6,345-token prompt | 52.3 | 48.7 | 52.5 |
+
+**These decode numbers are noisy and mostly CPU-bound on this rig**: the windows' `waitCPU` (the GPU waiting for the
+CPU experts) was 0.3 ms in some server starts and 6-9 ms in others, whatever the arm, which moves decode by 25-30%.
+The GPU-side table above is the reliable comparison; on a PC whose CPU keeps up, the window is shorter by about the
+1.5 ms it saves. Prompt speed (1,360-1,390 tok/s) does not change: the prompt path uses none of these kernels.
+
+## Output checks
+
+Each change keeps the old sums in the old order, so the engine's output is unchanged by construction; checked with:
+
+- `native_expert_bench` on all 48 layers of the IQ2_XS shard, T = 1-4: mode 8 bitwise mode 0.
+- `native_grouped_parity` (every gate/up x down format, window shapes, `STRATA_EXP_MODE` 0, 2, 7, 8): 0 failures.
+- `mmvq_il_parity`: OK (every case, T 2-4, rows 1/2/4 and the table, bitwise); `mmvq_multi_parity`: ok.
+- `fused_gr_bench` (fast vs old, bitwise), `gr_multi_parity` OK, `gr_parity` 0 failures.
+- The whole `ctest` on the V100 (`-DSTRATA_BUILD_TESTS=ON`): 124 passed, 2 skipped (`prefill_fused_*`, sm_80+), 3 failed
+ for this rig, not the change: `expert_multi_test` (the CPU has no AVX512-VNNI), `platform_memory_test` (`mlock` in
+ the container), `ple_parity` (wants the Q2_0 pack's second shard; this rig has IQ2_XS).
+
+Raw: `stage-profile.txt` (the engine's stage lines of every run above), `mmvq-il-bench-v100.txt` (both bench runs).
diff --git a/bench/results/2026-10-07-v100-decode-kernels/mmvq-il-bench-v100.txt b/bench/results/2026-10-07-v100-decode-kernels/mmvq-il-bench-v100.txt
new file mode 100644
index 000000000..5ee5f9eb1
--- /dev/null
+++ b/bench/results/2026-10-07-v100-decode-kernels/mmvq-il-bench-v100.txt
@@ -0,0 +1,96 @@
+BENCH IQ4_XS 2560x10240 T=2 multi 33.3 us | il rows1 28.9 rows2 25.3 rows4 26.7 us
+BENCH IQ4_XS 2560x10240 T=3 multi 42.4 us | il rows1 29.9 rows2 26.8 rows4 28.3 us
+BENCH IQ4_XS 2560x10240 T=4 multi 52.6 us | il rows1 32.2 rows2 30.7 rows4 33.0 us
+BENCH IQ4_XS 2560x6144 T=2 multi 22.5 us | il rows1 19.7 rows2 17.8 rows4 21.5 us
+BENCH IQ4_XS 2560x6144 T=3 multi 27.2 us | il rows1 20.5 rows2 18.9 rows4 19.9 us
+BENCH IQ4_XS 2560x6144 T=4 multi 33.7 us | il rows1 21.6 rows2 21.0 rows4 22.8 us
+BENCH IQ4_XS 4096x2560 T=2 multi 14.0 us | il rows1 13.8 rows2 10.8 rows4 13.7 us
+BENCH IQ4_XS 4096x2560 T=3 multi 16.6 us | il rows1 13.7 rows2 10.8 rows4 13.3 us
+BENCH IQ4_XS 4096x2560 T=4 multi 19.7 us | il rows1 15.3 rows2 13.6 rows4 12.6 us
+BENCH IQ4_XS 2560x512 T=2 multi 5.0 us | il rows1 6.1 rows2 5.4 rows4 9.4 us
+BENCH IQ4_XS 2560x512 T=3 multi 5.5 us | il rows1 5.7 rows2 5.9 rows4 7.9 us
+BENCH IQ4_XS 2560x512 T=4 multi 6.1 us | il rows1 6.2 rows2 6.2 rows4 8.2 us
+BENCH Q4_K 2560x10240 T=2 multi 36.5 us | il rows1 31.2 rows2 29.0 rows4 25.6 us
+BENCH Q4_K 2560x10240 T=3 multi 43.7 us | il rows1 38.2 rows2 32.5 rows4 39.9 us
+BENCH Q4_K 2560x10240 T=4 multi 54.5 us | il rows1 41.9 rows2 38.2 rows4 50.8 us
+BENCH Q4_K 4096x2560 T=2 multi 15.2 us | il rows1 18.4 rows2 13.3 rows4 14.5 us
+BENCH Q4_K 4096x2560 T=3 multi 17.7 us | il rows1 18.8 rows2 14.0 rows4 24.9 us
+BENCH Q4_K 4096x2560 T=4 multi 21.0 us | il rows1 20.0 rows2 15.5 rows4 25.0 us
+BENCH Q4_K odd rows 2560x2051 T=2 multi 10.4 us | il rows1 11.5 rows2 9.0 rows4 9.9 us
+BENCH Q4_K odd rows 2560x2051 T=3 multi 11.9 us | il rows1 12.6 rows2 9.4 rows4 16.3 us
+BENCH Q4_K odd rows 2560x2051 T=4 multi 14.3 us | il rows1 13.2 rows2 10.6 rows4 16.2 us
+BENCH Q5_K 2560x12288 T=2 multi 46.5 us | il rows1 42.5 rows2 37.0 rows4 40.1 us
+BENCH Q5_K 2560x12288 T=3 multi 55.8 us | il rows1 50.5 rows2 42.0 rows4 46.3 us
+BENCH Q5_K 2560x12288 T=4 multi 70.6 us | il rows1 57.8 rows2 54.9 rows4 69.6 us
+BENCH Q5_K 2560x6144 T=2 multi 26.9 us | il rows1 25.4 rows2 23.1 rows4 26.5 us
+BENCH Q5_K 2560x6144 T=3 multi 30.7 us | il rows1 29.2 rows2 24.9 rows4 26.4 us
+BENCH Q5_K 2560x6144 T=4 multi 36.5 us | il rows1 30.1 rows2 29.8 rows4 36.5 us
+BENCH Q5_K 4096x2560 T=2 multi 17.4 us | il rows1 18.9 rows2 15.1 rows4 18.9 us
+BENCH Q5_K 4096x2560 T=3 multi 19.5 us | il rows1 21.4 rows2 16.0 rows4 18.7 us
+BENCH Q5_K 4096x2560 T=4 multi 22.4 us | il rows1 19.6 rows2 22.2 rows4 27.0 us
+BENCH Q5_K head 2560x248320 T=2 multi 882.1 us | il rows1 818.3 rows2 713.2 rows4 716.5 us
+BENCH Q5_K head 2560x248320 T=3 multi 1094.5 us | il rows1 922.6 rows2 820.9 rows4 828.8 us
+BENCH Q5_K head 2560x248320 T=4 multi 1378.2 us | il rows1 1096.8 rows2 1027.3 rows4 1172.5 us
+BENCH Q6_K 2560x12288 T=2 multi 57.3 us | il rows1 51.0 rows2 52.7 rows4 70.7 us
+BENCH Q6_K 2560x12288 T=3 multi 69.4 us | il rows1 59.9 rows2 48.5 rows4 64.4 us
+BENCH Q6_K 2560x12288 T=4 multi 81.0 us | il rows1 64.2 rows2 58.3 rows4 63.2 us
+BENCH Q6_K 2560x10240 T=2 multi 50.8 us | il rows1 45.0 rows2 49.6 rows4 69.1 us
+BENCH Q6_K 2560x10240 T=3 multi 58.5 us | il rows1 52.3 rows2 43.4 rows4 50.5 us
+BENCH Q6_K 2560x10240 T=4 multi 67.9 us | il rows1 54.6 rows2 51.8 rows4 51.1 us
+BENCH Q6_K 4096x2560 T=2 multi 20.3 us | il rows1 19.7 rows2 24.1 rows4 43.6 us
+BENCH Q6_K 4096x2560 T=3 multi 23.9 us | il rows1 32.3 rows2 19.3 rows4 28.1 us
+BENCH Q6_K 4096x2560 T=4 multi 25.8 us | il rows1 29.6 rows2 22.6 rows4 24.3 us
+BENCH Q6_K odd rows 2560x2051 T=2 multi 13.1 us | il rows1 11.7 rows2 15.0 rows4 27.0 us
+BENCH Q6_K odd rows 2560x2051 T=3 multi 14.3 us | il rows1 13.4 rows2 12.1 rows4 17.8 us
+BENCH Q6_K odd rows 2560x2051 T=4 multi 16.9 us | il rows1 17.5 rows2 14.0 rows4 15.2 us
+BENCH Q6_K 2560x512 T=2 multi 6.7 us | il rows1 9.0 rows2 11.4 rows4 23.7 us
+BENCH Q6_K 2560x512 T=3 multi 7.0 us | il rows1 11.4 rows2 9.1 rows4 15.5 us
+BENCH Q6_K 2560x512 T=4 multi 7.3 us | il rows1 9.2 rows2 10.2 rows4 14.4 us
+BENCH IQ4_XS 2560x10240 T=2 multi 33.2 us | il rows1 28.8 rows2 25.3 rows4 26.6 us
+BENCH IQ4_XS 2560x10240 T=3 multi 42.6 us | il rows1 30.1 rows2 26.9 rows4 28.7 us
+BENCH IQ4_XS 2560x10240 T=4 multi 53.9 us | il rows1 32.3 rows2 31.0 rows4 33.7 us
+BENCH IQ4_XS 2560x6144 T=2 multi 22.2 us | il rows1 20.0 rows2 17.6 rows4 21.4 us
+BENCH IQ4_XS 2560x6144 T=3 multi 26.9 us | il rows1 20.3 rows2 18.6 rows4 19.9 us
+BENCH IQ4_XS 2560x6144 T=4 multi 33.4 us | il rows1 21.4 rows2 20.7 rows4 22.5 us
+BENCH IQ4_XS 4096x2560 T=2 multi 14.0 us | il rows1 13.8 rows2 10.7 rows4 13.5 us
+BENCH IQ4_XS 4096x2560 T=3 multi 16.5 us | il rows1 13.4 rows2 10.8 rows4 13.2 us
+BENCH IQ4_XS 4096x2560 T=4 multi 19.5 us | il rows1 15.3 rows2 13.5 rows4 12.4 us
+BENCH IQ4_XS 2560x512 T=2 multi 5.0 us | il rows1 6.0 rows2 5.3 rows4 9.4 us
+BENCH IQ4_XS 2560x512 T=3 multi 5.6 us | il rows1 5.7 rows2 5.9 rows4 7.9 us
+BENCH IQ4_XS 2560x512 T=4 multi 6.1 us | il rows1 6.1 rows2 6.2 rows4 8.2 us
+BENCH Q4_K 2560x10240 T=2 multi 36.3 us | il rows1 31.1 rows2 29.0 rows4 25.6 us
+BENCH Q4_K 2560x10240 T=3 multi 43.0 us | il rows1 38.5 rows2 32.1 rows4 39.4 us
+BENCH Q4_K 2560x10240 T=4 multi 55.1 us | il rows1 41.0 rows2 37.5 rows4 51.1 us
+BENCH Q4_K 4096x2560 T=2 multi 15.1 us | il rows1 18.3 rows2 13.3 rows4 14.5 us
+BENCH Q4_K 4096x2560 T=3 multi 17.7 us | il rows1 18.8 rows2 14.0 rows4 24.9 us
+BENCH Q4_K 4096x2560 T=4 multi 21.1 us | il rows1 20.0 rows2 15.6 rows4 25.0 us
+BENCH Q4_K odd rows 2560x2051 T=2 multi 10.4 us | il rows1 11.5 rows2 9.1 rows4 9.9 us
+BENCH Q4_K odd rows 2560x2051 T=3 multi 11.9 us | il rows1 12.7 rows2 9.4 rows4 16.3 us
+BENCH Q4_K odd rows 2560x2051 T=4 multi 14.4 us | il rows1 13.2 rows2 10.6 rows4 16.3 us
+BENCH Q5_K 2560x12288 T=2 multi 46.2 us | il rows1 42.6 rows2 37.0 rows4 39.6 us
+BENCH Q5_K 2560x12288 T=3 multi 55.8 us | il rows1 50.6 rows2 42.5 rows4 46.5 us
+BENCH Q5_K 2560x12288 T=4 multi 68.6 us | il rows1 57.1 rows2 54.4 rows4 69.4 us
+BENCH Q5_K 2560x6144 T=2 multi 25.6 us | il rows1 24.8 rows2 22.6 rows4 25.4 us
+BENCH Q5_K 2560x6144 T=3 multi 30.0 us | il rows1 27.7 rows2 23.7 rows4 25.1 us
+BENCH Q5_K 2560x6144 T=4 multi 36.9 us | il rows1 29.7 rows2 29.9 rows4 36.7 us
+BENCH Q5_K 4096x2560 T=2 multi 17.4 us | il rows1 18.9 rows2 15.1 rows4 18.8 us
+BENCH Q5_K 4096x2560 T=3 multi 19.5 us | il rows1 21.4 rows2 16.0 rows4 18.6 us
+BENCH Q5_K 4096x2560 T=4 multi 22.8 us | il rows1 19.5 rows2 22.6 rows4 27.4 us
+BENCH Q5_K head 2560x248320 T=2 multi 882.1 us | il rows1 816.8 rows2 713.1 rows4 715.5 us
+BENCH Q5_K head 2560x248320 T=3 multi 1105.0 us | il rows1 930.4 rows2 820.9 rows4 833.2 us
+BENCH Q5_K head 2560x248320 T=4 multi 1378.6 us | il rows1 1096.7 rows2 1024.5 rows4 1177.9 us
+BENCH Q6_K 2560x12288 T=2 multi 58.4 us | il rows1 53.4 rows2 54.9 rows4 72.9 us
+BENCH Q6_K 2560x12288 T=3 multi 69.9 us | il rows1 60.4 rows2 48.5 rows4 64.8 us
+BENCH Q6_K 2560x12288 T=4 multi 80.9 us | il rows1 64.6 rows2 58.4 rows4 63.3 us
+BENCH Q6_K 2560x10240 T=2 multi 47.2 us | il rows1 42.7 rows2 47.4 rows4 65.7 us
+BENCH Q6_K 2560x10240 T=3 multi 57.6 us | il rows1 49.1 rows2 41.8 rows4 49.1 us
+BENCH Q6_K 2560x10240 T=4 multi 68.0 us | il rows1 54.5 rows2 51.9 rows4 51.2 us
+BENCH Q6_K 4096x2560 T=2 multi 20.8 us | il rows1 20.1 rows2 24.6 rows4 44.7 us
+BENCH Q6_K 4096x2560 T=3 multi 24.5 us | il rows1 33.3 rows2 19.8 rows4 28.7 us
+BENCH Q6_K 4096x2560 T=4 multi 27.1 us | il rows1 30.5 rows2 23.1 rows4 25.3 us
+BENCH Q6_K odd rows 2560x2051 T=2 multi 13.3 us | il rows1 11.8 rows2 15.0 rows4 27.3 us
+BENCH Q6_K odd rows 2560x2051 T=3 multi 14.6 us | il rows1 13.5 rows2 12.2 rows4 18.0 us
+BENCH Q6_K odd rows 2560x2051 T=4 multi 16.9 us | il rows1 17.7 rows2 14.1 rows4 15.4 us
+BENCH Q6_K 2560x512 T=2 multi 6.7 us | il rows1 9.1 rows2 11.3 rows4 23.7 us
+BENCH Q6_K 2560x512 T=3 multi 7.0 us | il rows1 11.5 rows2 9.1 rows4 15.5 us
+BENCH Q6_K 2560x512 T=4 multi 7.4 us | il rows1 9.3 rows2 10.3 rows4 14.4 us
diff --git a/bench/results/2026-10-07-v100-decode-kernels/stage-profile.txt b/bench/results/2026-10-07-v100-decode-kernels/stage-profile.txt
new file mode 100644
index 000000000..13f0c22be
--- /dev/null
+++ b/bench/results/2026-10-07-v100-decode-kernels/stage-profile.txt
@@ -0,0 +1,9 @@
+ab_off_r0.log strata decode GPU stages (ms/window): GDN layers: q8+qkv/q-idx gemv 1.54 conv 0.18 ab 0.36 z 1.00 rec 0.49 out-proj 0.96 hc-read1+router 2.80 shared+quant 1.30 waitA 1.90 VRAM hits 3.18 waitB 0.45 PCIe grp 0.31 waitCPU 6.28 copy+combine 0.49 (gap) 0.05 head 0.95 hc0 norm 0.47 hc0 down 0.77 hc0 up 0.78 | QSA layers: q8+kv-idx 0.11 k/v+norm-rope 0.23 kv+idx append 0.16 q+q-idx 0.73 scores+topk 0.56 kv-resolve 0.34 attention 0.60 gate 0.05 out-proj 0.36 hc-read1+router 0.96 shared+quant 0.44 waitA 0.15 VRAM hits 1.04 waitB 0.19 PCIe grp 0.11 waitCPU 2.90 copy+combine 0.17 (gap) 0.02 hc0 norm 0.10 hc0 down 0.26 hc0 up 0.26 | total 34.01 ms/window over 62 windows
+ab_off_r1.log strata decode GPU stages (ms/window): GDN layers: q8+qkv/q-idx gemv 1.59 conv 0.18 ab 0.36 z 1.03 rec 0.49 out-proj 0.98 hc-read1+router 2.88 shared+quant 1.32 waitA 1.74 VRAM hits 3.39 waitB 0.73 PCIe grp 0.32 waitCPU 6.99 copy+combine 0.50 (gap) 0.05 head 0.98 hc0 norm 0.48 hc0 down 0.80 hc0 up 0.81 | QSA layers: q8+kv-idx 0.11 k/v+norm-rope 0.23 kv+idx append 0.16 q+q-idx 0.76 scores+topk 0.57 kv-resolve 0.36 attention 0.62 gate 0.05 out-proj 0.37 hc-read1+router 0.99 shared+quant 0.45 waitA 0.18 VRAM hits 1.10 waitB 0.32 PCIe grp 0.11 waitCPU 3.31 copy+combine 0.18 (gap) 0.02 hc0 norm 0.10 hc0 down 0.27 hc0 up 0.27 | total 36.17 ms/window over 68 windows
+ab_off_r2.log strata decode GPU stages (ms/window): GDN layers: q8+qkv/q-idx gemv 1.57 conv 0.18 ab 0.36 z 1.02 rec 0.50 out-proj 0.97 hc-read1+router 2.85 shared+quant 1.30 waitA 1.63 VRAM hits 3.35 waitB 0.65 PCIe grp 0.32 waitCPU 6.18 copy+combine 0.50 (gap) 0.05 head 0.97 hc0 norm 0.47 hc0 down 0.79 hc0 up 0.81 | QSA layers: q8+kv-idx 0.11 k/v+norm-rope 0.23 kv+idx append 0.16 q+q-idx 0.75 scores+topk 0.56 kv-resolve 0.36 attention 0.62 gate 0.05 out-proj 0.37 hc-read1+router 0.97 shared+quant 0.45 waitA 0.16 VRAM hits 1.09 waitB 0.30 PCIe grp 0.11 waitCPU 2.55 copy+combine 0.18 (gap) 0.02 hc0 norm 0.10 hc0 down 0.26 hc0 up 0.27 | total 34.15 ms/window over 69 windows
+ab_orig_r0.log strata decode GPU stages (ms/window): GDN layers: q8+qkv/q-idx gemv 1.64 conv 0.19 ab 0.38 z 1.06 rec 0.52 out-proj 1.00 hc-read1+router 2.93 shared+quant 1.33 waitA 2.01 VRAM hits 3.53 waitB 0.55 PCIe grp 0.31 waitCPU 8.34 copy+combine 0.53 (gap) 0.05 head 1.01 hc0 norm 0.49 hc0 down 0.81 hc0 up 0.82 | QSA layers: q8+kv-idx 0.11 k/v+norm-rope 0.24 kv+idx append 0.16 q+q-idx 0.78 scores+topk 0.57 kv-resolve 0.38 attention 0.64 gate 0.05 out-proj 0.38 hc-read1+router 1.00 shared+quant 0.45 waitA 0.17 VRAM hits 1.16 waitB 0.20 PCIe grp 0.11 waitCPU 3.48 copy+combine 0.19 (gap) 0.02 hc0 norm 0.10 hc0 down 0.27 hc0 up 0.27 | total 38.26 ms/window over 72 windows
+ab_orig_r1.log strata decode GPU stages (ms/window): GDN layers: q8+qkv/q-idx gemv 1.60 conv 0.18 ab 0.37 z 1.03 rec 0.50 out-proj 0.98 hc-read1+router 2.85 shared+quant 1.30 waitA 1.43 VRAM hits 3.39 waitB 0.62 PCIe grp 0.32 waitCPU 0.24 copy+combine 0.48 (gap) 0.05 head 0.99 hc0 norm 0.48 hc0 down 0.79 hc0 up 0.81 | QSA layers: q8+kv-idx 0.11 k/v+norm-rope 0.23 kv+idx append 0.16 q+q-idx 0.76 scores+topk 0.57 kv-resolve 0.33 attention 0.62 gate 0.05 out-proj 0.37 hc-read1+router 0.97 shared+quant 0.45 waitA 0.15 VRAM hits 1.11 waitB 0.26 PCIe grp 0.11 waitCPU 0.07 copy+combine 0.17 (gap) 0.02 hc0 norm 0.10 hc0 down 0.26 hc0 up 0.27 | total 25.56 ms/window over 69 windows
+ab_orig_r2.log strata decode GPU stages (ms/window): GDN layers: q8+qkv/q-idx gemv 1.58 conv 0.19 ab 0.37 z 1.03 rec 0.49 out-proj 0.97 hc-read1+router 2.84 shared+quant 1.30 waitA 1.61 VRAM hits 3.39 waitB 0.57 PCIe grp 0.32 waitCPU 6.50 copy+combine 0.49 (gap) 0.05 head 0.98 hc0 norm 0.48 hc0 down 0.79 hc0 up 0.81 | QSA layers: q8+kv-idx 0.11 k/v+norm-rope 0.23 kv+idx append 0.16 q+q-idx 0.75 scores+topk 0.56 kv-resolve 0.33 attention 0.62 gate 0.05 out-proj 0.37 hc-read1+router 0.97 shared+quant 0.45 waitA 0.17 VRAM hits 1.10 waitB 0.26 PCIe grp 0.11 waitCPU 2.95 copy+combine 0.17 (gap) 0.02 hc0 norm 0.10 hc0 down 0.26 hc0 up 0.27 | total 34.78 ms/window over 68 windows
+ab_v70_r0.log strata decode GPU stages (ms/window): GDN layers: q8+qkv/q-idx gemv 1.40 conv 0.18 ab 0.37 z 0.87 rec 0.50 out-proj 1.01 hc-read1+router 2.80 shared+quant 1.34 waitA 1.69 VRAM hits 2.81 waitB 0.48 PCIe grp 0.34 waitCPU 7.81 copy+combine 0.51 (gap) 0.05 head 0.69 hc0 norm 0.48 hc0 down 0.76 hc0 up 0.72 | QSA layers: q8+kv-idx 0.11 k/v+norm-rope 0.23 kv+idx append 0.16 q+q-idx 0.68 scores+topk 0.56 kv-resolve 0.38 attention 0.61 gate 0.05 out-proj 0.39 hc-read1+router 0.96 shared+quant 0.46 waitA 0.17 VRAM hits 0.91 waitB 0.20 PCIe grp 0.12 waitCPU 3.31 copy+combine 0.18 (gap) 0.02 hc0 norm 0.10 hc0 down 0.25 hc0 up 0.24 | total 34.91 ms/window over 66 windows
+ab_v70_r1.log strata decode GPU stages (ms/window): GDN layers: q8+qkv/q-idx gemv 1.40 conv 0.18 ab 0.37 z 0.87 rec 0.50 out-proj 1.00 hc-read1+router 2.79 shared+quant 1.34 waitA 1.51 VRAM hits 2.82 waitB 0.48 PCIe grp 0.33 waitCPU 0.27 copy+combine 0.50 (gap) 0.05 head 0.69 hc0 norm 0.47 hc0 down 0.77 hc0 up 0.72 | QSA layers: q8+kv-idx 0.11 k/v+norm-rope 0.24 kv+idx append 0.16 q+q-idx 0.67 scores+topk 0.56 kv-resolve 0.37 attention 0.60 gate 0.05 out-proj 0.39 hc-read1+router 0.97 shared+quant 0.46 waitA 0.17 VRAM hits 0.91 waitB 0.21 PCIe grp 0.12 waitCPU 0.10 copy+combine 0.17 (gap) 0.02 hc0 norm 0.10 hc0 down 0.26 hc0 up 0.24 | total 23.96 ms/window over 66 windows
+ab_v70_r2.log strata decode GPU stages (ms/window): GDN layers: q8+qkv/q-idx gemv 1.40 conv 0.18 ab 0.37 z 0.88 rec 0.50 out-proj 1.05 hc-read1+router 2.82 shared+quant 1.35 waitA 1.70 VRAM hits 2.89 waitB 0.41 PCIe grp 0.33 waitCPU 5.60 copy+combine 0.50 (gap) 0.05 head 0.70 hc0 norm 0.48 hc0 down 0.78 hc0 up 0.73 | QSA layers: q8+kv-idx 0.11 k/v+norm-rope 0.23 kv+idx append 0.16 q+q-idx 0.68 scores+topk 0.57 kv-resolve 0.40 attention 0.62 gate 0.05 out-proj 0.39 hc-read1+router 0.97 shared+quant 0.46 waitA 0.17 VRAM hits 0.93 waitB 0.15 PCIe grp 0.11 waitCPU 2.98 copy+combine 0.17 (gap) 0.02 hc0 norm 0.10 hc0 down 0.26 hc0 up 0.24 | total 32.50 ms/window over 71 windows
diff --git a/docs/NVIDIA_V100.md b/docs/NVIDIA_V100.md
index 4bebbbc1f..e7480429b 100644
--- a/docs/NVIDIA_V100.md
+++ b/docs/NVIDIA_V100.md
@@ -35,6 +35,15 @@ select "old" kernels everywhere: which kernel runs is decided per architecture w
| QSA prompt attention, Q4_0 KV | the decode kernel |
| QSA block scores | the warp kernel (the tensor-core scorer needs sm_80) |
+| Part of a decode / verify window | On sm_70 |
+| --- | --- |
+| Routed experts in VRAM | gfx906's expert mode 8: the codebook grid and the group's activations in shared memory, SwiGLU fused (`STRATA_EXP_MODE=0`: the CUDA layout other cards run) |
+| Dense 2-4 column GEMVs and the head | the interleaved `native_mmvq_il` with a Volta rows table (`STRATA_MMVQ_IL=0`: `native_mmvq`) |
+| Hyper-connection read, up projection | gfx906's latency-hidden up kernel (`STRATA_GR_FAST=0`: the plain one) |
+
+All three are bitwise the kernels they replace; on a V100-SXM2 they take a verify window's GPU work from 22.8 to 21.2 ms
+([bench/results/2026-10-07-v100-decode-kernels](../bench/results/2026-10-07-v100-decode-kernels/README.md)).
+
## Measured
One V100-PCIE-32GB, i9-7960X, Unsloth `UD-IQ4_XS` (not a setup model), int8 KV, MTP `--spec 2`; prompt read speed of random-word prompts, tokens/s,
diff --git a/tools/ab_engine.py b/tools/ab_engine.py
new file mode 100644
index 000000000..adb6dc282
--- /dev/null
+++ b/tools/ab_engine.py
@@ -0,0 +1,139 @@
+"""A/B two engine builds or environments on one config: restart the server per arm, alternate arms over rounds.
+
+ python tools/ab_engine.py strata-q2_0.json A:exe=/path/a B:exe=/path/b,STRATA_EXP_MODE=0 [--rounds 3]
+
+An arm is NAME:key=value,...; `exe` replaces the config's engine, `xargs` appends ';'-separated engine arguments,
+every other key is set in the engine's environment. Each round starts the server once per arm (the arms' order alternates), warms it up with one short
+answer, then sends the same requests: greedy, fixed prompts, a short chat set and one long prompt. Prints the
+server's own timings (llama.cpp's `timings`: decode and prompt tokens per second) per request and the per-arm
+medians. Decode numbers move run to run (the adaptive expert tier, the OS), so compare medians over rounds.
+"""
+from __future__ import annotations
+
+import argparse
+import json
+import os
+import random
+import statistics
+import subprocess
+import sys
+import tempfile
+import time
+import urllib.request
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parents[1]
+PROMPTS = (
+ "Write a Python function that merges two sorted lists into one sorted list, with a docstring and two tests.",
+ "Explain in two paragraphs how a refrigerator moves heat from inside to outside.",
+ "List ten practical tips for learning a new language as an adult, one sentence each.",
+)
+
+
+def long_prompt(words: int) -> str:
+ rng = random.Random(7)
+ vocab = ("river stone market lantern copper winter garden signal harbor needle orbit velvet canyon ember "
+ "ledger quartz meadow anchor violet thunder").split()
+ body = " ".join(rng.choice(vocab) for _ in range(words))
+ return f"Here is a list of words:\n{body}\n\nSummarize what kinds of words appear in the list, in five sentences."
+
+
+def post(port: int, prompt: str, max_tokens: int) -> dict:
+ req = urllib.request.Request(
+ f"http://127.0.0.1:{port}/v1/chat/completions",
+ data=json.dumps({"messages": [{"role": "user", "content": prompt}], "max_tokens": max_tokens,
+ "temperature": 0, "chat_template_kwargs": {"enable_thinking": False}}).encode(),
+ headers={"Content-Type": "application/json"})
+ with urllib.request.urlopen(req, timeout=1800) as r:
+ return json.loads(r.read())
+
+
+def wait_ready(port: int, proc: subprocess.Popen, timeout: float = 1800) -> None:
+ t0 = time.time()
+ while time.time() - t0 < timeout:
+ if proc.poll() is not None:
+ raise RuntimeError(f"server exited with {proc.returncode}")
+ try:
+ with urllib.request.urlopen(f"http://127.0.0.1:{port}/v1/models", timeout=5) as r:
+ if r.status == 200:
+ post(port, "Say hi.", 8)
+ return
+ except Exception:
+ pass
+ time.sleep(3)
+ raise TimeoutError("server not ready")
+
+
+def main() -> int:
+ ap = argparse.ArgumentParser()
+ ap.add_argument("config")
+ ap.add_argument("arms", nargs="+")
+ ap.add_argument("--rounds", type=int, default=3)
+ ap.add_argument("--port", type=int, default=8090)
+ ap.add_argument("--max-new", type=int, default=256)
+ ap.add_argument("--long-words", type=int, default=6000)
+ ap.add_argument("--log", default="ab_engine.jsonl")
+ a = ap.parse_args()
+ base = json.loads(Path(a.config).read_text())
+ arms = []
+ for s in a.arms:
+ name, _, kv = s.partition(":")
+ env = dict(x.split("=", 1) for x in kv.split(",") if x)
+ arms.append((name, env))
+ reqs = [(f"chat{i}", p) for i, p in enumerate(PROMPTS)] + [("long", long_prompt(a.long_words))]
+ out = open(a.log, "a")
+ res: dict = {n: {} for n, _ in arms}
+ for rnd in range(a.rounds):
+ order = arms if rnd % 2 == 0 else arms[::-1]
+ for name, env in order:
+ cfg = dict(base)
+ e = dict(env)
+ if "exe" in e:
+ cfg["exe"] = e.pop("exe")
+ if "xargs" in e: # extra engine arguments, ';'-separated
+ cfg["args"] = list(base["args"]) + e.pop("xargs").split(";")
+ cfg["port"] = a.port
+ cfg["log"] = str(Path(tempfile.gettempdir()) / f"ab_{name}_r{rnd}.log")
+ cpath = Path(tempfile.gettempdir()) / f"ab_{name}.json"
+ cpath.write_text(json.dumps(cfg, indent=1))
+ penv = dict(os.environ, **e)
+ proc = subprocess.Popen([sys.executable, str(ROOT / "serve" / "server.py"), "--engine", "strata", "--config",
+ str(cpath), "--port", str(a.port)], cwd=str(ROOT), env=penv,
+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ try:
+ t0 = time.time()
+ wait_ready(a.port, proc)
+ print(f"round {rnd} {name}: ready in {time.time() - t0:.0f} s", flush=True)
+ for tag, p in reqs:
+ r = post(a.port, p, a.max_new)
+ t = r.get("timings", {})
+ row = {"round": rnd, "arm": name, "req": tag, "decode": t.get("predicted_per_second"),
+ "prompt": t.get("prompt_per_second"), "prompt_n": t.get("prompt_n"),
+ "n": r.get("usage", {}).get("completion_tokens"),
+ "text": r["choices"][0]["message"].get("content", "")[:80]}
+ out.write(json.dumps(row) + "\n")
+ out.flush()
+ res[name].setdefault(tag, []).append(row)
+ print(f" {tag:6s} decode {row['decode']} tok/s prompt {row['prompt']} tok/s ({row['prompt_n']}) "
+ f"n {row['n']}", flush=True)
+ finally:
+ proc.terminate()
+ try:
+ proc.wait(60)
+ except subprocess.TimeoutExpired:
+ proc.kill()
+ time.sleep(5)
+ print("\nmedians over rounds:")
+ for tag, _ in reqs:
+ cells = []
+ for name, _ in arms:
+ rows = res[name].get(tag, [])
+ d = statistics.median([x["decode"] for x in rows if x["decode"]]) if rows else float("nan")
+ pr = statistics.median([x["prompt"] for x in rows if x["prompt"]]) if rows else float("nan")
+ cells.append(f"{name}: decode {d:6.1f} prompt {pr:7.1f}")
+ print(f" {tag:6s} | " + " | ".join(cells))
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())