Repository navigation
fix(vllm): warm up eager shapes before FPM self-benchmark measurement - #12176
Conversation
WalkthroughChangesBenchmark warmup handling
Estimated code review effort: 4 (Complex) | ~45 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
components/src/dynamo/vllm/instrumented_scheduler.py (1)
3309-3334: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winWarmup validation failures leak into
_bench_skipped_points, corruptingusable/validin the output artifact.The
EAGER_WARMUP_REASONdiscard branch (lines 3326-3334) runs after thevalidation_failurebranch (lines 3309-3324). If a warmup replica's measured FPM shape doesn't exactly match the point (the same measured-shape mismatch class the check exists to catch for real points), it falls into_bench_skip_point()instead of being silently dropped. Since warmup replicas lose their"explicit"tag viareplace(point, sample_reasons=[EAGER_WARMUP_REASON]),_bench_skip_pointwon't raise — it just appends to_bench_skipped_points._bench_write_resultsthen requiresskipped_points == 0forusable/valid, so a discarded, value-less warmup mismatch would incorrectly mark the whole published benchmark artifact as not usable/not valid and show a phantom skipped point, even though "Replicas run through the normal injection/lockstep/validation path ... and are dropped at save time" per the docstring. Move the warmup discard check before the validation-failure branch so warmup results are unconditionally dropped regardless of validation outcome.No test in this PR exercises
_bench_save_current_pointfor anEAGER_WARMUP_REASON-tagged point (success or validation-mismatch); consider adding one alongside the fix. Want me to draft it?🐛 Proposed fix: discard warmups before validation is evaluated
reason = self._bench_fpm_validation_failure(point, fpm) if reason is not None and validation_failure is None: validation_failure = (dp_rank, reason) + if EAGER_WARMUP_REASON in point.sample_reasons: + logger.debug("Discarding eager-shape warmup result: %s", point) + self._bench_current_point = None + self._bench_current_fpms = [] + self._bench_point_deadline = 0.0 + if group_result.stop_requested: + self._bench_request_timeout_stop(point) + return + if validation_failure is not None: dp_rank, reason = validation_failure logger.warning( "Skipping benchmark point after measured shape mismatch " "on ADP rank %d: point=%s reason=%s", dp_rank, point, reason, ) self._bench_skip_point(point, reason) self._bench_current_point = None self._bench_current_fpms = [] self._bench_point_deadline = 0.0 if group_result.stop_requested: self._bench_request_timeout_stop(point) return - if EAGER_WARMUP_REASON in point.sample_reasons: - logger.debug("Discarding eager-shape warmup result: %s", point) - self._bench_current_point = None - self._bench_current_fpms = [] - self._bench_point_deadline = 0.0 - if group_result.stop_requested: - self._bench_request_timeout_stop(point) - return - self._bench_results.append(🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/src/dynamo/vllm/instrumented_scheduler.py` around lines 3309 - 3334, Move the EAGER_WARMUP_REASON check in _bench_save_current_point before the validation_failure branch so eager-warmup results are always discarded without calling _bench_skip_point, including measured-shape mismatches. Preserve the existing cleanup and timeout-stop behavior, and add coverage for both successful and validation-mismatch warmup points if tests are maintained here.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@components/src/dynamo/vllm/tests/test_vllm_instrumented_scheduler.py`:
- Around line 2950-2958: Remove the in-function imports from
test_eager_warmup_points_dedupe_and_flag, including SimpleNamespace,
EAGER_WARMUP_REASON, BenchmarkPoint, and InstrumentedScheduler, and rely on
their existing module-level imports.
---
Outside diff comments:
In `@components/src/dynamo/vllm/instrumented_scheduler.py`:
- Around line 3309-3334: Move the EAGER_WARMUP_REASON check in
_bench_save_current_point before the validation_failure branch so eager-warmup
results are always discarded without calling _bench_skip_point, including
measured-shape mismatches. Preserve the existing cleanup and timeout-stop
behavior, and add coverage for both successful and validation-mismatch warmup
points if tests are maintained here.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: e1fa8644-acfc-43cf-99d8-993959c3610f
📒 Files selected for processing (2)
components/src/dynamo/vllm/instrumented_scheduler.pycomponents/src/dynamo/vllm/tests/test_vllm_instrumented_scheduler.py
This comment has been minimized.
This comment has been minimized.
a66d636 to
911ad6d
Compare
7d85200 to
7d69413
Compare
tedzhouhk
left a comment
There was a problem hiding this comment.
One blocking warmup-discard path remains. Warmup replicas must never affect published skipped-point accounting, including failures that happen before FPM validation.
d99990e to
f47bf5b
Compare
Shapes beyond the cudagraph capture range pay a ~1s first-execution one-off (measured 1126ms vs 147ms warm on decode batch 513); a single-sample sweep books that cost as the point's latency. Captured shapes are immune because capture itself executes them at startup. - Prepend one discarded warmup replica per eager shape, deduped by the shape driver (token count for prefill, batch size for decode). Replicas run the normal injection/lockstep/validation path on every rank and are dropped at save time. - Keep each warmup block contiguous with its phase's real block: _bench_pop_next() treats a type mismatch at the queue front as "phase complete", so mixed-type warmups prepended as a single run would silently drop every real point in agg mode. - Number real points 1..N first so published benchmark IDs stay contiguous (native-artifact contract); warmup replicas take IDs after the real range. Split from the combined noise-elimination PR; the CPython GC policy lands separately. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: YZLi <[email protected]>
A warmup replica whose FPM fails shape validation was recorded as a skipped point; the published artifact's usable/valid gates both require skipped_points == 0, so one warmup hiccup invalidated an otherwise complete run. Discard warmup replicas first (with a warning when their shape mismatched) and only then convert validation failures of real points into skips. Also drop the redundant function-local imports in the relocated dedupe test. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: YZLi <[email protected]>
…ery failure path A warmup replica that failed before FPM validation (fake-prefix allocation, prefill/decode injection shortfall) still reached _bench_skip_point and booked a skipped point, flipping the published artifact to unusable/invalid even when every real measurement succeeded. Move the EAGER_WARMUP_REASON exemption into _bench_skip_point itself so every caller shares it; failed warmups are logged and discarded. Signed-off-by: YZLi <[email protected]>
f47bf5b to
a412051
Compare
…ai-dynamo#12176) Signed-off-by: YZLi <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
… landed) Resolve the additive test-file conflict as the union of both sides; drop the now-unused random import; annotate kvwarm bookkeeping for mypy; reference EAGER_WARMUP_REASON now that the constant lives in the same module. Co-Authored-By: Claude Fable 5 <[email protected]> Signed-off-by: YZLi <[email protected]>
Overview:
Self-benchmark points whose shapes fall outside the cudagraph capture range pay a ~1s
first-execution one-off — five consecutive repeats of decode batch 513 read
[1126, 147, 147, 144, 144]ms. Captured shapes are immune because capture itselfexecutes them at startup; eager shapes get no such implicit warmup, and a
single-sample sweep books the one-off as the point's latency, permanently poisoning
that database row (up to 8x on the affected points).
This PR pre-warms every eager shape with a discarded warmup replica, putting eager
and captured points on the same footing.
Details:
_bench_build_gridprepends one discarded warmup replica per eager shape,deduped by the shape driver (token count for prefill, batch size for decode) —
typically a handful of replicas ≈ +10s bring-up. Replicas run the normal
injection/lockstep/validation path on every rank, so attention-DP grids stay
identical by construction, and results are dropped at save time.
(
[prefill warmups, prefill points, decode warmups, decode points]):_bench_pop_next()treats a type mismatch at the queue front as "phasecomplete", so mixed-type warmups prepended as a single run would end
PREFILL_SWEEP at the first decode warmup and silently drop every real point in
agg mode. Covered by
test_agg_eager_warmups_stay_contiguous_with_their_phase,which drains the grid exactly as the phase machine does.
contiguous (native-artifact contract); warmup replicas take IDs after the real
range.
counter_idstamping usespoint.benchmark_iddirectly, so executionorder and ID order are independent.
Validation (GLM-5.2-NVFP4, 4×B200 attention-DP=4, vLLM 0.25.1)
vs 1216 / 1184 ms first-touch before; an independent re-collection reproduced
189 / 185 ms on a coordinate-identical grid.
artifacts with contiguous real IDs.
Where should the reviewer start?
components/src/dynamo/vllm/instrumented_scheduler.py—_bench_eager_warmup_points(docstring carries the rationale), the gridregrouping + ID numbering in
_bench_build_grid, and the save-time discardcomponents/src/dynamo/vllm/tests/test_vllm_instrumented_scheduler.py—test_agg_eager_warmups_stay_contiguous_with_their_phase,test_eager_warmup_points_dedupe_and_flag, and the warmup-ID grid-testadaptations
Related Issues
🚫 This PR is NOT linked to an issue:
Summary by CodeRabbit