mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #93] [MERGED] Fair slices for concurrent requests (STRATA_FAIR_SLICE_S, off by default) and the engine's PAUSE #330
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#330
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/93
Author: @0xPreDa
Created: 10/10/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @mw00
Base:
main← Head:pr-fair-slices📝 Commits (1)
305f450Fair slices for concurrent requests (STRATA_FAIR_SLICE_S) and the engine's PAUSE📊 Changes
5 files changed (+480 additions, -7 deletions)
View changed files
📝
README.md(+1 -0)📝
serve/server.py(+200 -5)➕
serve/test_fair.py(+224 -0)📝
src/core/glm_fast_path.cu(+4 -0)📝
src/program/generate.cpp(+51 -2)📄 Description
Why
The server runs one request at a time behind a lock. A short request, such as an agent's title or summary side request, or a second user, waited for the whole of a long answer.
What changes
FairLockthat serves waiters in arrival order (threading.Lockpromises no order) and can tell the holder someone is waiting.STRATA_FAIR_SLICE_S=<s>(0, off, by default). An answer that has been decoding for s seconds while another request waits yields the engine and queues again behind it. It then resumes with prompt + the ids it already wrote, so the client sees one uninterrupted stream. The thinking budget carries over. Image requests are never sliced.PAUSE. It is a STOP that moves the snapshot from the prompt to the last fed token. The resumed request then reads one token instead of everything it wrote.READYadvertisespause.PAUSE keep, for a request's first slice. The prompt's state goes to a slot and is anchored there: its own continuations do not supersede it until it is taken back. Without this, the chat's next turn re-read the whole conversation, because its history drops the reasoning and so does not extend the written answer.decode_specon a split now restores the head group's KDA states from the backup it already keeps when it returns. The whole model then stands exactly atpos_, so a snapshot taken right after is consistent. This is a few MB of device copy at the end of a request. Nothing else read that state.Measured (4× RTX 4090, Maya-S24, slice 15–20 s)
PAUSE keep.Default behaviour
With the setting off, two things change: queued requests are served in arrival order, and the head KDA restore above runs at the end of each split speculative decode.
Notes
serve/test_fair.py(8 tests). The server tests pass,tools/check_hip_compat.pypasses, and the tools tests give the same results asmain.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.