feat(sim): profiled replay - #1047
Mrtroll486 wants to merge 8 commits into
Conversation
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
3948054 to
a915220
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a91522033c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| let mut duration_us = if decode_reqs > 0 && prefill_tokens == 0 && sum_decode_ctx_tokens == 0 { | ||
| base_us as f64 | ||
| } else { | ||
| decode_request_us * f64::from(decode_reqs) |
There was a problem hiding this comment.
Keep legacy TPOT independent of batch width
When the CLI runs without --profile, build_runtime still attaches this generated profile, so concurrent requests share one decode step. Multiplying the duration by decode_reqs makes each token interval N * tpot_ms for a batch of N requests, whereas the previous legacy scheduler advanced every ready request after the same fixed TPOT. Consequently, existing vllm bench workloads with concurrency greater than one report artificially increasing TPOT and latency; retain the legacy scheduler for this mode or make its decode-step duration batch-invariant.
Useful? React with 👍 / 👎.
| log::warn!( | ||
| "timing profile '{}' does not cover step shape {shape:?}; using parametric fallback outside grid domain {domain:?}", | ||
| self.profile_id | ||
| ); |
There was a problem hiding this comment.
Install a logger before promising fallback warnings
In the pegainfer-sim executable, neither main.rs nor pegainfer-frontend installs a logger for the log facade, so this warning is discarded. Whenever the default WarnAndFallback policy encounters a shape outside the measured grid, the run silently switches to parametric timing and the benchmark operator cannot tell that results are no longer profile-backed; initialize logging or surface this warning through the executable's configured stderr/reporting path.
Useful? React with 👍 / 👎.
Signed-off-by: Mr_troll863 <restart486666@gmail.com>
|
2 review suggestions provided by codex has been fixed, regression test added. |
|
The overall online worker implementation looks reasonable. I ran the existing library/HTTP tests and exercised the unchanged head with The main design question is the JSON contract. Please post a proposal in a comment for discussion before implementing further schema/model changes. We should first establish the minimum useful inputs and how we will obtain their values. Some thoughts for that discussion:
A small proposed JSON example, a purpose for each retained field, and a calibration/validation outline would be enough to start the discussion. We can agree on that before expanding the implementation. Separately, there is one reproduced correctness issue on |
Summary
Pr 1/3 of issue #1039
This PR adds a runnable, deterministic offline serving simulator to
pegainfer-simand provides the versioned timing-profile and step-worker foundations needed by it.The offline simulator does not depend on GPUs, model weights, HTTP, or wall-clock time. It replays requests through a single logical event loop and produces identical event ordering and reports for the same scenario, workload, timing profile, and seed.
Background
The existing online
SimScheduleris useful for validating the OpenAI/vLLM frontend, HTTP streaming, and metrics. It is not suitable for fleet-level scheduling experiments because its results include HTTP, Tokio, operating-system scheduling, and real-time waiting overhead, and because a large HTTP run is not a simulation of a large serving fleet.This PR adds an independent logical-clock replay module instead of scaling the online simulator with threads or servers. The online simulator continues to cover protocol and integration behavior; the offline simulator focuses on scheduling, routing, and fleet A/B experiments.
Production Invariant
CompletedorRejected.max_num_seqsormax_batched_tokens.max_model_len.Main Changes
Offline logical-clock simulator
BinaryHeapevent loop.Waiting -> Prefill -> Decode -> Completed/Rejectedlifecycle.max_num_seqs,max_batched_tokens, andmax_model_len.Fleet and routing
Timing and JSON contracts
Adds separate, strict, versioned JSON contracts for:
PR1 provides an extensible tagged timing-model enum with a fixed synthetic model:
Reports include:
Standalone CLI
Adds
pegainfer-sim-replay, which runs without starting the HTTP frontend:The repository includes runnable scenario, workload, and timing-profile examples.
Online simulator foundations and hardening
The preceding commits in this branch also provide:
max_tokensrequests from causing OOM;fallback-token-idin profile mode;These facilities provide the foundation for future benchmark-driven calibration, while the PR1 offline timing model remains explicitly
synthetic.Acceptance Evidence
u32::MAXoutput request is rejected before allocation.Verification
Results:
pegainfer-simunit tests: 20/20 passed;pegainfer-frontendunit tests: 65/65 passed;Non-Goals
This PR does not include:
These capabilities are reserved for follow-up calibration and KV-aware routing work.
Type of Change
Checklist
docs/conventions/coding-style.md).CLAUDE.md).