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

[Bugfix][Kernel] Fix moe align block issue for mixtral #12413

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ElizaWszola
Copy link
Contributor

@ElizaWszola ElizaWszola commented Jan 24, 2025

Fix an issue with shared arrays in moe_align_block_size_kernel that was causing Mixtral inference to crash.

Testing: run inference with
llm = LLM(model="TheBloke/Mixtral-8x7B-v0.1-GPTQ")

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.

🚀

@ElizaWszola ElizaWszola mentioned this pull request Jan 24, 2025
8 tasks
@mgoin
Copy link
Member

mgoin commented Jan 24, 2025

Could you please take a look @jinzhen-lin

@mgoin mgoin added the ready ONLY add when PR is ready to merge/full CI is needed label Jan 24, 2025
Co-authored-by: Tyler Michael Smith <[email protected]>
Signed-off-by: ElizaWszola <[email protected]>
@ElizaWszola ElizaWszola force-pushed the fix-mixtral-align-block branch from 349d986 to e215ef6 Compare January 24, 2025 20:33
Signed-off-by: ElizaWszola <[email protected]>
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.

Thanks for the fix!

@tlrmchlsmth
Copy link
Collaborator

tlrmchlsmth commented Jan 24, 2025

Basically we were only asking for num_experts + 1 elements in shared_memory for cumsum. But the offset for tokens_cnts in the kernel was as if cumsum needed max(num_experts, warp_size) + 1.

int32_t* cumsum = shared_mem; // 1d tensor with shape (num_experts + 1)
token_cnts_t* tokens_cnts = (token_cnts_t*)(shared_mem + blockDim.x + 1);

const int32_t shared_mem_i32 =
((num_thread + 1) * num_experts + (num_experts + 1)) * sizeof(int32_t);

So we were trying to use more shared memory than we asked for. Since we only need num_experts + 1 elements, we have this fix

@simon-mo simon-mo enabled auto-merge (squash) January 24, 2025 22:48
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.

Thank you for the careful fix

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