Skip to content

Conversation

huachenheli
Copy link
Contributor

@huachenheli huachenheli commented Jul 29, 2025

Summary:
vLLM currently lacks ability to generate CPU profiles, and the existing torch profile does not cover frontend/core processes. @WoosukKwon previously suggested profiling CPU by setting VLLM_ENABLE_V1_MULTIPROCESSING=0 but we still lack the ability to profile when processes are split.

For AsyncLLM class, which runs multimodal processor, the CPU work can be slow and worth profiling. Here we added support to also profile CPU.

For simplicity, I'm reusing the env var VLLM_TORCH_PROFILER_DIR for CPU traces as well, so both CPU & GPU profiles are consolidated into the same directory.

Test Plan:

export VLLM_ENABLE_V1_MULTIPROCESSING=0 ; VLLM_TORCH_PROFILER_DIR=/home/huachenheli/vllm_profile python -m vllm.entrypoints.openai.api_server --model Qwen/Qwen2.5-VL-7B-Instruct --tensor-parallel-size 1 --limit-mm-per-prompt '{"image": 1}'

VLLM_TORCH_PROFILER_DIR=/home/huachenheli/vllm_profile python -m vllm.entrypoints.openai.api_server --model Qwen/Qwen2.5-VL-7B-Instruct --tensor-parallel-size 1 --limit-mm-per-prompt '{"image": 1}'

Both CPU (AsyncLLM) & GPU (workers) profiles are produced:
Screenshot 2025-07-31 at 4 30 28 PM

Example profile with image inputs:
AsyncLLM:
Screenshot 2025-07-31 at 4 31 28 PM

Reviewers:

@youkaichao @WoosukKwon

Subscribers:

Tasks:

Tags:

Essential Elements of an Effective PR Description Checklist

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Purpose

Test Plan

Test Result

(Optional) Documentation Update

…, which processes MM data that can be CPU heavy.

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Signed-off-by: Chenheli Hua <[email protected]>
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

🚀

Copy link
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@huachenheli huachenheli changed the title [draft][prototype] [Core] Add viztracer (CPU profiling) to AsyncLLM class. [draft][prototype] [Core] Add viztracer (CPU profiling) to V1 AsyncLLM class. Jul 29, 2025
@huachenheli huachenheli changed the title [draft][prototype] [Core] Add viztracer (CPU profiling) to V1 AsyncLLM class. [Core] Add viztracer (CPU profiling) to V1 AsyncLLM & EngineCore classes. Jul 29, 2025
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Signed-off-by: Chenheli Hua <[email protected]>
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Signed-off-by: Chenheli Hua <[email protected]>
@huachenheli huachenheli marked this pull request as ready for review July 29, 2025 23:29
@huachenheli huachenheli marked this pull request as draft July 30, 2025 03:45
@huachenheli huachenheli changed the title [Core] Add viztracer (CPU profiling) to V1 AsyncLLM & EngineCore classes. [Core] Add torch profiler CPU traces for AsyncLLM. Jul 31, 2025
…ndency.

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Signed-off-by: Chenheli Hua <[email protected]>
@huachenheli huachenheli marked this pull request as ready for review July 31, 2025 23:32
Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Signed-off-by: Chenheli Hua <[email protected]>
@huachenheli huachenheli mentioned this pull request Aug 6, 2025
3 tasks
Copy link
Member

@youkaichao youkaichao left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the contribution!

@ywang96 ywang96 added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 19, 2025
@ywang96 ywang96 enabled auto-merge (squash) August 19, 2025 18:20
@ywang96 ywang96 merged commit e58c5a9 into vllm-project:main Aug 20, 2025
37 checks passed
divakar-amd pushed a commit to divakar-amd/vllm_upstream that referenced this pull request Aug 20, 2025
cyang49 pushed a commit to cyang49/vllm that referenced this pull request Aug 20, 2025
djmmoss pushed a commit to djmmoss/vllm that referenced this pull request Aug 21, 2025
epwalsh pushed a commit to epwalsh/vllm that referenced this pull request Aug 28, 2025
xiao-llm pushed a commit to xiao-llm/vllm that referenced this pull request Aug 28, 2025
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Aug 28, 2025
mengxingkongzhouhan pushed a commit to mengxingkongzhouhan/vllm that referenced this pull request Aug 30, 2025
zhewenl pushed a commit to zhewenl/vllm that referenced this pull request Sep 3, 2025
FeiDaLI pushed a commit to FeiDaLI/vllm that referenced this pull request Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/build ready ONLY add when PR is ready to merge/full CI is needed v1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants