[PR #950] [CLOSED] prefill: opt-in pointer-list bypass for gate/up gather (STRATA_PF_PTR_MMQ) #2932

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

📋 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)

  • 098e511 prefill: vendored MMQ slice with pointer-list path (llama.cpp pin 3cf03257)
  • 193e635 prefill: pointer-list bypass behind STRATA_PF_PTR_MMQ (default off)
  • 39b4175 tests: stride-vs-pointer parity incl production shapes
  • f78ec93 docs: Rank-1 pointer bypass numbers (RTX 5090, parity + neutral perf)
  • 6209271 review: neutral wording, drop fork-internal markers
  • 0f45d02 review: 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 zeroed MMQ_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)

  • Answers bit-identical both states on 42/1499/7849-token prompts; STRATA_DBG_NAN=1 clean.
  • prefill_mmq_ptr_test green (gu/dn x all three instances, production shapes, masked-gather branch); ctest entry, skips without sm_80+.
  • Perf: 275 vs 289 ms (tiny, noise), 535 vs 524 ms (medium), 1475 vs 1473 ms long (~5.3K tok/s both) — parity, not a speedup here; the skipped traffic runs overlapped with compute on this card. Kept default-off; slow-link numbers welcome.

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.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/950 **Author:** [@DuncanBetts](https://github.com/DuncanBetts) **Created:** 10/5/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `rank1-ptr` --- ### 📝 Commits (6) - [`098e511`](https://github.com/Niko1221/Strata/commit/098e51142d324c195db623d9e6106c3082af9755) prefill: vendored MMQ slice with pointer-list path (llama.cpp pin 3cf03257) - [`193e635`](https://github.com/Niko1221/Strata/commit/193e6355ea2f74076d5a1ac8180762514bfe6ca6) prefill: pointer-list bypass behind STRATA_PF_PTR_MMQ (default off) - [`39b4175`](https://github.com/Niko1221/Strata/commit/39b41754274baf9f56c68f652c3974a589475c58) tests: stride-vs-pointer parity incl production shapes - [`f78ec93`](https://github.com/Niko1221/Strata/commit/f78ec93540695adb93d80ad076591ff1dbe0e670) docs: Rank-1 pointer bypass numbers (RTX 5090, parity + neutral perf) - [`6209271`](https://github.com/Niko1221/Strata/commit/6209271421820af80cff6475093e5ea9be770b25) review: neutral wording, drop fork-internal markers - [`0f45d02`](https://github.com/Niko1221/Strata/commit/0f45d023d4ff5a72a7f7638d340680ede85c5546) review: hoist ptr gate, drop dead Product fields, accurate comments ### 📊 Changes **13 files changed** (+5469 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `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) </details> ### 📄 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 zeroed `MMQ_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) - Answers bit-identical both states on 42/1499/7849-token prompts; `STRATA_DBG_NAN=1` clean. - `prefill_mmq_ptr_test` green (gu/dn x all three instances, production shapes, masked-gather branch); ctest entry, skips without sm_80+. - Perf: 275 vs 289 ms (tiny, noise), 535 vs 524 ms (medium), 1475 vs 1473 ms long (~5.3K tok/s both) — parity, not a speedup here; the skipped traffic runs overlapped with compute on this card. Kept default-off; slow-link numbers welcome. ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:04:16 +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#2932
No description provided.