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

[Model] Introduce CUDA Graph support for DeepSeek v3 #12204

Closed
wants to merge 1 commit into from

Conversation

houseroad
Copy link
Contributor

Kudos to @jianyuh, who introduce the CUDA graph to DeepSeek v3. The overall throughput almost doubled based on the testing.

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.

🚀

@youkaichao
Copy link
Member

wow that's amazing!
cc @WoosukKwon

@ywang96
Copy link
Member

ywang96 commented Jan 20, 2025

@houseroad Before Woosuk takes a look at this PR, can you run format.sh so that we can get the formatting issue out of the way? Thanks! nvm - the pre-commit PR just got merged #11975, feel free to check the documentation here

Copy link
Collaborator

@tlrmchlsmth tlrmchlsmth left a comment

Choose a reason for hiding this comment

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

LGTM, and thanks for the fix! (I'm accepting but don't have a system to run DeepSeek v3 so can't verify the fix -- changes look good anyway)

Comment on lines -232 to +233
if (num_experts >= 256) {
if (!use_shared_memory) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why was this change needed for the fix BTW?

Comment on lines -239 to +248
const int32_t mem_tokens_cnts =
((num_experts + 1) * num_experts) * sizeof(int32_t);
const int32_t mem_cumsum = (num_experts + 1) * sizeof(int32_t);
// allocate global memory
int32_t* tokens_cnts;
int32_t* cumsum;
cudaMalloc(&tokens_cnts, mem_tokens_cnts);
cudaMalloc(&cumsum, mem_cumsum);
torch::Tensor token_cnts =
torch::empty({(num_experts + 1) * num_experts},
torch::TensorOptions()
.dtype(torch::kInt)
.device(topk_ids.device()));
torch::Tensor cumsum =
torch::empty({num_experts + 1}, torch::TensorOptions()
.dtype(torch::kInt)
.device(topk_ids.device()));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Nice doc pointer, thanks

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
Copy link
Member

it is recommended to merge main, and use pre-commit to run the linter now.

@mgoin
Copy link
Member

mgoin commented Jan 20, 2025

I actually think this PR #12222 has a better implementation of this optimization, could you please help review @houseroad ?

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.

Considering this PR instead #12222

@houseroad
Copy link
Contributor Author

Yeah, agree #12222 is a better approach, left some comment, but overall looks good to me. Let's go with #12222. So close this one.

@houseroad houseroad closed this Jan 20, 2025
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.

5 participants