Skip to content

perf: reduce replay request bookkeeping - #386

Merged
jthomson04 merged 2 commits into
mainfrom
jthomson04/aisimulate-pr307-performance-20261005
Oct 5, 2026
Merged

jthomson04 merged 2 commits into
mainfrom
jthomson04/aisimulate-pr307-performance-20261005

Conversation

@jthomson04

@jthomson04 jthomson04 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Reduce the replay bookkeeping added in #307. Reuse committed request-ID vectors and build the membership index only when cancellation needs it. Reserve vLLM vector capacity and skip duplicate prefill and consecutive speculative-burst IDs. Public APIs and worker-wide membership are unchanged.

Validation

  • 116 focused Rust tests passed on Tyche, covering engine components, vLLM/SGLang membership with an idle first attention-DP rank, speculative bursts/retraction, profile cancellation, and report accounting.
  • Formatting and diff checks passed. The revised head (0a9ef773) was not benchmarked.

Historical dense-vLLM result, 524,288 requests: the 14.4% native-time improvement was measured at a1bf0351, against the unchanged #307 merge (a9c358c5).

Merge Optimized at a1bf0351 Change
22.956 s 19.654 s −14.4%

One run per build. Timing variation and SGLang performance remain unmeasured.

Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
@jthomson04
jthomson04 requested review from a team as code owners October 5, 2026 21:11
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: ai-dynamo/aisimulate/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: ccb32b7a-60ba-4191-b1e4-e95898760eb8
📥 Commits

Reviewing files that changed from the base of the PR and between a1bf035 and 0a9ef77.

📒 Files selected for processing (2)
  • crates/core/src/engine/scheduler/vllm/core.rs
  • crates/core/src/replay/components/engine.rs
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 8 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (23)
  • GitHub Check: Prediction Regression / Collect prediction snapshot (new)
  • GitHub Check: Prediction Regression / Collect prediction snapshot (old)
  • GitHub Check: Collector Data / Perf data sanity (informational)
  • GitHub Check: Collector Data / Check collector data
  • GitHub Check: Platform Wheels / Build wheels (macosx_arm64)
  • GitHub Check: Platform Wheels / Build wheels (manylinux_2_28_x86_64)
  • GitHub Check: Platform Wheels / Build wheels (manylinux_2_28_aarch64)
  • GitHub Check: readme-commands / README / dynamo
  • GitHub Check: readme-commands / README / source
  • GitHub Check: Application Test Wheel (arm64)
  • GitHub Check: Python 3.13 compatibility
  • GitHub Check: Rust (arm64)
  • GitHub Check: Python Dependency Licenses
  • GitHub Check: Release Artifact Contract (amd64)
  • GitHub Check: Release Artifact Contract (arm64)
  • GitHub Check: Rust (amd64)
  • GitHub Check: Python 3.11 compatibility
  • GitHub Check: Engine Golden Regression
  • GitHub Check: Public API Rust (arm64)
  • GitHub Check: Application Test Wheel (amd64)
  • GitHub Check: Public API Rust (amd64)
  • GitHub Check: Rust feature modes
  • GitHub Check: Forward Prediction Performance (advisory)
🧰 Additional context used
📓 Path-based instructions (6)
Review scheduler state transitions and event ordering, including cancel, preempt, drain, retry, duplicate, empty, and terminal paths.

⚙️ CodeRabbit configuration file

Files:

  • crates/core/src/engine/scheduler/vllm/core.rs
Preserve deterministic Replay semantics and explicit validation.

⚙️ CodeRabbit configuration file

Files:

  • crates/core/src/replay/components/engine.rs
Read REVIEW.md before commenting.

⚙️ CodeRabbit configuration file

Files:

  • crates/core/src/engine/scheduler/vllm/core.rs
  • crates/core/src/replay/components/engine.rs
Source excerpt: `core.rs` owns common queue mechanics, KV allocation, state transitions, completion, and event emission.

📄 CodeRabbit inference engine (crates/core/src/engine/scheduler/vllm/CLAUDE.md)

