[PR #1100] [CLOSED] s2_qpn8: opt-in QPN8 expert GEMV on Volta m8n8k4 (M >= 4) #3027

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

📋 Pull Request Information

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

Base: main ← Head: v100/qpn8-v2


📝 Commits (3)

  • ed24aec s2 qpn8: the V100 load-time repack + m8n8k4 expert GEMV (STRATA_QPN8=1, measured)
  • 0ff1d50 expert cache: the QPN8 dual-form slot at admission (STRATA_QPN8=1)
  • f8c9ca3 bench: the QPN8 prep + chains decomposition and the M>=4 entry-point table (V100)

📊 Changes

13 files changed (+2227 additions, -15 deletions)

View changed files

📝 CMakeLists.txt (+12 -0)
➕ bench/micro/s2_unpack_bench.cu (+927 -0)
➕ bench/results/2026-10-02-skinny-expert/README.md (+87 -0)
➕ bench/results/2026-10-03-qpn8-prep/README.md (+55 -0)
📝 include/strata/core/expert_cache.hpp (+4 -0)
➕ include/strata/kernels/s2_qpn8.hpp (+94 -0)
📝 src/core/expert_cache.cpp (+25 -0)
📝 src/core/peer_experts.cpp (+4 -1)
📝 src/core/remote_experts.cpp (+4 -1)
📝 src/core/verify.cpp (+14 -4)
➕ src/kernels/cuda/s2_qpn8.cu (+581 -0)
➕ src/kernels/s2_qpn8_parity.cpp (+398 -0)
📝 src/program/generate.cpp (+22 -9)

📄 Description

Resubmitted from #1024: 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

QPN8: a load-time repack of the Q2_0 expert weights at admission plus an m8n8k4 expert GEMV for Volta, split out of #627. The repack doubles the slot at admission and the GEMV builds the per-window A fragment and runs the mma chains; the DP4A path remains the fallback.

The entry point pays off only when a window has M >= 4 expert entries; at M < 4 it is slower, so it stays opt-in: STRATA_QPN8=1, default off.

Gating

The m8n8k4 code is compiled under #if !defined(__HIPCC__) && defined(STRATA_EXPERIMENTAL_SM60) with stubs that fall back to DP4A elsewhere. The ready-made engine is unchanged.

Measured

V100-SXM2-16GB, CUDA 12.8, s2_qpn8_parity --bench, per window:

entries DP4A QPN8 ratio
10x8 109.3 us 90.6 us 1.21x
10x4 73.5 us 83.7 us 0.88x
10x2 56.2 us 77.0 us 0.73x
10x1 50.1 us 75.6 us 0.66x

Tests

  • s2_qpn8_parity PASS with STRATA_QPN8=1: the quantized intermediates are byte-identical (0 of 30600 bytes differ), the FP32-level outputs are within their bound (worst abs 9.5e-6).
  • s2_expert_grouped_parity still bitwise PASS.
  • Default (QPN8 unset) skips/PASS.

32K end-to-end

Same setup with STRATA_QPN8=1: prefill 1544.4 single / 2197.0 dual vs main's 1557.1 / 2207.0, and decode within its +-15% session noise. The MTP verify window is around M=5, between the measured 10x4 (0.88x) and 10x8 (1.21x) points. The entry point stays opt-in.

Known gap

The per-stage sizing loop for a layer split (~generate.cpp:3514) still prices lay.max_blob, as in the original #627 commit, so a Volta layer split with STRATA_QPN8=1 can over-pick a stage and fail open. The rest of the admission/verify/generate accounting is updated.


🔄 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/1100 **Author:** [@ATIVX928](https://github.com/ATIVX928) **Created:** 10/6/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `v100/qpn8-v2` --- ### 📝 Commits (3) - [`ed24aec`](https://github.com/Niko1221/Strata/commit/ed24aecdd3073091c93836762a6ef5af0a235c1a) s2 qpn8: the V100 load-time repack + m8n8k4 expert GEMV (STRATA_QPN8=1, measured) - [`0ff1d50`](https://github.com/Niko1221/Strata/commit/0ff1d50076f44dee5b7146988341499f9a6a6ff5) expert cache: the QPN8 dual-form slot at admission (STRATA_QPN8=1) - [`f8c9ca3`](https://github.com/Niko1221/Strata/commit/f8c9ca3361f5b3d840ed9ba66273dc863d9f46c0) bench: the QPN8 prep + chains decomposition and the M>=4 entry-point table (V100) ### 📊 Changes **13 files changed** (+2227 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+12 -0) ➕ `bench/micro/s2_unpack_bench.cu` (+927 -0) ➕ `bench/results/2026-10-02-skinny-expert/README.md` (+87 -0) ➕ `bench/results/2026-10-03-qpn8-prep/README.md` (+55 -0) 📝 `include/strata/core/expert_cache.hpp` (+4 -0) ➕ `include/strata/kernels/s2_qpn8.hpp` (+94 -0) 📝 `src/core/expert_cache.cpp` (+25 -0) 📝 `src/core/peer_experts.cpp` (+4 -1) 📝 `src/core/remote_experts.cpp` (+4 -1) 📝 `src/core/verify.cpp` (+14 -4) ➕ `src/kernels/cuda/s2_qpn8.cu` (+581 -0) ➕ `src/kernels/s2_qpn8_parity.cpp` (+398 -0) 📝 `src/program/generate.cpp` (+22 -9) </details> ### 📄 Description > Resubmitted from #1024: 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 QPN8: a load-time repack of the Q2_0 expert weights at admission plus an m8n8k4 expert GEMV for Volta, split out of #627. The repack doubles the slot at admission and the GEMV builds the per-window A fragment and runs the mma chains; the DP4A path remains the fallback. The entry point pays off only when a window has M >= 4 expert entries; at M < 4 it is slower, so it stays **opt-in: `STRATA_QPN8=1`, default off**. ## Gating The m8n8k4 code is compiled under `#if !defined(__HIPCC__) && defined(STRATA_EXPERIMENTAL_SM60)` with stubs that fall back to DP4A elsewhere. The ready-made engine is unchanged. ## Measured V100-SXM2-16GB, CUDA 12.8, `s2_qpn8_parity --bench`, per window: | entries | DP4A | QPN8 | ratio | | --- | ---: | ---: | ---: | | 10x8 | 109.3 us | 90.6 us | 1.21x | | 10x4 | 73.5 us | 83.7 us | 0.88x | | 10x2 | 56.2 us | 77.0 us | 0.73x | | 10x1 | 50.1 us | 75.6 us | 0.66x | ## Tests - `s2_qpn8_parity` PASS with `STRATA_QPN8=1`: the quantized intermediates are byte-identical (0 of 30600 bytes differ), the FP32-level outputs are within their bound (worst abs 9.5e-6). - `s2_expert_grouped_parity` still bitwise PASS. - Default (QPN8 unset) skips/PASS. ## 32K end-to-end Same setup with `STRATA_QPN8=1`: prefill 1544.4 single / 2197.0 dual vs main's 1557.1 / 2207.0, and decode within its +-15% session noise. The MTP verify window is around M=5, between the measured 10x4 (0.88x) and 10x8 (1.21x) points. The entry point stays opt-in. ## Known gap The per-stage sizing loop for a layer split (~`generate.cpp:3514`) still prices `lay.max_blob`, as in the original #627 commit, so a Volta layer split with `STRATA_QPN8=1` can over-pick a stage and fail `open`. The rest of the admission/verify/generate accounting is updated. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:05:02 +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#3027
No description provided.