mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[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
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4766
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 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)
06f05d4sm_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 runsnative_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(andSTRATA_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 withoutSTRATA_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) andnative_q8_0_sm60_pack_quiet(the existing pack without its per-matrix log line); the three share one implementation, andnative_q8_0_sm60_pack's signature is unchanged.native_q8_0_sm60_releaseunregisters an in-place entry without freeing it.mtp.cpp:mtp_q8_sm60()is true only withSTRATA_MTP_Q8_SM60=1; the packing calls do nothing unlessSTRATA_Q8_SM60=1is on as well. The nine projections get packed copies (+68.7 MiB on Swift 1.5) because the prompt path'sdraft_kvreads 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-q4heads are untouched. Only the drafter that owns the subset packs and releases it (--batch's shared drafters read the same pointers).native_q8_0_sm60_packstub. HIP: both new functions return false.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:
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 withSTRATA_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).STRATA_STATE_HASHitem 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).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)andthe draft head on the Pascal Q8_0 GEMV.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; onlymtp=differed. Its speed there is not cited, because it was measured together with the deeper pipeline.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 falseare 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-q4draft 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
STRATA_Q8_SM60=1, which needs theSTRATA_EXPERIMENTAL_SM60build.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.