mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #45] [CLOSED] GLM fast path: the indexer key/gate rows in a ring instead of max_ctx rows (-0.8 / -0.6 GB at 128K, exact) #298
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#298
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/mw00/project-maya/pull/45
Author: @sociolog
Created: 10/9/2026
Status: ❌ Closed
Base:
main← Head:pr1-indexer-ring📝 Commits (3)
67da11dGLM fast path: the indexer key/gate rows in a ring (8196 positions) instead of max_ctx rows1d59720score mode: STRATA_GLM_SCORE_PREFILL=1 reads the unscored context through the prompt path97e24baREADME: the Tuning table's row for this change's setting📊 Changes
10 files changed (+199 additions, -68 deletions)
View changed files
📝
README.md(+1 -0)📝
include/strata/core/glm_model.hpp(+9 -0)📝
include/strata/kernels/glm_batch.hpp(+3 -2)📝
include/strata/kernels/glm_fast.hpp(+1 -0)📝
src/core/glm_fast_path.cu(+90 -28)📝
src/core/glm_model.cu(+23 -4)📝
src/core/glm_prefill.cu(+38 -22)📝
src/kernels/cuda/glm_batch.cu(+11 -7)📝
src/kernels/cuda/glm_fast.cu(+7 -4)📝
src/program/generate.cpp(+16 -1)📄 Description
What
The DSA indexer keeps two F32 rows per position - the layer-normed indexer key (
dsa_ik_) and the compressor gate(
dsa_ig_). They are read for exactly one thing: building the pooled key of the pool their position completes(
dsa_prepwhen(p + 1) % kpool == 0,dsa_poolon the prompt path). Every later read goes to the pooled keys. Sothe fast path now keeps them in a ring of 8196 positions (a multiple of kpool; it holds the largest prompt
sub-batch plus the kpool - 1 rows before it) instead of
max_ctxrows.STRATA_GLM_IK_RING:0= a row per position as before,<n>= ring size (at least 2 x kpool). README row added.snap_tail_) and restoresthem with the KDA states - an answer longer than the ring between two turns does not lose them.
MAYALST2; an old slot file fails the layoutcheck and is read again).
refused with a message (cannot happen with the default sizes).
STRATA_GLM_SLOW(reference path) keeps the full rows.STRATA_GLM_SCORE_PREFILL=1for the score mode - the unscored context goes through the prompt path,so prompt-path changes can be held to a score reference (used for the tests below).
Why
These two caches are 47 % of the DSA state. 131072 context, RTX 3090 (layers 0-28) + RTX 3060 12 GB (29-44 + NextN),
Maya-M,
STRATA_GLM_RAM_RESIDENT=1:--bench(CPU plan pinned, two runs each)The saving grows with
--max-context.Tests (real model)
STRATA_GLM_SCOREwith the expert pool and the CPU plan pinned (STRATA_GLM_POOL_GB=6,STRATA_GLM_CPU_PLAN=011233456- otherwise the start-up calibration moves experts between CPU and GPU and the lastbits differ run to run): ring of 8 (wraps every 8 positions) vs no ring = KL 0.000000, identical CPU-lane
expert counts, over 1,135 tokens and over 3,935 tokens (past 2048 tokens of context the indexer's selection
depends on the pooled keys; below that it selects every pool, so a short test cannot catch a wrong key).
STRATA_GLM_PREFILL_SUB=32and ring 64: KL 0.0155 and0.0188 against a prefill-vs-prefill floor of 0.0180 (the prompt path is not bit-reproducible run to run).
STRATA_GLM_SLOT_ROUNDTRIPexercised with ring 64.Not built or run on HIP (the changed kernels are shared code:
dsa_prep/dsa_poolindex rows byp % ring).Checks run on this branch (run on v1.0.16; the branch is rebased onto v1.0.20 - upstream's engine changes since are one INFO line and one comment; the server tests re-run on v1.0.20: 124 OK): builds (sm_75, sm_86);
glm_dsa_parity,glm_ffn_parity,glm_hc_parity,glm_kda_parity,glm_layer_parity--selftest: all PASS;python -m unittest serve.test_server serve.test_tools serve.test_mcp serve.test_detok: 102 tests OK (3 skipped); the--benchrequest sequence (3 answers, 2K and 8K prompts) on the real model: runs clean.The code, the measurements and this description were produced with the help of Claude, an AI assistant by Anthropic.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.