Files:

  • crates/core/src/engine/scheduler/vllm/core.rs
Before making any change under: `python/aisimulate/src/aisimulate/generator/**` MUST read: `python/aisimulate/.claude/rules/generator-development.md` Before making any change under `python/aisimulate/collector/**` MUST read: `python/aisimul...

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • crates/core/src/engine/scheduler/vllm/core.rs
  • crates/core/src/replay/components/engine.rs
Source excerpt: Only workflows under the repository-root `.github/workflows/` run for this repository.

📄 CodeRabbit inference engine (REVIEW.md)

Files:

  • crates/core/src/engine/scheduler/vllm/core.rs
  • crates/core/src/replay/components/engine.rs

📝 Summary

Risk: Medium

Three areas for human attention

  1. Check that lazy membership indexing preserves cancellation behavior when requests are cancelled before the first membership query.
  2. Check that vLLM speculative output signals do not add duplicate committed request IDs, including when request IDs are not consecutive.
  3. Check that successful-request time bounds remain available for reports while ordinary replay avoids profile-only calculations.

Changes and contracts

PendingPass now stores committed request IDs in a Vec<Uuid> and builds a BTreeSet index only when membership is queried. Pass aggregation reuses a rank’s vector where possible and appends later ranks, including when rank 0 has no committed requests.

vLLM now reserves capacity for committed IDs and filters output signals to scheduled requests with zero prompt tokens. It skips a signal when the latest committed ID matches. Final sorting and deduplication remain in place.

Report collection now tracks successful-request time bounds for ordinary replay as well as profile runs. The change does not declare public API changes. The stated intent is to preserve API and cancellation behavior.

Evidence and readiness

The supplied test report says 111 focused Rust tests passed, including cancellation across vLLM and SGLang, multiple attention-DP ranks, speculative retraction, and report accounting. Formatting and diff checks are also reported as passing. These results were not independently run here.

The reported benchmark for Tyche with dense-vLLM shows 19.654 s versus 22.956 s for the unchanged #307 merge, a 14.4% decrease. It used one run per build on the same reserved host and CPU. Request/token counts and simulation summaries reportedly matched. Timing variation and SGLang performance remain unmeasured.

Technical quality evidence includes the expanded DP-rank and cancellation tests. Merge readiness is not established by these results alone. No current review findings were supplied, so review severity counts are unavailable.

Walkthrough

The scheduler now applies additional conditions when adding requests from output signals to the committed set. Replay passes store committed request IDs in a vector and initialize a membership index on first query. Replay tests cover multiple data-parallel sizes, cancellation, and pass completion.

Changes

Scheduler output-signal filtering

Layer / File(s) Summary
Filter output signals
crates/core/src/engine/scheduler/vllm/core.rs
The scheduler adds a request from an output signal only if the signal has a token ID and the request had zero scheduled prompt tokens. It avoids consecutive duplicate additions. Scheduled prompt work remains included in the committed requests.

Replay committed-request tracking

Layer / File(s) Summary
Aggregate and query committed requests
crates/core/src/replay/components/engine.rs
Pending passes store committed IDs in a vector and initialize a BTreeSet membership index on first query. Tests cover aggregation across ranks, DP sizes 1–3, cancellation, and completion. SGLang’s chunked-prefill budget and expected prefill-token total scale with DP size.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 0a9ef

No confirmed issue prevents merging after normal checks.

🚥 Pre-merge checks | ✅ 6 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Modeling And Data Evidence ⚠️ Warning The PR changes vLLM committed-request selection in execute_pass_internal, including speculative output handling, but the added replay test only checks cancellation membership across DP ranks. It doe… Add reproducible before/after evidence for the changed selection logic. For example, add an independent-oracle or golden test that asserts the committed request IDs for prefill, token-bearing decode, and repeated speculative signals. For th…
Description check ⚠️ Warning The description explains the change and reports test and benchmark results, but it omits the required Review map and Tracking sections. The Evidence section also lacks exact test commands and results,… Add the Review map with risk level, reviewer starting points, contract impact, and compatibility concerns. Complete the Evidence fields, including exact commands and results, CI status, reviewed commits, negative or boundary cases, and expe…
✅ Passed checks (6 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Cross-Layer Contract ✅ Passed The PR changes only two Rust files. The changed pass-result field is pub(crate), and PendingPass is private; no public input, schema, default, or serialized output changes. The internal committed-…
Compatibility Boundaries ✅ Passed The PR changes only crates/core/src/engine/scheduler/vllm/core.rs and crates/core/src/replay/components/engine.rs. The affected declarations are internal: PendingPass is private, `request_has_co…
Review Evidence ✅ Passed The PR description reports focused test results and benchmark conditions, but names no commands and does not label local, fake-runner, parity, or production evidence. It makes no hosted-CI claim and d…
Title check ✅ Passed The title identifies the performance change and its target: reducing replay request bookkeeping. It is specific enough to distinguish the main change from unrelated work.
Full details: Modeling And Data Evidence

