mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #573] glm: a cancelled prompt read keeps its last checkpoint and stops between calls #605
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#605
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/573
Author: @rushisan
Created: 10/27/2026
Status: 🔄 Open
Base:
main← Head:glm-cancelled-read-keeps-checkpoint📝 Commits (1)
fa09079glm: a cancelled prompt read keeps its last checkpoint and stops between calls📊 Changes
2 files changed (+45 additions, -3 deletions)
View changed files
📝
docs/SETTINGS.md(+1 -0)📝
src/program/generate.cpp(+44 -3)📄 Description
Problem
Two things about a prompt read the client cancels, with one conversation (no
--parallel):c + 1 < nc), and between calls nothing asksread_stopped()(onlyprompt_between, which is the several-conversation path's). A call of one chunk -MAYA_GLM_CKPT_EVERYat or below the chunk size, or the last piece - never sees the cancel, so the read runs to its end for a client that has gone.snap_tokens.clear(); model.reset(); ckpt_drop_past(0)), including the checkpoints this read had just kept. An agent that gave up waiting and sends the same prompt again reads it from token 0, gives up again at the same point, and so on: on our server (2x RTX 3080, ~950 tokens/s of prefill, a 182K-token prompt, a proxy that waits ~180 s for the first token) that loop held the GPUs for 20 minutes without one answer.Change
read_stopped()is asked; a cancel ends the read there.ckpt_restore, thensnapshot_save) and makes it the snapshot instead of resetting the model. The same prompt again continues from it; a conversation that runs in between sets it aside in a slot as usual. The DSA rows before the checkpoint were written by calls that ended, andckpt_restoresynchronizes the compute stream, so the cancelled call's work in flight cannot land on the restored state.MAYA_GLM_KEEP_CANCELLED=0: dropped as before. A row indocs/SETTINGS.md.Text prompts only (checkpoints are), one conversation only. If #572 (the snapshot before the generation prompt) is merged too, the new guard reads
at < snap_atthere instead ofat < prompt.size() - 1.Measured
v1.1.33, 4x RTX 2080 Ti 22 GB (sm_75, CUDA 12.2), 2x Xeon E5-2673 v4, 247 GB RAM, GLM-5.3 · Maya-S24, 131072 context, greedy, thinking off. A ~35.8K-token prompt with a code word near its start; the client closes the stream at 70% of the measured read time, then sends the same prompt again (optionally with another 3.8K-token chat in between) and asks for the code word:
MAYA_GLM_CKPTS=16MAYA_GLM_KEEP_CANCELLED=0MAYA_GLM_CKPT_EVERY(16384)Before this change (v1.1.33 as released) the cancelled read in the first row was not stopped at all -
done: 0 tokens in 73 s (cancel)- so it was cached whole; the read itself kept the GPUs for its full length after the client had gone. With the change it stops at the next call boundary and keeps the checkpoint there.The same scenarios on 2x RTX 3080 (huihui's abliterated GLM-5.3-Flash UD-Q4_K_XL, 1M context,
--kv int8, layer split): 32768 of 35719 / 35783 cached, answers correct.Not measured: Windows / AMD.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.