Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7/N] torch.compile, reduce compilation time #10460

Merged
merged 5 commits into from
Nov 20, 2024

Conversation

youkaichao
Copy link
Member

@youkaichao youkaichao commented Nov 19, 2024

Normal run:

$ vllm serve meta-llama/Meta-Llama-3-8B
Memory profiling took 1.16 seconds
# GPU blocks: 27846, # CPU blocks: 2048
Graph capturing finished in 15 secs, took 0.32 GiB

Run with inductor compiling the full graph:

$ vllm serve meta-llama/Meta-Llama-3-8B -O 3
Memory profiling took 28.21 seconds
# GPU blocks: 27825, # CPU blocks: 2048
Graph capturing finished in 32 secs, took 0.33 GiB

Run with inductor compiling the piecewise graph:

$ vllm serve meta-llama/Meta-Llama-3-8B -O 3
Memory profiling took 21.31 seconds
# GPU blocks: 27846, # CPU blocks: 2048
Graph capturing finished in 21 secs, took 0.33 GiB

Results show we can reduce both the inductor compilation time and the cudagraph capture time. Here I only compile one graph for symbolic shape. I don't know why it helps cudagraph capture time, it's just running the model for 2 warmup runs. Might be related to triton?

Note: need to get #10273 in so that inductor can cache the compilation. currently i just disable post grad custom pass to test it.

I think the compilation result should be the same, but in the full graph level, inductor needs to run the full passes at the full graph level, and can generate every triton kernels for every layer.

Copy link

👋 Hi! Thank you for contributing to the vLLM project.
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 do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

vllm/worker/worker.py Outdated Show resolved Hide resolved
vllm/config.py Show resolved Hide resolved
Signed-off-by: youkaichao <[email protected]>
Signed-off-by: youkaichao <[email protected]>
@youkaichao youkaichao requested a review from mgoin November 19, 2024 19:22
Signed-off-by: youkaichao <[email protected]>
Comment on lines +2154 to +2158
splitting_ops: List[str] = Field(default_factory=lambda: [
"vllm.unified_flash_attention",
"vllm.unified_flash_infer",
"vllm.unified_v1_flash_attention",
])
Copy link
Collaborator

Choose a reason for hiding this comment

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

What are these default values for?

Copy link
Member Author

Choose a reason for hiding this comment

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

they are the default splitting ops we know inductor cannot do any optimization, and they are good candidates to split the model.

Copy link
Member

@mgoin mgoin left a comment

Choose a reason for hiding this comment

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

LGTM thank you

@youkaichao youkaichao enabled auto-merge (squash) November 20, 2024 17:13
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Nov 20, 2024
@youkaichao youkaichao disabled auto-merge November 20, 2024 19:20
@youkaichao youkaichao merged commit 0cd3d97 into vllm-project:main Nov 20, 2024
62 of 66 checks passed
@youkaichao
Copy link
Member Author

test errors are unrelated. merging.

@youkaichao youkaichao deleted the cross_token_op branch November 20, 2024 19:20
tlrmchlsmth pushed a commit to neuralmagic/vllm that referenced this pull request Nov 23, 2024
ccs96307 pushed a commit to ccs96307/vllm that referenced this pull request Nov 25, 2024
mfournioux pushed a commit to mfournioux/vllm that referenced this pull request Nov 28, 2024
sleepwalker2017 pushed a commit to sleepwalker2017/vllm that referenced this pull request Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready ONLY add when PR is ready to merge/full CI is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants