Repository navigation
fix(tp): yield prefill to pending snapshots before locking - #17
LostVector wants to merge 1 commit into
Conversation
|
Thanks for the PR and the careful tests. This is not merged yet. The change itself looks right for The next What is still open is whether the starvation you describe can still happen in that design: a capture waiting while new prompt work keeps getting ahead of it. Upstream's gufo-org#1181 (resume captured prefills before repeating peer work) covers part of it. I will test this on two hosts with a pending capture and concurrent prefills once the merge builds, and report the result here. Until then I'd keep this PR open, not close it. If you can reproduce the starvation on the merged tree, a failing case would help more than a port of this patch. |
In plain English: Saving a chat's progress and processing another chat's prompt share the same machinery. New prompt work can repeatedly get ahead of a save that is already waiting, making the first chat wait longer. This change gives the waiting save a chance to go first before more prompt work starts.
When a snapshot is waiting for the TP call mutex, another request's prefill can acquire that mutex ahead of it. The existing snapshot gate protects advance/decode calls but does not cover prefill.
Take the existing
TpSnapshotGate::Turnbefore the prefill call mutex. Pending captures can then acquire the mutex while prefill waits outside it. This does not preempt an active model call or change the instruction protocol, model results, or collective ordering.Tests exercise the real mirrored runner with two states: prefill waits on a held reservation while snapshot capture must still acquire the mutex and complete. A private
GUFO_CACHE_TESTINGfriend creates the test reservation without adding a production API. The existing two-rank held-capture cancellation test also gains assertions for unsettled state before release, bounded completion afterward and an explicit cancelled result, retaining next-request cache reuse checks.Validation on Neuhaus
rdmabasef070a179:tp_executor_testandtp_snapshot_gate_testpass.These are CPU scheduler/control tests, not a new USB4 or GPU throughput benchmark. The existing gate check and mutex acquisition are separate operations, so this does not promise atomic priority for a reservation arriving after the check. Draft for manual review; no changes to the running cluster.