mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #386] [CLOSED] GLM several conversations: decode during a prompt read, opt-in (PREFILL_INTERLEAVE, _GAPS) #505
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#505
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/386
Author: @somnergy
Created: 10/22/2026
Status: ❌ Closed
Base:
main← Head:pr/glm-prefill-gaps📝 Commits (2)
7e860cfGLM several conversations: read a new prompt in pieces between decode steps, opt-in (MAYA_GLM_PREFILL_INTERLEAVE)ca030ccGLM several conversations: decode gaps at a prompt read's chunk boundaries, opt-in (MAYA_GLM_PREFILL_GAPS)📊 Changes
10 files changed (+862 additions, -25 deletions)
View changed files
📝
CMakeLists.txt(+3 -2)📝
docs/SETTINGS.md(+2 -0)📝
include/strata/core/glm_model.hpp(+18 -0)➕
include/strata/core/prefill_gaps.hpp(+68 -0)➕
include/strata/core/prefill_pieces.hpp(+57 -0)📝
serve/fake_multi_engine.py(+35 -4)📝
serve/test_multi.py(+80 -0)📝
src/core/glm_prefill.cu(+87 -4)📝
src/program/generate.cpp(+330 -15)➕
tests/core/prefill_pieces_test.cpp(+182 -0)📄 Description
Summary
With
--parallel, admitting a request drains every running request and reads the whole new prompt in one go, so a long read stops every other conversation for all of it. Two opt-in ways to keep them decoding during a read:MAYA_GLM_PREFILL_GAPS=<percent>[,<max gap ms>](a split withMAYA_GLM_SPLIT_ROWS): the read stays one pipelined call; at its chunk boundaries (every part idle, the pipeline and the expert pool's loan kept) the running requests decode for about<percent>% of the time, at least one round, at most<max gap ms>(4000) a gap, plus one gap before each read. A gap that overruns the cap ends the gaps of that read.MAYA_GLM_PREFILL_INTERLEAVE=<tokens>[,<rounds>[,cut]]: the read in pieces with decode rounds between them; for where gaps cannot run (one GPU, no split rows). By default the pieces keep the uncut read's chunk boundaries.STOP, PAUSE and engine errors during a read are handled for both the reader and the decoders (a PAUSE inside a gap keeps its state, taken once the read is over). Unset, the scheduler and the prompt path run as before.
Why
Measured under several concurrent Claude Code sessions (agentic coding: long multi-turn conversations, subagents, tool calls, auto-mode safety checks) through the Anthropic Messages API with
--parallel 8:Measured
Hardware:
Models: GLM-5.3-Flash EXL3 sc 3.10 bpw (every expert in VRAM on [A] and [B]; ~56% on [C], the rest from a 48 GB RAM tier and the SSD) and Maya-L (IQ3_S / IQ4_XS experts, ~85% in VRAM on [A]).
Recommendation
On a split with several conversations, set
MAYA_GLM_PREFILL_GAPS=20: a read takes ~20% longer and nobody waits a whole read.30gives the others more for a longer read. With experts streamed from RAM it works but costs more (+31% on a 90K read), and the cap keeps a slow gap from stretching the read. On one GPU, gaps are off; interleave is the option there (not measured). Leave both off with one conversation at a time, or where only a read's own latency matters.Exactness
Neither is bit-exact. The chunk boundaries are the uncut read's, but a gap's decode (or the steps between interleave pieces) can move experts in and out of VRAM, so a later chunk can find other experts resident, staged or on the CPU lane and sum their outputs in another order. Observed ([B]): with 4 greedy decoders during a 90K read, the long request's answer differed from the setting off while the decoders and a queued request matched; flags off matched the unmodified release.
How it was verified
prefill_pieces_test(piece cuts; the gap gate with a threaded pipeline of 2-3 parts, 1-7 chunks: every part idle in a gap, every chunk read once in order, no deadlock) andsplit_groups_testpass; both commits build; the serve tests pass (345, with the new interleave cases onfake_multi_engine.py);tools/check_hip_compat.pyis clean.MAYA_FAIR_SLICE_S=3, 8 decoders) a PAUSE during the read was deferred and its 89,801-token state kept (the log holds a single ~90K read); 0 errors.MAYA_GLM_PREFILL_KEEPlowered, an A/B against off with experts partly in RAM.Together with #385 (multi-request MTP), running both settings needs one small follow-up commit; it is ready and goes in after the second of the two.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.