Conversation
|
Thanks for calling out #571. I agree that the two changes are orthogonal: #573 controls phase rotation and chunked-prefill lifecycle, while #571 only orders initial admission from the waiting queue and keeps Decode non-preemptive. |
Exercise shared CLI, service and example forwarding once with both policies enabled. Retain capability rejection, PP worker forwarding, cache lifetimes and native output checks while removing duplicated setup.
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
Integrate paged-prefix LRU/optional SLRU with bounded Prefill scheduling, TP2 Decode graphs and PP2 eager execution. Intermediate chunks publish only completed KV pages and emit no token; completed requests and cancellation release shared page references consistently.
Motivation
Long uninterrupted Prefill delays other requests, while cache reclamation can discard reusable prefixes. These mechanisms share admission/publication/release state, so the PR includes their integration checks. It follows the input slicing/continuation idea in #371 and adds explicit phase rotation and current per-request KV ownership; #571's admission priority is a separate feature. Neither proposal is merged here.
Type of Change
feat— optional cache policy and chunked execution combinationsfix— integrated cache admission and outputless execution contractsTest Results of Involved Models on Supported Platforms (Please attach screenshots)
Current retained suite at
cb243d9a(2026-09-17): 83 CPU tests passed. Consolidate the cache/chunk configuration suites and duplicate output checks, removing 230 test lines while retaining cache ownership, admission failure, cancellation, deferred remote-KV release, capacity and phase-progress coverage. Production implementation is unchanged. The earlier 101-test counts below describe the historical suite before consolidation, not the current test count. Saved current output: immutable evidence. The historical GPU/performance matrix was not repeated for this test-only update.Current usage guide and regression-test commands. Archived machine-readable results and historical reproduction commands: integrated validation. The screenshot below renders archived audited results, not a new GPU run or an upstream CI pass. It also includes the separately deferred Prefill-graph experiment; those entries are outside this PR. The scope table below identifies the relevant historical coverage.
First/last local KV layers were poisoned and checked for expected writes and unchanged values outside scheduled slots. PP stage 1 was checked separately. All cases ended with zero references and all 16 pages usable. Device-graph launches were counted directly, including both TP ranks. A final output-suppression check and an asynchronous 160-output-token mixed-request comparison also passed.
Earlier validation after deferring Prefill graphs (before test consolidation): all 101 CPU regressions passed. Five affected C++ translation units were rebuilt and linked with 122 unchanged cached objects; the resulting library contains no experimental Prefill-capture/replay symbols. A two-A6000 Qwen2.5-1.5B FP16 check (TP2/PP1, SLRU, page256/pool16, chunk300) observed zero graph launches for intermediate Prefill and 28 Decode launches across both ranks. Shared/repeated output IDs matched the archived same-configuration reference; cancellation returned all 16 pages with zero references. This uses the new native binary and current Python source. It is a scoped correctness rerun, not a clean full build or a new performance/C500 matrix.
Template test entrypoints and disposition:
examples/test_infer.pysingle requestexamples/bench.pyoffline performancetest/bench/test_benchmark.pysanityscripts/test_perf.pyserviceThese substitutions and untested entries are explicit; they do not claim that the named scripts or the broader quality/service matrices passed.
Benchmark / Performance Impact
Measured value: retain reusable prefixes under pressure, bound the pause caused by long Prefill, and combine chunking with device graphs. These are distinct workload-dependent benefits. The table reports archived component experiments before final integration, not a full performance rerun of the PR head. Final integration correctness is reported separately above.
How measured: NVIDIA uses CUDA12.4/driver580.105.08; paged KV, page256, greedy fixed output budgets. The TP2 mixed test emits 160 tokens total; the long request arrives after the active request's eighth output and the late short request 20 ms later. TP2 table values are medians of three runs. LRU uses 1056-input/32-output requests with 16 excluded warmups; SLRU uses 544-input/8-output requests. Cache counts are actual admitted hits and remaining prompt work.
C500 is a 50% compute / 32,000 MiB slice, six CPU cores, MACA3.5.3.20, driver3.8.30, torch2.8.0+metax3.5.3.9 and flash-attn2.6.3+metax3.5.3.9torch2.8. The archived modes use the same binary, BF16, TP1, page256/pool32 and prefix reuse off. Single requests: 2048 input/16 output, three measurements after warmup; mean TTFT and mean of per-request median ITL. Mixed: 128-input/48-output active request, 2048-input/16-output competitor after the eighth token, two windows; rate = 56 remaining output tokens / window duration. This is not sustained HTTP serving throughput. The archived output controls passed and actual graph launches were counted. The archive also contains Prefill-graph modes; their measurements are outside the submitted scope.
Tradeoffs and negative controls: LRU under a 128-page cyclic working set in a 64-block pool (7B, one run) reduced hits 33,792 -> 0 and output rate 34.96 -> 33.16 token/s (-5.14%). SLRU has no work reduction on the tested no-reuse, overcapacity-cycle and hotspot-shift metadata traces. Chunking can worsen p95 ITL despite reducing the maximum pause. Decode graphs require initialization and retained workspace; full graph memory overhead was not measured. FP16 prefix-shape output differences remain documented.
CPU-only reclaim microbenchmark: pool65,536, 90% pinned, Python3.11.15, five method-call samples: one-block median 2,058.758 us -> 18.217 us; retained Python metadata +5,767,328 bytes. Pool construction and hashing are excluded; this is not a GPU/model speedup.
Final integrated TP2 check: 2048-token long prompt, two 128-token prompts, 160 outputs, chunk512, prefix off, one window per mode: 161.71 token/s eager vs 161.02 token/s Decode graph; all output IDs match. No throughput gain is established by this pair. PP2 has lifecycle/correctness evidence, not a measured performance gain.
Archived C500 tables, setup, aggregation, historical version provenance, reproduction entrypoints and limits (including the separately deferred Prefill-graph experiment): performance report. Audited per-run values and source artifact hashes: measurement JSON. Benefits from different experiments must not be multiplied or added together.
Notes for Reviewers
Submission scope: the final diff retains implementation, regression tests and concise usage documentation. Two experiment-specific benchmarks, their 12 harness tests, result JSON/PNG files and repetitive reports are retained at archive revision
a7345fa2, not proposed for merge. The prefix-cache experiment and mixed-request experiment remain available there. The archived evidence links and screenshot use immutable revisions; the full historical hardware/performance matrix has not been rerun; current scoped validation is reported above.Review the pin/promote/release invariants, publication after all PP stages complete, and eager-Prefill/Decode-graph dispatch. Experimental fixed-size Prefill graph capture/replay has been removed from this PR and retained on a local experiment branch. PP graphs, TP2/PP2, remote-KV/chunk integration, MoE and multimodal chunking remain excluded. Quantized-model chunking has not been validated; the dense-model check does not reject quantization metadata. Full graph memory overhead and sustained service throughput are not measured. A historical near-tied FP16 token mismatch between prefix execution shapes is preserved in the documentation; this PR does not promise universal bitwise equivalence.
The C500 checks use the companion InfiniCore varlen ABI fix. Device graphs require an InfiniCore build with
--graph=y; the LM flag alone can otherwise replay host operators. Native builds succeeded using unchanged cached objects where available; a clean full build remains CI validation.CI / ChatOps
At this head, the upstream CI run reports
action_required; repository-side approval is required before jobs can start. Fork formatting success is reported separately below.Latest
cb243d9afork push checks passed: CI formatting and Ruff. This does not replace the pending full accelerator build.Local repository formatting and diff checks passed. The formatting repair at
32d00aaepassed fork CI format and Ruff. The scheduler reuse commita7345fa2passed fork CI format and Ruff, full-PR local formatting, and the targeted CPU/GPU checks above. Upstream PR workflows still need approval; the full hardware matrix also requires manual dispatch and upstream runner/secret access. Uncompleted checklist items remain unchecked, including a clean affected-platform build, remaining detailed style review and untested-platform reviewer coverage.Checklist
Title, Branch, and Commits
feat(nvidia): …,fix(cuda/gemm): …).<type>/xxx-yyyy-zzzzwhere<type>matches the PR title's Conventional Commits type and words are joined with hyphens (seeCONTRIBUTING.md§Branches).CONTRIBUTING.md§Pull Requests).InfiniLM-v0.2.9cbase without development merge history; implementation, formatting and evidence commits are separately reviewable.fixup!/squash!/wipcommits remain.Scope and Design
CONTRIBUTING.md§Code/General).printf/std::cout/print(...)left behind, orTODOwithout an owner and issue link.General Code Hygiene (applies to all languages)
CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General).the `seqlens_k` tensor) (CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General).CONTRIBUTING.md§Code/General; §Python).C++ Specific (if C++ files changed)
CONTRIBUTING.md§C++).CONTRIBUTING.md§C++).new/delete; RAII / smart pointers / existing allocators are used.scripts/format.py.csrc/models/llama_legacy/.Python Specific (if Python files changed)
CONTRIBUTING.md§Python).CONTRIBUTING.md§Python).scripts/format.py.python/infinilm/auto_config.py.Testing
examples/test_infer.py), or specify the reason for skipping.examples/bench.py), or specify the reason for skipping.test/bench/test_benchmark.py), or specify the reason for skipping.python/infinilm/server/inference_server.py+scripts/test_perf.py), or specify the reason for skipping.Build, CI, and Tooling
/retestwas requested.Documentation
README.md,CONTRIBUTING.md, or inline docs updated when behavior, build flags, or developer workflow changed.Security and Safety
CI status after submission: the upstream run reports
action_requiredwith zero jobs started. Repository-side action is still required; this is not a completed build/test result.