Skip to content

perf(rollout): profile prefill and decode forwards - #8350

Merged
delock merged 5 commits into
deepspeedai:masterfrom
nathon-lee:perf/opsd-prefill-decode-profiling
Sep 1, 2026
Merged

delock merged 5 commits into
deepspeedai:masterfrom
nathon-lee:perf/opsd-prefill-decode-profiling

Conversation

@nathon-lee

@nathon-lee nathon-lee commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Extend the opt‑in HybridEngineRollout profiling with:

  • prefill_forward_ms
  • decode_forward_ms
  • generation_overhead_ms
  • num_decode_forwards

Accelerator events are recorded around top‑level model forwards without synchronizing every decode step. Existing profiling fields and rollout behavior remain unchanged.

For CUDA graph generation, forward timings are reported as unavailable because graph replay bypasses model forward hooks.

Follow‑up to #8197.

Validation

  • Focused rollout tests: 25 passed, 1 skipped
  • Changed‑file pre‑commit hooks: passed
  • py_compile: passed
  • git diff --check: passed

GPU Environment

  • GPU: NVIDIA RTX A4500, 20,470 MiB
  • Driver: 570.195.03
  • CUDA: 12.8
  • PyTorch: 2.9.1+cu128
  • Transformers: 4.40.2
  • Model: facebook/opt‑6.7b
  • Dtype: FP16
  • World size: 1
  • ZeRO stage: 0
  • Batch size: 1
  • Samples per prompt: 4
  • Prompt length: 512
  • Warmup: 5
  • Iterations: 20
  • Response Length: 32
Metric Baseline Shared prefill Change
Prefill forward 438.91 ms 130.15 ms -70.35%
Decode forward 863.04 ms 865.98 ms +0.34%
Generation overhead 9.60 ms 14.19 ms +47.72%
Generation 1311.55 ms 1010.32 ms -22.97%
Total 1312.11 ms 1010.90 ms -22.96%
Throughput 97.55 tok/s 126.62 tok/s +29.80%
Peak memory 13144.63 MiB 13178.63 MiB +34 MiB

The measurements show that shared prefill reduces prefill latency by about 70%, while decode latency remains nearly unchanged.

Thank you for reviewing!

Signed-off-by: nathon-lee <leejianwoo@gmail.com>
@nathon-lee
nathon-lee marked this pull request as ready for review August 29, 2026 12:19

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3ee2a5429

ℹ️ 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".

Comment thread deepspeed/runtime/rollout/hybrid_engine_rollout.py
Signed-off-by: nathon-lee <leejianwoo@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c20d693af8

ℹ️ 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".

Comment thread deepspeed/runtime/rollout/hybrid_engine_rollout.py
Comment thread tests/unit/runtime/rollout/test_hybrid_engine_rollout.py Outdated
nathon-lee and others added 2 commits September 1, 2026 09:39
Remove CPU-only mocked tests for accelerator event timing per review.
Keep the production forward profiling implementation and profile schema unchanged.

Signed-off-by: nathon-lee <leejianwoo@gmail.com>
@delock
delock enabled auto-merge September 1, 2026 10:44
@delock
delock added this pull request to the merge queue Sep 1, 2026
Merged via the queue into deepspeedai:master with commit 1c5cc6b Sep 1, 2026
13 checks passed
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