Repository navigation
perf: skip KVCR deadline queries for ranks without pulls - #611
Conversation
Avoid shared registry locks and deadline lookups when a rank has no incoming pull. Retain deadlines for detached pulls until their blocks are consumed, with lifecycle regression coverage. Record the measured baseline bookkeeping cost and defer the remaining transfer optimizations. This change is independent of the draining-source staging fix in PR ai-dynamo#600. Co-authored-by: Codex <noreply@openai.com> Signed-off-by: Rudy Pei <yanrpei@gmail.com>
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Skip deadline lookups without staged pulls crates/core/src/engine/scheduler/vllm/kvcr.rs, crates/core/src/engine/kvcr.rs, docs/replay/engine/kv-cache.md |
The adapter returns None when no pulls are staged and continues to use registry deadlines for staged pulls. The test covers detached pulls and another rank advancing the registry. Comments and documentation describe KVCR bookkeeping and the requirement to preserve CanonicalV1 replay output bytes. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Possibly related PRs
- ai-dynamo/aisimulate#600: Includes the same deadline early return and detached-pull lifecycle test, plus changes to draining-source staging.
Merge Risk: 
Minimal · up to 83048
-
No merge-blocking issue was identified in the deadline lookup optimization.
Pre-merge checks: 
7 · 
1
-
Failed checks: 1 inconclusive Passed checks: 7 passed-
Full details: Description check
-
Explanation
The description explains the problem, implementation, lifecycle coverage, risks, evidence, modeling assumptions, compatibility impact, and tracking. It does not provide explicit CodeRabbit or reviewed-commit entries, but the required information is otherwise mostly complete and the low-risk change does not require a Codex review commit.
Full details: Cross-Layer Contract
-
Explanation
No public input, schema field, default, or serialized output declaration changed. The internal
next_deadlineguard is traced fromVllmKvcrAdapterthroughHostOffloadAdapterand the scheduler retry path. The added lifecycle test covers empty, parked, detached, landed-but-unconsumed, completed, and source-only states. Existing replay tests cover CanonicalV1 serialization and KVCR report fields. The PR description also supplies before/after CanonicalV1 byte-parity evidence.
Full details: Modeling And Data Evidence
-
Explanation
The PR supplies provenance and reproducible before/after evidence for the selection-logic change. The diff adds the
stages.is_empty()guard inVllmKvcrAdapter::next_deadlineand a lifecycle regression covering detached pulls and deadline preservation. The description identifies the measured commit pair, workload, hardware, toolchain, 108 release trials, interleaving, A/A control, confidence intervals, and three before/after configurations. It also reports CanonicalV1 byte parity across timed and additional configurations, unchanged KVCR-off timing, and retained trials. This is not binary-only validation and does not contain an unexplained output refresh.
Full details: Compatibility Boundaries
-
Explanation
No compatibility-boundary failure is introduced. The PR changes only two internal Rust implementation/test files and one documentation file; it changes no Python surface, schema, binding, version, dependency, or artifact metadata.
VllmKvcrAdapter::next_deadlineremainspub(super)and only adds an existing-lifecycle guard; its caller still consumes the sameOption<f64>scheduling hint. KVCR defaults remain 1.0 ms and 50.0 GB/s incrates/core/src/engine/config.rs:392-399, and the documented defaults remain synchronized indocs/replay/engine/kv-cache.md:275-280. The report field andkvcrserialization remain unchanged incrates/core/src/replay/report.rs:49-52,481-483. The crate and Python package remain version 0.13.0 incrates/core/Cargo.toml:4-8andpython/aisimulate/pyproject.toml:4-7; no Dynamo dependency or import was added.
-
Full details: Review Evidence
-
Explanation
The visible PR description names relevant commands and results (
cargo test -p aisimulate-core,cargo fmt --all -- --check, andcargo clippy -p aisimulate-core --all-targets), reports negative and boundary coverage, reports CanonicalV1 parity, and explicitly says CI is not claimed. The changed test also covers detached, landed-but-unconsumed, and completed states (crates/core/src/engine/scheduler/vllm/kvcr.rs:515-535). No inactive nested workflow is cited in the visible text. However, the supplied description is truncated during “Modeling or data provenance”. The complete description is required to verify the evidence distinctions and to rule out an inactive nested-workflow claim in the omitted text.Resolution
Provide the complete PR description, including the omitted modeling/data-provenance section, and rerun this check.
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Keep this PR focused on rejecting newly staged pulls from draining sources and documenting the remaining modeled boundaries. Remove the deadline shortcut, its lifecycle regression, the bookkeeping TODO and performance documentation now owned by independent PR ai-dynamo#611. Co-authored-by: Codex <noreply@openai.com> Signed-off-by: Rudy Pei <yanrpei@gmail.com>
|
/ok to test b5ecd52 |
@jthomson04, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/ |
|
/ok to test 8304832 |
Avoid shared registry locks and deadline lookups when a rank has no incoming pull. Retain deadlines for detached pulls until their blocks are consumed, with lifecycle regression coverage. Record the measured baseline bookkeeping cost and defer the remaining transfer optimizations. This change is independent of the draining-source staging fix in PR ai-dynamo#600. Signed-off-by: Rudy Pei <yanrpei@gmail.com> Co-authored-by: Codex <noreply@openai.com>
Why and what changed
Every vLLM rank queried the shared KVCR registry for its next deadline even when it had no incoming pull. At large worker/attention-DP counts, those repeated locks and lookups add substantial replay overhead.
Return early when the adapter's staged-pull map is empty. Detached pulls keep their stages until their blocks are consumed, so their wakeups remain intact. The lifecycle regression covers empty, parked, moving, detached, source-only, landed-but-unconsumed and completed states. Transfer advancement, bandwidth allocation, counters and event ordering are unchanged.
Review map
crates/core/src/engine/scheduler/vllm/kvcr.rs: the guard and its lifecycle regression.crates/core/src/engine/kvcr.rs: measured baseline bookkeeping TODO; broader optimization remains deferred.docs/replay/engine/kv-cache.md: describe the shortcut and remaining overhead.mainand can merge in either order. No public API, configuration or output-schema change.Evidence
The same guard was measured in commit pair
52e131bc → 7376ce71, using 108 clean release trials with six interleaved repetitions per variant, one pinned CPU and an A/A control first. The conservative A/A floor was 21.9%.All six pairs favor the guard in each listed case. Whole benchmark-process time, including setup and output serialization, falls 24.0%, 29.8% and 50.7%, respectively. At W512, KVCR-off is unchanged within noise (ratio 0.996 [0.905, 1.065]); idle KVCR improves 30.6%. Hinted gains at W8/32/128 are below the conservative noise floor. Every trial is retained.
Full before/after CanonicalV1 bytes, including KVCR statistics, match in all timed trials and 12 additional pairs: 20 distinct worker/arm/bandwidth/DP configurations. No fields were removed. The temporary benchmark and instrumentation are excluded from the PR.
The initial pre-optimization study measured hinted/G2-only ratios of 1.168/1.226/1.182/1.975/3.165 at W=8/32/128/512/2048; these are the baseline ratios retained in the TODO. At W2048 it counted 1.02 billion deadline queries versus 3.10 million
take_landedcalls. The proposed timestamp/concurrency/source cost model fit poorly (R²=0.58), so no asymptotic claim is made. The candidate profile retained 14,671 samples with zero reported loss; registrynext_deadlinestill accounts for 25.7% of recognized replay stacks. Truncated/unresolved callers limit attribution.cd6efc5e:cargo test -p aisimulate-core— 2,488 passed, zero failed, one ignored, across 19 test binaries.cargo fmt --all -- --checkandcargo clippy -p aisimulate-core --all-targetspassed; Clippy has warnings on unchanged code.Modeling or data provenance
Synthetic fixed-worker fixtures: fixed vLLM timing, private G2, 200 requests/worker/second, eight 11-turn sessions per worker, and 20% of follow-ups migrate with a prior-worker hint. Default KVCR timing is 1 ms / 50 GB/s. Measurements used release Rust 1.98.1 and one logical CPU on an Intel Xeon Platinum 8559C. Each before/after pair holds workload, DP size and cache capacity fixed. Native KVCR parity is not claimed.
Tracking
Performance follow-up to #454; companion correctness PR: #600. Further transfer-bookkeeping optimizations remain deferred and must preserve CanonicalV1 output bytes.
This pull request and its description were written by Codex.