Conversation
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.
Summary
Compute running requests' remaining KV reservations once per prefill admission loop, then reuse that total for subsequent waiting requests in the same
schedule()call. The previous implementation dequeued and requeued the complete running queue for every admission attempt.Motivation
With R running requests and W waiting requests, repeated reservation accounting costs O(R × W) queue operations per prefill batch. Running requests do not advance during the prefill loop, so their reservation total can be reused. Capacity, remote-transfer reservations, and newly admitted prefill reservations continue to be checked for every candidate.
Type of Change
perf— performance improvement with unchanged scheduling decisionsTest Results of Involved Models on Supported Platforms
Local CPU validation covered queue order, per-step refresh, standalone admission checks, live prefill/remote reservations, canceled requests, token budgets, decode-only steps, and Mamba exhaustion.
A temporary differential harness compared 500 seeded workloads across six scheduling steps (3,000 exact state comparisons) against the original scheduler from
270feb3. Compared batches, queues, page allocation/order, references, hashes, request state, and remote reservations, including local prefix hits, asynchronous remote transfers, failed transfers, and cancellation. Combined application with #576, #577, and #578 was also validated locally.These checks were performed during development; no unit-test or test-support files are included in the final PR diff. Repository formatting and
git diff --checkpassed.Full-model single-request, offline, sanity, and service tests were not run: local validation is limited to Python scheduler/cache metadata without model weights. Accelerator/model throughput is unmeasured.
Benchmark / Performance Impact
Intel Core i5-14600KF, Python 3.12.13, integer metadata (dtype N/A), CPU not pinned. Timed the entire
schedule()against270feb3withperf_counter_ns. Fresh fixture per call, setup/teardown excluded; 10 warmups, median of 7 rounds of 30 calls. Pool: 4,096 pages, 256 tokens/page; prefix caching off; waiting prompts 16 tokens; running prompts one token plus one generated token; all requests have a 512-token output limit. Batch size equals waiting-request count, token budget 16,384. Temporary local harness is not committed.Benefits grow with both queue sizes. A single candidate has no repeated work to eliminate and measured about 0.1 µs slower. These are local scheduler microbenchmarks, not model throughput.
Notes for Reviewers
270feb3/InfiniLM-v0.2.9c; no dependency on the other optimization PRs.schedule()call, computed only when admission needs it. Decode-only steps and Mamba-full rejection avoid the scan.can_accept_requestgains an optional keyword-onlyrunning_required_blocksargument. Existing calls remain compatible and calculate fresh reservations by default; a supplied total must describe the current prefill loop.CI / ChatOps
Manual CI has not been triggered; model/platform validation remains outstanding.
Checklist
InfiniLM-v0.2.9crelease branch rather thanmain.scripts/format.py; noauto_config.pychanges.