Skip to content

fix(timing): apply the trace idle-gap cap during agentic warmup - #61

Draft
FrankD412 wants to merge 1 commit into
masterfrom
fdinatale/warmup-trace-idle-gap-cap
Draft

FrankD412 wants to merge 1 commit into
masterfrom
fdinatale/warmup-trace-idle-gap-cap

Conversation

@FrankD412

Copy link
Copy Markdown
Collaborator

Patch from Julien Lin (authorship preserved on the commit).

Why

--trace-idle-gap-cap-seconds S advances a trajectory's pending timers once its root and all descendants have had nothing in flight for S seconds. PhaseRunner._root_idle_gap_cap_seconds only armed it for the profiling phase, so the agentic warmup ran uncapped.

The accelerated cache-pressure warmup (--warmup-requests-per-lane / --agentic-cache-warmup-duration) is synthesized as an AGENTIC_REPLAY phase (src/aiperf/timing/config.py) and replays the same recorded gaps through the same ReplayBarrierCoordinator. Without the cap it:

  • waits out every multi-minute idle period in the trace, stretching warmup far past its budget, and
  • fills the KV cache under a different arrival process than the one profiling then measures with the cap on.

What

  • src/aiperf/timing/phase/runner.py: _root_idle_gap_cap_seconds returns the dataset's trace_idle_gap_cap_seconds for WARMUP as well as PROFILING. The AGENTIC_REPLAY and run-config checks are unchanged.
  • docs/benchmark-modes/semianalysis-agentx-faq.md, docs/tutorials/agentx-mvp.md: state that the cap is armed in both warmup and profiling.

Behavior

Scenario Before After
Profiling, cap set idle gaps advanced after S s unchanged
Agentic warmup, cap set every recorded gap waited out in full idle gaps advanced after S s
Cap not set no cap in any phase unchanged

Duration-based warmup sends more requests in the same wall time once long gaps are skipped, so warmup request counts differ from earlier runs with the same flags.

Not in scope

  • Upstream ai-dynamo/aiperf main has the same profiling-only gate; no upstream PR carries this change yet.

Verification

  • tests/unit/timing/: 1298 passed.
  • No test exercises warmup with the cap set; not run against a live server.

`PhaseRunner._root_idle_gap_cap_seconds` armed the per-trajectory idle
watchdog only for PROFILING. An accelerated cache-pressure warmup
(--warmup-requests-per-lane / --agentic-cache-warmup-duration) replays the
same recorded gaps through the same replay barrier, so with the cap off it
waits out every multi-minute idle period, overrunning its budget, and fills
the KV cache under a different arrival process than profiling measures.
Arm the cap for WARMUP as well and document it.

Signed-off-by: Francesco Di Natale <3429989+FrankD412@users.noreply.github.com>
@github-actions github-actions Bot added the fix label Oct 23, 2026
@github-actions

Copy link
Copy Markdown

Try out this PR

Quick install:

pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@97a1f11f5655c48fbbb35fb5b13a4d4377baef39

Recommended with virtual environment (using uv):

uv venv --python 3.12 && source .venv/bin/activate
uv pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@97a1f11f5655c48fbbb35fb5b13a4d4377baef39

Last updated for commit: 97a1f11 • Browse code

@github-actions

Copy link
Copy Markdown

Fern Docs Preview: generation failed — see the Actions log for details. This does not block merge; ask a maintainer to retry if needed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants