Repository navigation
[Fix] scheduler: Drop finished requests from the running batch before every admission - #44351
Merged
Merged
Conversation
hnyls2002
requested review from
Ying1123,
merrymercy and
xiezhq-hermann
as code owners
October 14, 2026 23:37
Collaborator
Author
|
/rerun-test test_load_snapshot_server.py registered/prefill_only/test_score_api.py test_score_engine.py test_overlap_skip_finishing_decode.py test_mixed_chunked_prefill.py test_retract_decode.py test_priority_scheduling.py registered/observability/test_metrics.py test_eagle_dp_attention.py test_scripted_core_1gpu.py |
Collaborator
Author
|
/tag-and-rerun-ci |
Contributor
|
🚀 🚀 🚀 |
This was referenced Oct 15, 2026
This was referenced Oct 15, 2026
jhsmith409
added a commit
to jhsmith409/sglang-rtxpro6000
that referenced
this pull request
Oct 18, 2026
…every admission Finished requests were filtered out of the running batch before admission only when the batch was prefill-only. Under the overlap scheduler a prefill's requests are merged into the running batch before its result marks them finished, so a request that ends on its first token (a stop or an abort) kept counting toward running_bs, and kept batch_is_full set, until a decode step ran update_running_batch. During a long chunked prefill no decode runs: a 262K-token prompt is about 64 chunks of 4096, and with --max-running-requests 4 the stale request held one of the four slots for that whole time. Filter every step and clear batch_is_full when the filter removed a request. ScheduleBatch.filter_batch returns early when nothing finished. Applied from upstream sgl-project/sglang#44351 (Liangsheng Yin), with its test. The test's stub batch takes Penny's filter_batch(chunked_req_to_exclude) signature; test_scheduler_chunked_req_gate's mock batch gets a batch_size, as upstream's did. Co-Authored-By: Claude Opus 5.5 <[email protected]>
detain
pushed a commit
to detain/sglang
that referenced
this pull request
Oct 19, 2026
… every admission (sgl-project#44351) (cherry picked from commit 3b5ae4e) (cherry picked from commit 8842656bec0c6475d1bfb4e8403f368e9bbe4fad)
kenji21
pushed a commit
to kenji21/sglang-rtxpro6000
that referenced
this pull request
Oct 22, 2026
… admission Minimal port of sgl-project/sglang#44351 for runtime evaluation on Penny3.0.2. Upstream: head 5c5454a20255604c26706f631cd30ba11d187069, merged 3b5ae4e Author: Liangsheng Yin <[email protected]> Adapted to this checkout, both necessary to keep base behaviour: - test/registered/unit/managers/test_scheduler_hicache_events.py does not exist here, so that upstream fixture tweak is dropped, and the new regression's batch fake follows this fork's ScheduleBatch.filter_batch signature. - The empty prefill-only batch_is_full reset of the replaced block is kept as an is_empty() term. Upstream needs no such term because its _get_new_batch_prefill_raw resets the latch for any empty batch; this fork has no such reset, so dropping it would latch an empty prefill-only batch shut permanently (no retry after a session-held row is freed). Covered by a base-parity regression; finished-request filtering still runs every step as upstream intended.
detain
added a commit
to detain/sglang
that referenced
this pull request
Oct 30, 2026
…entries 122,198,200,211,215,220,267,268,305 Re-plants the scheduler.py fork-hunks (replant/...managers__scheduler.py.fork-hunks.patch) onto the post-sgl-project#46977 admission structure. tp_worker marker consumed (15/23 B4 markers still on the tree; per-file counts, damage-state from entry 310's map). PER-HUNK DECISIONS (all VERIFIED against the merged tree, not taken on faith): - entry 122 (sgl-project#40458): grammar-sync overlap disable RE-PLANTED for mixed mode (is_decode() OR is_mixed()) + the fork's trimmed comments; upstream's host-draft-only arm was the pre-sgl-project#40458 form (origin/main verified: absent). - entry 220 (sgl-project#39765, OPEN port): _has_pending_mamba_cache_update + the early pop_and_process/short-circuited disable-overlap RE-PLANTED into event_loop_overlap; the require_mlp_sync/disable/extra-buffer gate verbatim. - entry 198 (sgl-project#37612): THE CATCHER — B3-5 landed the raiser; the try/except MambaCowAllocError around init_next_round_input (res=NO_TOKEN, request stays queued; the revert block + unconditional alloc_group_end were already in the merged tree = the no-leak halves VERIFIED PRESENT) RE-PLANTED with the import. COW component test re-anchored to the #46970x kv_storage seam the B3-5 replant moved _state() behind (stub was the pre-split mamba_allocator shape). - entry 268 (sgl-project#46643, OPEN port -- VERIFIED NEVER MERGED: git log 12dc623..2a6c204 --grep 46643 = ZERO; only sgl-project#45491/sgl-project#45435/sgl-project#45472/sgl-project#45670 of the briefed merged-list arrived in-range): the UNCONDITIONAL batch_is_full clear RE-PLANTED on the scheduler side, subsuming the entry-198 hybrid-SSM arm and the priority-preemption/is_empty arms (policy side lands in B4-3). - entry 267 (sgl-project#46496): retract_decode new_token_ratio FLOOR clamp RE-PLANTED. - entry 211: triton_load_watch.prewarm_device_loads(self.model_worker) line RE-PLANTED between install() and mark_serving_started (the utils-side function survived the merge; only the call site was dropped). - entry 200 (sgl-project#43527) CAPACITY PAIR RE-PLANTED: model_runner .logical_max_total_num_tokens passes allocator= again (the configurator's PageInterleavePoolAllocator -> allocator.size branch SURVIVED the merge byte-identical, so the merged tree had the fork predicate with upstream's consumer-side multiplications = DOUBLE-COUNT); the three scheduler * kv_shard_widening multipliers back to the fork form (pool-stats shape, load_inquirer, and the init_req one-page-per-shard subtraction); tp_worker drops page_interleave_shard_size x + import. Upstream's invariant-checker hunk: OBSOLETE (the constructor no longer takes max_total_num_tokens -- absorbed by refactor). - entry 215 (sgl-project#44351/sgl-project#44401/sgl-project#44420): VERIFIED ALREADY PRESENT at the merge (filter_batch-every-step + reset ride, num_held_rows, budget_state FIRST statement, PD-gate deletion all byte-compare to the fork form) -- DEDUPED, no edit. Entry 107's local early-revision of sgl-project#40940 stays superseded (entry 215 rule), and its re-plant here would double-count. - entry 220's/305's pause-window busy accounting + write_fence_stream + is_empty arm: VERIFIED PRESENT (entry 305 landed patch-identical via sgl-project#46127; the fence assignment is the B3-2 controller half) -- DEDUPED. TEST FIXTURE RE-ANCHORS (not B2's: no markers, pure new-upstream-contract drift, per the entry-198 fixture-adaptation precedent): the two hybrid-ssm admission stubs gain disagg_prefill_bootstrap_queue=None (upstream's routing-key bootstrap_queue arg in calc_priority arrived in-range). PRUNE vs BREAKAGE (managers −523sub audit): the three managers test files vanished in-range (test_schedule_policy_dfs_weight, test_scheduler_batch_is _full_latch, test_uno_token_accounting) were ALL deleted by upstream's OWN sgl-project#45672 prune (3438ed6). Two are byte-identical upstream copies = zero fork delta. The third carried a 3-line fork comment/stub delta whose SEMANTICS the re-planted unconditional clear pins: its case was the is_empty-arm mirror of test_scheduler_hybrid_ssm_admission_latch (present, green, hybrid_swa/non-hybrid arms included) -- NOT re-homed, recorded. ACTUALS (damage -> after, CVD=9, prod venv, PYTHONPATH=python, per-file): test_scheduler_hybrid_ssm_admission_retry 4F -> ** 4P ** test_scheduler_hybrid_ssm_admission_latch 3F -> ** 4P ** test_mamba_prefill_cache_boundary 2F/12subF -> ** 5P/12sub EXACT (220 pin) ** test_scheduler_retract_ratio 1F -> ** 2P EXACT (267 pin) ** test_scheduler_init_req_max_new_tokens 1F -> ** 10P/6sub ** test_scheduler_grammar_mixed_tail_sync 1F -> ** 4P ** adjacent scheduler-stub files (held_row, running_batch_finished, pause_generation, disagg_idle, dp_converted, hicache_events) 56P/64sub UNMOVED -- no regression from the clear/catcher/capacity edits. Lint: ruff format + F821/E9 clean on all five files; imports OK (no GPU execution, no push). Co-Authored-By: OpenCode <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
running_batchinget_next_batch_to_runon every step, after thelast_batchmerge, and reopen admission (batch_is_full = False) when that shrinks the batch. This replaces the prefill-only special case.running_batchbefore its result marks the requests that finish at prefill (max_new_tokens=1, or a stop on the first token). The only other cleanup,update_running_batch, runs on decode steps, which never come while chunked prefill keeps producing batches, so#running-req,num_running_reqs, and/v1/loadsgrow for the whole run.batch_size/filter_batchthe new code reads.Behavior change: finished requests now leave the running batch before admission on every step, so a workload whose running batch is full can admit a waiting request one step earlier than on main.
Fixes #43961; supersedes #43960.
CI States
Latest PR Test (Base): ❌ Run #38655199864
Latest PR Test (Extra): ❌ Run #38655199726
Latest PR Test (AMD ROCm 10): ⏳ Run #38655199710