mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #950] [CLOSED] prefill: opt-in pointer-list bypass for gate/up gather (STRATA_PF_PTR_MMQ) #2932
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#2932
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/950
Author: @DuncanBetts
Created: 10/5/2026
Status: ❌ Closed
Base:
main← Head:rank1-ptr📝 Commits (6)
098e511prefill: vendored MMQ slice with pointer-list path (llama.cpp pin 3cf03257)193e635prefill: pointer-list bypass behind STRATA_PF_PTR_MMQ (default off)39b4175tests: stride-vs-pointer parity incl production shapesf78ec93docs: Rank-1 pointer bypass numbers (RTX 5090, parity + neutral perf)6209271review: neutral wording, drop fork-internal markers0f45d02review: hoist ptr gate, drop dead Product fields, accurate comments📊 Changes
13 files changed (+5469 additions, -18 deletions)
View changed files
📝
CMakeLists.txt(+18 -0)📝
docs/DETAILS.md(+11 -0)📝
include/strata/prefill/moe_mmq.hpp(+14 -0)➕
src/prefill/mmq_ptr/mmq-instance-ptr-iq3_xxs.cu(+9 -0)➕
src/prefill/mmq_ptr/mmq-instance-ptr-iq4_nl.cu(+9 -0)➕
src/prefill/mmq_ptr/mmq-instance-ptr-q2_0.cu(+9 -0)➕
src/prefill/mmq_ptr/mmq-load-tiles.cuh(+1771 -0)➕
src/prefill/mmq_ptr/mmq-vec-dot.cuh(+1243 -0)➕
src/prefill/mmq_ptr/mmq.cuh(+1624 -0)➕
src/prefill/mmq_ptr_dispatch.cu(+50 -0)📝
src/prefill/moe_mmq.cu(+15 -3)📝
src/prefill/prefill.cpp(+86 -15)➕
tests/cuda/prefill_mmq_ptr_test.cpp(+610 -0)📄 Description
Why
On short prompts a large share of expert-layers are resident (tiny IQ3_XXS prompt: 3910 of ~5k), and each pays a full VRAM-to-VRAM gather copy before its group GEMM. Resident gate/up matrices can be read in place through a pointer table instead: ~1.25 MB skipped per resident expert (~21 GB on a 7.8K-token prompt), at the cost of one pointer-table upload per group.
What
STRATA_PF_PTR_MMQ=1(default off). Gate/up reads via a vendored pointer-list MMQ slice (llama.cpp pin 3cf03257, namespace-isolated, 4 additive hunks over upstream); down stays gathered because its 640-wide rows over-read 72 B past the matrix end, which is only safe against zeroedMMQ_TAIL— via pointers that tail is the next slot's gate bytes, and an Inf scale there NaNs column 2559 (found by probe, fixed by construction, documented in-code). Unsupported types, non-native packs, groups over 16, and all non-CUDA backends take the previous path bit-identically.Evidence (RTX 5090 32 GB, IQ3_XXS)
STRATA_DBG_NAN=1clean.prefill_mmq_ptr_testgreen (gu/dn x all three instances, production shapes, masked-gather branch); ctest entry, skips without sm_80+.Ask
Deliberately not unified: the per-position blob/slot arrays mirror the stride path selection on purpose, so the two stay diffable side by side. Happy to fuse them into a struct on request.
Slow-link measurements (older discrete NVIDIA, APUs) and a 2-GPU run for the mirrored peer paths (compile-verified only). Happy to split the stack if preferred.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.