[PR #3751] [CLOSED] [Engine] sm_60: the MTP drafter's draft head and projections on the Pascal Q8_0 GEMV too (STRATA_MTP_Q8_SM60=1, opt-in) #4766

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

📋 Pull Request Information

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

Base: main ← Head: mtp-q8-sm60


📝 Commits (1)

  • 06f05d4 sm_60: the MTP drafter's draft head and projections on the Pascal Q8_0 GEMV too (STRATA_MTP_Q8_SM60=1 with STRATA_Q8_SM60=1, default off)

📊 Changes

4 files changed (+108 additions, -8 deletions)

View changed files

📝 include/strata/kernels/native_mmvq.hpp (+8 -1)
📝 metal/src/engine/stubs_0145.cpp (+3 -0)
📝 src/core/mtp.cpp (+46 -2)
📝 src/kernels/cuda/native_mmvq.cu (+51 -5)

📄 Description

Problem and result

On a GP100 die (Tesla P100 / PH402, compute capability 6.0) STRATA_Q8_SM60=1 (#1424) moves the main head and the dense Q8_0 matrices to the Pascal Q8_0 GEMV, but the MTP drafter's own Q8_0 matrices stay on the generic kernels: its draft head is a private gather of the head's rows for the draft vocabulary (106,299 x 2560 on Swift 1.5, 276 MiB, read once per draft step) and runs native_small_mmvq_kernel, and its nine projections come from the drafter's own dense file, which the GGUF dense loader never sees.

With STRATA_MTP_Q8_SM60=1 (and STRATA_Q8_SM60=1), the draft head subset is packed in place and the nine projections get packed copies, so the drafter's GEMVs take the Pascal kernel too. On four GP100 dies at main's default --pipeline-windows 2, decode goes 48.03 -> 50.14 tok/s (+4.4%, one run per arm, six prompts token-weighted, details below). Every reply stays bit for bit the same: only the drafter's own numbers change in rounding, and drafts are verified. Unset (the default), nothing is packed and the drafter runs exactly the kernels it runs today, with or without STRATA_Q8_SM60=1.

None beyond #1424, whose Pascal Q8_0 GEMV this extends to the drafter (opt-in, GP100 only, no default changes). Independent of #3455 / #3454: this branch is main plus one commit.

Approach

  • native_mmvq.cu: native_q8_0_sm60_pack_in_place (the Pascal planes have the same byte count as the GGUF blocks, so they replace them in the subset's own allocation, staged through the host, and are registered under that pointer) and native_q8_0_sm60_pack_quiet (the existing pack without its per-matrix log line); the three share one implementation, and native_q8_0_sm60_pack's signature is unchanged. native_q8_0_sm60_release unregisters an in-place entry without freeing it.
  • mtp.cpp: mtp_q8_sm60() is true only with STRATA_MTP_Q8_SM60=1; the packing calls do nothing unless STRATA_Q8_SM60=1 is on as well. The nine projections get packed copies (+68.7 MiB on Swift 1.5) because the prompt path's draft_kv reads four of them in the GGUF layout. The draft head subset is packed in place only where every call takes the Pascal kernel (n_in 2560) and nothing else reads it (the prompt path does not); any other shape gets a copy. Q6_K and --mtp-q4 heads are untouched. Only the drafter that owns the subset packs and releases it (--batch's shared drafters read the same pointers).
  • Metal: two "nothing packed" stubs next to the existing native_q8_0_sm60_pack stub. HIP: both new functions return false.
  • The main head, the verify path and the prompt path read exactly what they read before.

Validation

Environment note: everything below was measured with every expert resident in VRAM on four GP100 dies (two PH402 SKU 200 boards, 32 GB HBM2 per die; the Swift 1.5 IQ3_S pack fits whole: no CPU share, no PCIe share, no adaptive tier). A single P100 that keeps experts in RAM or streams them over PCIe was not measured. HIP, SYCL and Metal were not built.

Rig: four GP100 dies (application clocks 715 MHz memory / 1050 MHz graphics, 140 W cap), 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, unpatched. Model: Swift 1.5 IQ3_S (abliterated GSQ-RCO GGUF, dense matrices in Q8_0). Engine arguments, the same on every arm: --serve --expert-cache auto --prefill auto --spec 4 --spec-min-p 0.85 --mtp <drafter> --max-context 1048576 --kv int8 --layer-split 12,24,36 --mtp-window 8192 --pipeline-windows 2 --conversation-cache-mib 32768 --conversation-cache-slots 8 --rope-scaling yarn --rope-scale 4. Environment, the same on every arm: STRATA_Q8_SM60=1 STRATA_STAGE_TRIM=1 STRATA_PREFILL_PIPE=70 STRATA_MMQ_RESIDENT_SORT_NE=1 STRATA_DF_BRANCH=1 STRATA_FUSE_DECODE=1 STRATA_FUSE_WAIT=2 STRATA_SIDE_MIXER=2 STRATA_GR_UP75=1 STRATA_B6_MMVQ_ROWS=1 STRATA_ADAPT_LAG=2 STRATA_ADAPT_NOWAIT=1 STRATA_DECODE_TIMING=1 STRATA_STATE_HASH=1.

Passed:

  • Three arms on main 011c9e60 (engine 0.1.47), one fresh engine each, run once, greedy: M = main unchanged, X0 = this branch with the switch unset, X1 = this branch with STRATA_MTP_Q8_SM60=1. Ten requests per arm: five short prompts (400-512 tokens out), a fresh 26K-token read + 400 out, prompt reads of 240 and 1.15K tokens (16 out), a 26K-token conversation and a 1.1K append to it (16 out).
    • X0 against M: every reply hash and every STRATA_STATE_HASH item equal on all ten requests; the same start-up log lines, the same peak VRAM per die (21,117 / 21,553 / 22,453 / 26,247 MiB).
    • X1 against M: every reply hash equal on all ten; every main-model state item equal (GDN, PLE, tail, pooled, KV). The drafter's K/V hash (mtp=) differs on every request, as expected: its K/V projections now run another summation order. Start-up log: 9 of 9 projections on the Pascal Q8_0 GEMV (STRATA_MTP_Q8_SM60=1, 68.7 MiB more VRAM) and the draft head on the Pascal Q8_0 GEMV.
    • Decode, tokens out / decode time over the six decode requests (one run per arm, so treat the last digit as noise): M 48.00, X0 48.03, X1 50.14 tok/s (X1 over X0 +4.4%). Per request, X0 -> X1: Chinese code 56.9 -> 59.9, SQL 49.4 -> 52.0, English code 47.7 -> 49.7, story 46.4 -> 48.3, explanation 47.5 -> 49.6, the fresh 26K read's 400 tokens 43.1 -> 44.7 tok/s. Accepted drafts moved by at most a couple per reply (203/218 -> 203/218, 153/161 -> 154/160, 156/173 -> 157/174, 179/194 -> 178/196).
    • Peak VRAM: +74 MiB on the drafter's die (26,247 -> 26,321 MiB), the other three unchanged. Prompt reads within -0.8..-2.7% (not claimed).
  • Earlier, on main e88ee39d (engine 0.1.45.3) with 15 requests including a 250K-token read, as one arm of a stack of other opt-in GP100 changes (#3455 and changes of mine not posted yet, among them --pipeline-windows 3): every reply hash and every main-model state item equal with and without this switch; only mtp= differed. Its speed there is not cited, because it was measured together with the deeper pipeline.
  • Builds of this branch: sm_60 with STRATA_EXPERIMENTAL_SM60=ON (strata) and sm_86 without it (strata), both clean.

Failed: none observed.

Not run: HIP, SYCL and Metal builds (no such machine here; the two Metal stubs and the HIP return false are compiled by neither of my builds). The PR is a draft for that reason: a HIP, SYCL or Metal build by someone who has one would close it. Cards other than GP100. A Q6_K or --mtp-q4 draft head (untouched by design). --batch's shared drafters (they read the same pointers). Packs other than Swift 1.5 IQ3_S. Repeated timing runs on this revision (one run per arm).

Limits

  • GP100 only in practice: it needs STRATA_Q8_SM60=1, which needs the STRATA_EXPERIMENTAL_SM60 build.
  • The drafter's numbers differ in rounding from the unchanged engine's, so a draft can differ and the acceptance with it; the replies cannot.
  • +68.7 MiB of VRAM on the drafter's die for the projection copies (the draft head is packed in place, no extra).

🔄 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/3751 **Author:** [@ruibeikaa](https://github.com/ruibeikaa) **Created:** 10/22/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `mtp-q8-sm60` --- ### 📝 Commits (1) - [`06f05d4`](https://github.com/Niko1221/Strata/commit/06f05d417a8ecea1be5f911973eedb5ca54f446d) sm_60: the MTP drafter's draft head and projections on the Pascal Q8_0 GEMV too (STRATA_MTP_Q8_SM60=1 with STRATA_Q8_SM60=1, default off) ### 📊 Changes **4 files changed** (+108 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `include/strata/kernels/native_mmvq.hpp` (+8 -1) 📝 `metal/src/engine/stubs_0145.cpp` (+3 -0) 📝 `src/core/mtp.cpp` (+46 -2) 📝 `src/kernels/cuda/native_mmvq.cu` (+51 -5) </details> ### 📄 Description ## Problem and result On a GP100 die (Tesla P100 / PH402, compute capability 6.0) `STRATA_Q8_SM60=1` (#1424) moves the main head and the dense Q8_0 matrices to the Pascal Q8_0 GEMV, but the MTP drafter's own Q8_0 matrices stay on the generic kernels: its draft head is a private gather of the head's rows for the draft vocabulary (106,299 x 2560 on Swift 1.5, 276 MiB, read once per draft step) and runs `native_small_mmvq_kernel`, and its nine projections come from the drafter's own dense file, which the GGUF dense loader never sees. With `STRATA_MTP_Q8_SM60=1` (and `STRATA_Q8_SM60=1`), the draft head subset is packed in place and the nine projections get packed copies, so the drafter's GEMVs take the Pascal kernel too. On four GP100 dies at main's default `--pipeline-windows 2`, decode goes 48.03 -> 50.14 tok/s (+4.4%, one run per arm, six prompts token-weighted, details below). Every reply stays bit for bit the same: only the drafter's own numbers change in rounding, and drafts are verified. Unset (the default), nothing is packed and the drafter runs exactly the kernels it runs today, with or without `STRATA_Q8_SM60=1`. ## Related discussion None beyond #1424, whose Pascal Q8_0 GEMV this extends to the drafter (opt-in, GP100 only, no default changes). Independent of #3455 / #3454: this branch is main plus one commit. ## Approach - `native_mmvq.cu`: `native_q8_0_sm60_pack_in_place` (the Pascal planes have the same byte count as the GGUF blocks, so they replace them in the subset's own allocation, staged through the host, and are registered under that pointer) and `native_q8_0_sm60_pack_quiet` (the existing pack without its per-matrix log line); the three share one implementation, and `native_q8_0_sm60_pack`'s signature is unchanged. `native_q8_0_sm60_release` unregisters an in-place entry without freeing it. - `mtp.cpp`: `mtp_q8_sm60()` is true only with `STRATA_MTP_Q8_SM60=1`; the packing calls do nothing unless `STRATA_Q8_SM60=1` is on as well. The nine projections get packed copies (+68.7 MiB on Swift 1.5) because the prompt path's `draft_kv` reads four of them in the GGUF layout. The draft head subset is packed in place only where every call takes the Pascal kernel (n_in 2560) and nothing else reads it (the prompt path does not); any other shape gets a copy. Q6_K and `--mtp-q4` heads are untouched. Only the drafter that owns the subset packs and releases it (`--batch`'s shared drafters read the same pointers). - Metal: two "nothing packed" stubs next to the existing `native_q8_0_sm60_pack` stub. HIP: both new functions return false. - The main head, the verify path and the prompt path read exactly what they read before. ## Validation **Environment note: everything below was measured with every expert resident in VRAM on four GP100 dies** (two PH402 SKU 200 boards, 32 GB HBM2 per die; the Swift 1.5 IQ3_S pack fits whole: no CPU share, no PCIe share, no adaptive tier). A single P100 that keeps experts in RAM or streams them over PCIe was not measured. HIP, SYCL and Metal were not built. Rig: four GP100 dies (application clocks 715 MHz memory / 1050 MHz graphics, 140 W cap), 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, unpatched. Model: Swift 1.5 IQ3_S (abliterated GSQ-RCO GGUF, dense matrices in Q8_0). Engine arguments, the same on every arm: `--serve --expert-cache auto --prefill auto --spec 4 --spec-min-p 0.85 --mtp <drafter> --max-context 1048576 --kv int8 --layer-split 12,24,36 --mtp-window 8192 --pipeline-windows 2 --conversation-cache-mib 32768 --conversation-cache-slots 8 --rope-scaling yarn --rope-scale 4`. Environment, the same on every arm: `STRATA_Q8_SM60=1 STRATA_STAGE_TRIM=1 STRATA_PREFILL_PIPE=70 STRATA_MMQ_RESIDENT_SORT_NE=1 STRATA_DF_BRANCH=1 STRATA_FUSE_DECODE=1 STRATA_FUSE_WAIT=2 STRATA_SIDE_MIXER=2 STRATA_GR_UP75=1 STRATA_B6_MMVQ_ROWS=1 STRATA_ADAPT_LAG=2 STRATA_ADAPT_NOWAIT=1 STRATA_DECODE_TIMING=1 STRATA_STATE_HASH=1`. **Passed:** - Three arms on main 011c9e60 (engine 0.1.47), one fresh engine each, run once, greedy: M = main unchanged, X0 = this branch with the switch unset, X1 = this branch with `STRATA_MTP_Q8_SM60=1`. Ten requests per arm: five short prompts (400-512 tokens out), a fresh 26K-token read + 400 out, prompt reads of 240 and 1.15K tokens (16 out), a 26K-token conversation and a 1.1K append to it (16 out). - X0 against M: every reply hash and every `STRATA_STATE_HASH` item equal on all ten requests; the same start-up log lines, the same peak VRAM per die (21,117 / 21,553 / 22,453 / 26,247 MiB). - X1 against M: every reply hash equal on all ten; every main-model state item equal (GDN, PLE, tail, pooled, KV). The drafter's K/V hash (`mtp=`) differs on every request, as expected: its K/V projections now run another summation order. Start-up log: `9 of 9 projections on the Pascal Q8_0 GEMV (STRATA_MTP_Q8_SM60=1, 68.7 MiB more VRAM)` and `the draft head on the Pascal Q8_0 GEMV`. - Decode, tokens out / decode time over the six decode requests (one run per arm, so treat the last digit as noise): M 48.00, X0 48.03, X1 50.14 tok/s (X1 over X0 +4.4%). Per request, X0 -> X1: Chinese code 56.9 -> 59.9, SQL 49.4 -> 52.0, English code 47.7 -> 49.7, story 46.4 -> 48.3, explanation 47.5 -> 49.6, the fresh 26K read's 400 tokens 43.1 -> 44.7 tok/s. Accepted drafts moved by at most a couple per reply (203/218 -> 203/218, 153/161 -> 154/160, 156/173 -> 157/174, 179/194 -> 178/196). - Peak VRAM: +74 MiB on the drafter's die (26,247 -> 26,321 MiB), the other three unchanged. Prompt reads within -0.8..-2.7% (not claimed). - Earlier, on main e88ee39d (engine 0.1.45.3) with 15 requests including a 250K-token read, as one arm of a stack of other opt-in GP100 changes (#3455 and changes of mine not posted yet, among them `--pipeline-windows 3`): every reply hash and every main-model state item equal with and without this switch; only `mtp=` differed. Its speed there is not cited, because it was measured together with the deeper pipeline. - Builds of this branch: sm_60 with `STRATA_EXPERIMENTAL_SM60=ON` (`strata`) and sm_86 without it (`strata`), both clean. **Failed:** none observed. **Not run:** HIP, SYCL and Metal builds (no such machine here; the two Metal stubs and the HIP `return false` are compiled by neither of my builds). The PR is a draft for that reason: a HIP, SYCL or Metal build by someone who has one would close it. Cards other than GP100. A Q6_K or `--mtp-q4` draft head (untouched by design). `--batch`'s shared drafters (they read the same pointers). Packs other than Swift 1.5 IQ3_S. Repeated timing runs on this revision (one run per arm). ## Limits - GP100 only in practice: it needs `STRATA_Q8_SM60=1`, which needs the `STRATA_EXPERIMENTAL_SM60` build. - The drafter's numbers differ in rounding from the unchanged engine's, so a draft can differ and the acceptance with it; the replies cannot. - +68.7 MiB of VRAM on the drafter's die for the projection copies (the draft head is packed in place, no extra). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 15:38:54 +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#4766
No description provided.