mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #61] [MERGED] GLM prompts: skip the last layer's unused outputs on a single device #310
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#310
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/61
Author: @boxwrench
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @mw00
Base:
main← Head:perf/terminal-layer-skip📝 Commits (2)
813b923perf(glm): skip unused single-device prefill tail outputsd1183a9perf(glm): no prestage for the skipped terminal layer📊 Changes
2 files changed (+20 additions, -6 deletions)
View changed files
📝
README.md(+1 -0)📝
src/core/glm_prefill.cu(+19 -6)📄 Description
On a single device with no NextN block loaded, a prompt chunk's last layer computes outputs nothing reads: decode computes the final prompt token and its logits on its own (
generate.cppprefills all but the last token), the next chunk starts from its own embeddings, and snapshots/slots save only recurrent and cache state. This skips that layer's attention output projection and FFN (both mHC write halves) after all of its KDA/DSA cache updates have run, and doesn't prestage experts for it.The skip applies only when the whole trunk is on one device,
mtp_il_ < 0(no NextN cache fill to feed), and noGLM_CB_DIRseam dump is set. Splits, a loaded NextN block and decode keep the full path.STRATA_GLM_PREFILL_TAIL_SKIP=0turns it off (README row added). It adds no kernels and no CUDA/HIP calls, so CUDA single-GPU prompts get it too.Same output. On Strix Halo (gfx1151, every expert resident, a fresh load per prompt), skip on vs off: three prompts of 220 / 1,122 / 2,682 tokens (1 / 3 / 6 chunks) x 64 greedy tokens, and all 192 token IDs, 29.7M logits, full prefill cache dumps, saved snapshots and restored states are byte-identical. With NextN forced on (
STRATA_GLM_MTP=1) the skip stays off, as it should.glm_layer_parityandglm_model_testpass on gfx1151, gfx1201 and gfx1100.Speed (one request per size, same binary):
Decode is unchanged. On the R9700, greedy text with tiered experts varies between runs of the same arm, by about as much as between arms, so the byte-identical check above (all experts resident) is the one that counts.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.