Conversation
11 tasks
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
Build KV slot mappings one physical-page range at a time, and reuse the mapping helper for allocation and speculative append. Keep a dedicated single-token path. This removes repeated division/modulo for tokens within the same page.
Motivation
Long prefill and speculative intervals previously calculated each physical slot separately. The new implementation produces identical lists for partial pages and reordered physical blocks with fewer Python iterations.
Type of Change
perf— performance improvement with unchanged behaviorTest Results of Involved Models on Supported Platforms
Local CPU validation covered boundary intervals, 2,000 seeded randomized intervals, cached-prefix allocation, speculative append/rollback, and allocation failure. These checks were performed during development; no unit-test or test-support files are included in the final PR diff. Repository formatting checks and
git diff --checkpassed.Full-model single-request, offline, sanity, and service tests were not run: this validation isolates Python cache metadata and has no local model weights. No accelerator throughput claim is made.
Benchmark / Performance Impact
Intel Core i5-14600KF, Python 3.12.13; Python integer metadata (dtype N/A). Baseline:
270feb3. Timedupdate_blocks_slotwith reversed physical-page order and logical start offset 7; fixture creation excluded. Five warmup calls, median of seven rounds,max(10, 100000 // token_count)calls per round,perf_counter_ns; CPU not pinned. Outputs checked against baseline before timing. Temporary local harness, not committed.These are CPU microbenchmarks, not end-to-end model results; gains depend on interval and page sizes.
Notes for Reviewers
Branch starts directly at
270feb3onInfiniLM-v0.2.9c. Allocation, ownership, hash publication, and eviction behavior are unchanged.CI / ChatOps
CI has not been triggered. Accelerator/model validation remains for maintainers with a configured environment.
Checklist
perf/branch; squashable commit history; no merge/fixup/WIP commits.InfiniLM-v0.2.9crelease branch (instead ofmain).scripts/format.py; no changes toauto_config.py.