[PR #3779] [Engine] sm_80 (GA100) tuning from #3712, all five features in one PR: one commit each, to split or cherry-pick as you prefer #4779

Open
opened 2026-11-07 15:38:59 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/3779
Author: @linxuhao
Created: 10/22/2026
Status: 🔄 Open

Base: main ← Head: sm80-all


📝 Commits (10+)

  • 48dc535 Dense dequant: the wide kernels by default on sm_80 too (bitwise)
  • eaedca8 MMVQ-IL: sm_80 row tables measured on a CMP 170HX
  • 056d36a Prefill fused IQ experts on sm_80: 256 threads (STRATA_PF_FUSED_NT=256), whole-layer launches (STRATA_PF_BATCH=N), two-pass weight loads in the 256-thread kernels (bitwise)
  • da81826 Prefill PLE: STRATA_PLE_COMPACT=1 uploads the raw IQ4_NL rows and dequantizes them on the device
  • 0ba47e6 Prefill: STRATA_PLE_COPY_STREAM=1 uploads the compact PLE rows on their own stream
  • 952dd78 Native head: STRATA_EMBED_VRAM=1 keeps the token-embedding table in VRAM
  • 741fc6a Prefill: STRATA_DEQUANT_SIDE=1 dequantizes the dense weights on a side stream into a double-buffered scratch
  • 579cbfb Prefill fused IQ experts on sm_80: an f16 mma path (STRATA_PF_FUSED_F16=1) and a warp-specialized kernel (STRATA_PF_FUSED_WS=1)
  • f1cabc9 Prefill GDN: STRATA_GDN_TC=1 runs the DeltaNet recurrence as a chunked scan on the tensor cores (sm_80+, opt-in)
  • 0d51292 Conversation checkpoints: STRATA_CKPT_ASYNC (background device-to-host copy) and STRATA_CKPT_VRAM_SLOTS (recent GDN states kept in VRAM)

📊 Changes

32 files changed (+3971 additions, -178 deletions)

View changed files

📝 docs/DETAILS.md (+33 -0)
📝 docs/MMVQ_IL_TABLE.md (+15 -0)
📝 include/strata/core/conversation_buffer.hpp (+19 -4)
📝 include/strata/core/conversation_cache.hpp (+17 -0)
📝 include/strata/core/conversation_snapshot.hpp (+42 -1)
📝 include/strata/core/native_head.hpp (+4 -1)
📝 include/strata/core/verify.hpp (+11 -1)
📝 include/strata/kernels/native_mmvq.hpp (+3 -0)
📝 include/strata/kernels/ngram.hpp (+4 -0)
📝 include/strata/kernels/ple.hpp (+4 -0)
📝 include/strata/prefill/gemm.hpp (+20 -0)
📝 include/strata/prefill/moe_fused.hpp (+15 -0)
📝 include/strata/prefill/moe_fused_iq.hpp (+6 -0)
📝 metal/src/engine/stubs_0145.cpp (+5 -0)
📝 src/core/conversation_copy.hpp (+64 -2)
📝 src/core/conversation_snapshot.cpp (+416 -4)
📝 src/core/conversation_state.cpp (+319 -15)
📝 src/core/native_head.cpp (+29 -0)
📝 src/core/verify.cpp (+157 -10)
📝 src/kernels/cuda/dequant_bf16.cu (+4 -2)

...and 12 more files

📄 Description

Problem and result

sm_80 has no entry in the engine's per-card tables, so on a GA100 card most of the prompt and decode path runs on choices made for other architectures. #3712 has the measurements from a CMP 170HX (GA100, sm_80, 70 SMs, PCIe Gen2 x4) running Qwen3.8-Flash-Next IQ3_S with every expert resident. On our working branch, with these features and the switches turned on, prompts run up to 2.0x the speed of stock 0.2.1.4, decode +20 %, and conversation park/restore 5-10x faster.

This PR puts all of it in front of you in one place, rebased on current main. It is not meant to be merged as it is. Each feature is its own commit (or a few consecutive ones), so you can cherry-pick, or ask us to split it into the five thematic PRs listed in #3712, or into finer ones.

#3712 (scope proposal; no agreement yet). Also #3252 (A100 slowdowns, where sm_80 also falls back to the shared MMVQ-IL table) and #3453 (the sm_89 MMVQ-IL table, which touches the same table list).

Approach

Every switch is opt-in. With all of them unset, the default path is byte-identical to main on every card, with two exceptions on sm_80 only. Both exceptions are bitwise: the output stays identical.

commits feature default
48dc535e wide dense dequant also on sm_80 (as on sm_61 / sm_86; STRATA_DEQUANT_WIDE=0 turns it off) on, sm_80 only, bitwise
eaedca84 MMVQ-IL sm_80 row tables (STRATA_MMVQ_IL_SM80=0 restores the shared table) on, sm_80 only, bitwise
056d36a9 STRATA_PF_FUSED_NT=256 256-thread fused IQ prompt experts, STRATA_PF_BATCH=N whole-layer launches (WideBatch) off
da818261, 0ba47e61 STRATA_PLE_COMPACT=1 raw IQ4_NL PLE rows dequantized on the device; STRATA_PLE_COPY_STREAM=1 their upload on its own stream off
952dd784 STRATA_EMBED_VRAM=1 token-embedding table in VRAM (only while 512 MiB stay free) off
741fc6ab STRATA_DEQUANT_SIDE=1 dense dequant on a side stream off
579cbfbb STRATA_PF_FUSED_F16=1 / STRATA_PF_FUSED_WS=1 f16 mma fused experts (rounding-level) off
f1cabc99 STRATA_GDN_TC=1 DeltaNet prompt recurrence as a chunked tensor-core scan (rounding-level; sm_80+, 48+ SMs) off
0d512925 STRATA_CKPT_ASYNC=1, STRATA_CKPT_VRAM_SLOTS=N conversation checkpoints off
3e0c141c, 56088e71 STRATA_PARK_ASYNC=1, STRATA_CKPT_POOL=N, STRATA_CKPT_GATHER=1 background park, ready checkpoint pool off
bafca410 STRATA_PARK_VRAM_MIB=N parked K/V in VRAM off
a04f4399 docs for the conversation-cache switches -
68c487c3 STRATA_GRAPH_PRIO=1 verify-window graph nodes keep their stream priority off
1f4b8139 mmvq_il_parity harness: L2-residency arms and clock warm-up (harness only) -
116992ab STRATA_MMVQ_IL_PF=1 hoisted-load, exact-integer MMVQ-IL kernels for Q6_K off
6d6f0f39 docs for the decode switches -

Compatibility effects:

  • The 256-thread instances add 365,632 bytes of sm_80 device code to every CUDA build.
  • An existing STRATA_CKPT_POOL=1 now also pre-allocates 2 ready checkpoints (+236 MB of host RSS).
  • The conversation-cache copy paths and GRAPH_PRIO are CUDA only. On HIP, gfx906 and Metal they are off.
  • Metal gets stubs for the three new prefill entry points.
  • Each switch's per-feature figures and costs are in #3712.

Validation

Passed:

  • Builds of this branch's tree (sm80-all, on main 011c9e60) with configure=0, build=0, 0 errors, and the same warning count as main built the same way:
    • CUDA 13.3 sm_80, every target;
    • HIP gfx1100 (ROCm 7.14), every target;
    • HIP gfx906, every target.
  • Every commit of the five per-theme branches built on its own on the same three backends.
  • GPU runs of this revision on a CMP 170HX: per-feature off/on pairs and the overall comparison, results in https://github.com/Niko1221/Strata/pull/3779#issuecomment-6360524055. Greedy answers (11 prompts) are identical for every bitwise switch, and the conversation check is identical for PR 4 and for the merged build.
  • Teacher-forced prompt-path KL (tools/quant_quality.py prompt / pcompare, set v1) of the rounding-level switches against the bitwise base. GDN_TC: mean 0.0157, median 0.0011. F16 / WS: mean 0.0062, median 0.00006. Both on: mean 0.0165. Top-1 agreement is 100 % in every arm. Details: https://github.com/Niko1221/Strata/pull/3779#issuecomment-6362825058.

Failed: none observed in builds. During the GPU runs, in 3 of about 35 engine starts the engine stopped answering after a park with evictions, each time on upstream's conversation-cache path (the PR 4 switches off). It did not reproduce in 15 reruns of the same sequences (5 greedy runs, 10 full benchmark runs on the stock build); details are in the results comment.

Not run:

  • SYCL and Metal builds; HIP execution (no AMD card); CUDA 12 builds; other sm_80 cards.
  • The gfx1100 + STRATA_PREFILL_MMQ build and the multi-architecture object build of the fused-expert files ran before the rebase onto 011c9e60 and were not repeated after it. Upstream did not change those files.

Limits

  • Measured on one CMP 170HX, which is not an A100: 70 SMs, HBM2e and a Gen2 x4 link. The sm_80 table rows may want re-measuring on an A100.
  • The first restore of a run with parked K/V in VRAM (41.6 / 56.9 ms) is slower than the later ones (6.5-12.6 ms). We have not found why.

🤖 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/3779 **Author:** [@linxuhao](https://github.com/linxuhao) **Created:** 10/22/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `sm80-all` --- ### 📝 Commits (10+) - [`48dc535`](https://github.com/Niko1221/Strata/commit/48dc535e7787c8fdc7448b1537384547cc7a59db) Dense dequant: the wide kernels by default on sm_80 too (bitwise) - [`eaedca8`](https://github.com/Niko1221/Strata/commit/eaedca840cebdf78ab4226f0fda01d6b3a74aeb8) MMVQ-IL: sm_80 row tables measured on a CMP 170HX - [`056d36a`](https://github.com/Niko1221/Strata/commit/056d36a9fbf4c65ad4a6f2029e27b7a2c5a487e0) Prefill fused IQ experts on sm_80: 256 threads (STRATA_PF_FUSED_NT=256), whole-layer launches (STRATA_PF_BATCH=N), two-pass weight loads in the 256-thread kernels (bitwise) - [`da81826`](https://github.com/Niko1221/Strata/commit/da818261f0c563c37a10d45af5688eb387cc0b7d) Prefill PLE: STRATA_PLE_COMPACT=1 uploads the raw IQ4_NL rows and dequantizes them on the device - [`0ba47e6`](https://github.com/Niko1221/Strata/commit/0ba47e6191342079c022abc37e38af491b104d45) Prefill: STRATA_PLE_COPY_STREAM=1 uploads the compact PLE rows on their own stream - [`952dd78`](https://github.com/Niko1221/Strata/commit/952dd78453b2ebdcd80c84aed85393dd06f6ff9b) Native head: STRATA_EMBED_VRAM=1 keeps the token-embedding table in VRAM - [`741fc6a`](https://github.com/Niko1221/Strata/commit/741fc6ab267a144182926d4a166428db41457060) Prefill: STRATA_DEQUANT_SIDE=1 dequantizes the dense weights on a side stream into a double-buffered scratch - [`579cbfb`](https://github.com/Niko1221/Strata/commit/579cbfbbeb93efb134e7778c9404359a25781530) Prefill fused IQ experts on sm_80: an f16 mma path (STRATA_PF_FUSED_F16=1) and a warp-specialized kernel (STRATA_PF_FUSED_WS=1) - [`f1cabc9`](https://github.com/Niko1221/Strata/commit/f1cabc992f42fbe08a0102795b41c44b008dd1e0) Prefill GDN: STRATA_GDN_TC=1 runs the DeltaNet recurrence as a chunked scan on the tensor cores (sm_80+, opt-in) - [`0d51292`](https://github.com/Niko1221/Strata/commit/0d512925ce2467ec6b3a1cf1d0cb0f10a58385a2) Conversation checkpoints: STRATA_CKPT_ASYNC (background device-to-host copy) and STRATA_CKPT_VRAM_SLOTS (recent GDN states kept in VRAM) ### 📊 Changes **32 files changed** (+3971 additions, -178 deletions) <details> <summary>View changed files</summary> 📝 `docs/DETAILS.md` (+33 -0) 📝 `docs/MMVQ_IL_TABLE.md` (+15 -0) 📝 `include/strata/core/conversation_buffer.hpp` (+19 -4) 📝 `include/strata/core/conversation_cache.hpp` (+17 -0) 📝 `include/strata/core/conversation_snapshot.hpp` (+42 -1) 📝 `include/strata/core/native_head.hpp` (+4 -1) 📝 `include/strata/core/verify.hpp` (+11 -1) 📝 `include/strata/kernels/native_mmvq.hpp` (+3 -0) 📝 `include/strata/kernels/ngram.hpp` (+4 -0) 📝 `include/strata/kernels/ple.hpp` (+4 -0) 📝 `include/strata/prefill/gemm.hpp` (+20 -0) 📝 `include/strata/prefill/moe_fused.hpp` (+15 -0) 📝 `include/strata/prefill/moe_fused_iq.hpp` (+6 -0) 📝 `metal/src/engine/stubs_0145.cpp` (+5 -0) 📝 `src/core/conversation_copy.hpp` (+64 -2) 📝 `src/core/conversation_snapshot.cpp` (+416 -4) 📝 `src/core/conversation_state.cpp` (+319 -15) 📝 `src/core/native_head.cpp` (+29 -0) 📝 `src/core/verify.cpp` (+157 -10) 📝 `src/kernels/cuda/dequant_bf16.cu` (+4 -2) _...and 12 more files_ </details> ### 📄 Description ## Problem and result sm_80 has no entry in the engine's per-card tables, so on a GA100 card most of the prompt and decode path runs on choices made for other architectures. #3712 has the measurements from a CMP 170HX (GA100, sm_80, 70 SMs, PCIe Gen2 x4) running Qwen3.8-Flash-Next IQ3_S with every expert resident. On our working branch, with these features and the switches turned on, prompts run up to 2.0x the speed of stock 0.2.1.4, decode +20 %, and conversation park/restore 5-10x faster. This PR puts all of it in front of you in one place, rebased on current main. It is not meant to be merged as it is. Each feature is its own commit (or a few consecutive ones), so you can cherry-pick, or ask us to split it into the five thematic PRs listed in #3712, or into finer ones. ## Related discussion #3712 (scope proposal; no agreement yet). Also #3252 (A100 slowdowns, where sm_80 also falls back to the shared MMVQ-IL table) and #3453 (the sm_89 MMVQ-IL table, which touches the same table list). ## Approach Every switch is opt-in. With all of them unset, the default path is byte-identical to main on every card, with two exceptions on sm_80 only. Both exceptions are bitwise: the output stays identical. | commits | feature | default | |---|---|---| | 48dc535e | wide dense dequant also on sm_80 (as on sm_61 / sm_86; `STRATA_DEQUANT_WIDE=0` turns it off) | **on, sm_80 only, bitwise** | | eaedca84 | MMVQ-IL sm_80 row tables (`STRATA_MMVQ_IL_SM80=0` restores the shared table) | **on, sm_80 only, bitwise** | | 056d36a9 | `STRATA_PF_FUSED_NT=256` 256-thread fused IQ prompt experts, `STRATA_PF_BATCH=N` whole-layer launches (WideBatch) | off | | da818261, 0ba47e61 | `STRATA_PLE_COMPACT=1` raw IQ4_NL PLE rows dequantized on the device; `STRATA_PLE_COPY_STREAM=1` their upload on its own stream | off | | 952dd784 | `STRATA_EMBED_VRAM=1` token-embedding table in VRAM (only while 512 MiB stay free) | off | | 741fc6ab | `STRATA_DEQUANT_SIDE=1` dense dequant on a side stream | off | | 579cbfbb | `STRATA_PF_FUSED_F16=1` / `STRATA_PF_FUSED_WS=1` f16 mma fused experts (rounding-level) | off | | f1cabc99 | `STRATA_GDN_TC=1` DeltaNet prompt recurrence as a chunked tensor-core scan (rounding-level; sm_80+, 48+ SMs) | off | | 0d512925 | `STRATA_CKPT_ASYNC=1`, `STRATA_CKPT_VRAM_SLOTS=N` conversation checkpoints | off | | 3e0c141c, 56088e71 | `STRATA_PARK_ASYNC=1`, `STRATA_CKPT_POOL=N`, `STRATA_CKPT_GATHER=1` background park, ready checkpoint pool | off | | bafca410 | `STRATA_PARK_VRAM_MIB=N` parked K/V in VRAM | off | | a04f4399 | docs for the conversation-cache switches | - | | 68c487c3 | `STRATA_GRAPH_PRIO=1` verify-window graph nodes keep their stream priority | off | | 1f4b8139 | mmvq_il_parity harness: L2-residency arms and clock warm-up (harness only) | - | | 116992ab | `STRATA_MMVQ_IL_PF=1` hoisted-load, exact-integer MMVQ-IL kernels for Q6_K | off | | 6d6f0f39 | docs for the decode switches | - | Compatibility effects: - The 256-thread instances add 365,632 bytes of sm_80 device code to every CUDA build. - An existing `STRATA_CKPT_POOL=1` now also pre-allocates 2 ready checkpoints (+236 MB of host RSS). - The conversation-cache copy paths and `GRAPH_PRIO` are CUDA only. On HIP, gfx906 and Metal they are off. - Metal gets stubs for the three new prefill entry points. - Each switch's per-feature figures and costs are in #3712. ## Validation **Passed:** - Builds of this branch's tree (sm80-all, on main 011c9e60) with configure=0, build=0, 0 errors, and the same warning count as main built the same way: - CUDA 13.3 sm_80, every target; - HIP gfx1100 (ROCm 7.14), every target; - HIP gfx906, every target. - Every commit of the five per-theme branches built on its own on the same three backends. - GPU runs of this revision on a CMP 170HX: per-feature off/on pairs and the overall comparison, results in https://github.com/Niko1221/Strata/pull/3779#issuecomment-6360524055. Greedy answers (11 prompts) are identical for every bitwise switch, and the conversation check is identical for PR 4 and for the merged build. - Teacher-forced prompt-path KL (`tools/quant_quality.py prompt` / `pcompare`, set v1) of the rounding-level switches against the bitwise base. GDN_TC: mean 0.0157, median 0.0011. F16 / WS: mean 0.0062, median 0.00006. Both on: mean 0.0165. Top-1 agreement is 100 % in every arm. Details: https://github.com/Niko1221/Strata/pull/3779#issuecomment-6362825058. **Failed:** none observed in builds. During the GPU runs, in 3 of about 35 engine starts the engine stopped answering after a park with evictions, each time on upstream's conversation-cache path (the PR 4 switches off). It did not reproduce in 15 reruns of the same sequences (5 greedy runs, 10 full benchmark runs on the stock build); details are in the results comment. **Not run:** - SYCL and Metal builds; HIP execution (no AMD card); CUDA 12 builds; other sm_80 cards. - The gfx1100 + STRATA_PREFILL_MMQ build and the multi-architecture object build of the fused-expert files ran before the rebase onto 011c9e60 and were not repeated after it. Upstream did not change those files. ## Limits - Measured on one CMP 170HX, which is not an A100: 70 SMs, HBM2e and a Gen2 x4 link. The sm_80 table rows may want re-measuring on an A100. - The first restore of a run with parked K/V in VRAM (41.6 / 56.9 ms) is slower than the later ones (6.5-12.6 ms). We have not found why. 🤖 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>
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#4779
No description provided.