perf(rollout): add HybridEngine rollout profiling - #8295
Merged
delock merged 7 commits intoAug 24, 2026
Conversation
Add opt-in stage-level profiling for HybridEngineRollout, including prompt expansion, generation, post-processing, total latency, and tokens-per-second metrics. Add a single-accelerator OPSD benchmark with raw profiles and mean/p50/p95 summaries, together with unit tests and documentation. Signed-off-by: nathon-lee <leejianwoo@gmail.com>
Signed-off-by: nathon-lee <leejianwoo@gmail.com>
Signed-off-by: nathon-lee <leejianwoo@gmail.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 138d1bd7fb
ℹ️ 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".
This was referenced Aug 23, 2026
This reverts commit 11edff5. Signed-off-by: nathon-lee <leejianwoo@gmail.com>
nathon-lee
force-pushed
the
perf/opsd-hybridengine-profil-clean
branch
from
August 23, 2026 03:41
138d1bd to
0a73484
Compare
delock
reviewed
Aug 23, 2026
Signed-off-by: nathon-lee <leejianwoo@gmail.com>
delock
approved these changes
Aug 23, 2026
delock
enabled auto-merge
August 23, 2026 14:06
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Aug 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds opt-in stage-level profiling for
HybridEngineRollout.The profiling path measures rollout-level latency without changing the default execution behavior. It establishes a measurable baseline for the HybridEngine rollout investigations discussed in #8197.
Following maintainer feedback, the executable OPSD HybridEngine rollout benchmark has been moved to DeepSpeedExamples and is no longer part of this PR.
Companion benchmark PR:
<DEEPSPEED_EXAMPLES_PR_URL>
Motivation
OPSD-style workloads commonly generate multiple responses for each prompt. Before optimizing this path, we need a reproducible way to measure the rollout stages and determine where time is spent.
The initial profiling API records:
The executable benchmark that exercises this API across different prompt, response, batch-size, and sample-count combinations is maintained separately in DeepSpeedExamples.
Changes
Opt-in rollout profiling
This PR adds
enable_profilingtoHybridEngineRolloutConfig.Profiling is disabled by default:
It can be enabled explicitly with:
When enabled,
HybridEngineRolloutrecords synchronized measurements for:prompt_expansion_msgeneration_mspost_processing_mstotal_mstokens_per_secondThe profile also records:
Profiling remains disabled by default because accelerator synchronization affects normal execution performance.
The most recent measurement can be retrieved with:
When profiling is disabled, the normal rollout execution path and output behavior remain unchanged.
Correctness
The rollout now preserves a tokenizer
pad_token_idof0instead of treating it as missing and replacing it with the EOS token.Tests cover:
get_last_profile()behaviorCompanion benchmark
The executable OPSD HybridEngine rollout benchmark has been moved to DeepSpeedExamples following maintainer feedback:
<DEEPSPEED_EXAMPLES_PR_URL>
The companion benchmark supports configurable matrices for:
It reports:
The benchmark executes the largest effective batch first so HybridEngine initializes a sufficiently large inference workspace, while preserving the user-requested order in the output JSON.
Its initial validation scope is intentionally limited to:
The benchmark depends on the profiling API introduced by this PR.
Validation
Test environment:
Command:
Result:
The modified files also pass the repository pre-commit hooks, including:
The executable benchmark and its CPU-only tests are validated separately in the companion DeepSpeedExamples PR.
Scope
This PR introduces only opt-in rollout-level profiling and its DeepSpeed core correctness coverage.
It does not include an executable benchmark in the DeepSpeed core repository.
It does not attempt to optimize generation or attribute time to internal HybridEngine operations such as:
Those internal phases can be investigated separately after the profiling API and companion benchmark establish a reproducible baseline.
This PR does not modify the existing inference-cache lifecycle or claim to fix cache release and reacquisition behavior.
Related to #8197.