Explanation

The PR changes vLLM committed-request selection in execute_pass_internal, including speculative output handling, but the added replay test only checks cancellation membership across DP ranks. It does not provide an independent oracle or before/after result for the changed vLLM selection. The description reports one benchmark run per build and says request/token counts matched, but it provides no reproducible artifact or machine-readable results with anomaly checks. The stated evidence does not meet the check’s requirement for selection logic and performance data.

Resolution

Add reproducible before/after evidence for the changed selection logic. For example, add an independent-oracle or golden test that asserts the committed request IDs for prefill, token-bearing decode, and repeated speculative signals. For the performance claim, provide the benchmark configuration and invocation plus machine-readable baseline and optimized results with anomaly checks, or provide another accepted reproducible comparison such as an explained golden diff or held-out comparison.

Full details: Description check

Explanation

The description explains the change and reports test and benchmark results, but it omits the required Review map and Tracking sections. The Evidence section also lacks exact test commands and results, Fast CI and Full CI status, review commit details, and several requested boundary-case and expected-value details.

Resolution

Add the Review map with risk level, reviewer starting points, contract impact, and compatibility concerns. Complete the Evidence fields, including exact commands and results, CI status, reviewed commits, negative or boundary cases, and expected-value derivation; mark unavailable evidence clearly. Add Modeling or data provenance and Tracking sections, using N/A where applicable.

  • Fix all pre-merge checks with AI
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

Restore successful-request report time bounds and cover an idle first attention-DP rank for both replay backends.

Signed-off-by: jthomson04 <jwillthomson19@gmail.com>

@Harrilee Harrilee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

  • vLLM: the new collection is equivalent to the old one after sort_unstable + dedup — prefill IDs come from scheduled, and output-signal IDs are now restricted to prompt_tokens == 0 work (prefill ones were already included), with the last() check only skipping consecutive speculative-burst duplicates.
  • Replay: PendingPass.committed_requests is only written during construction in drive_ready and only read by request_has_committed_pass, so the lazily built OnceLock index can't go stale. Moving the first rank's Vec instead of extending is safe even when it's empty.
  • The extended test (dp_size 1/2/3 with an idle rank 0, querying before/after cancel) covers the lazy-init-after-cancel path well.

Ran the replay engine / vLLM scheduler / committed_request tests locally at the PR head: 194 passed.

@jthomson04
jthomson04 merged commit 3d5ecfd into main Oct 5, 2026
69 checks passed
@jthomson04
jthomson04 deleted the jthomson04/aisimulate-pr307-performance-20261005 branch October 5, 2026 22:44
carlory pushed a commit to carlory/aisimulate that referenced this pull request Oct 30, 2026
* perf: reduce replay request bookkeeping

Signed-off-by: jthomson04 <jwillthomson19@gmail.com>

* perf(replay): skip repeated speculative request IDs

Restore successful-request report time bounds and cover an idle first attention-DP rank for both replay backends.

Signed-off-by: jthomson04 <jwillthomson19@gmail.com>

---------

Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants