Skip to content

Conversation

yewentao256
Copy link
Collaborator

@yewentao256 yewentao256 commented Aug 21, 2025

Purpose

Enable DeepGEMM Linear on B200

This should also fix some cutlass linear acc error since the weight is quantized to e8m0

Test

VLLM_USE_DEEP_GEMM=1 lm_eval   --model vllm   --model_args "pretrained=Qwen/Qwen3-30B-A3B-FP8,max_model_len=32768,enforce_eager=True"   --trust_remote_code   --tasks gsm8k   --num_fewshot 5   --batch_size auto
|Tasks|Version|     Filter     |n-shot|  Metric   |   |Value |   |Stderr|
|-----|------:|----------------|-----:|-----------|---|-----:|---|-----:|
|gsm8k|      3|flexible-extract|     5|exact_match||0.8529|±  |0.0098|
|     |       |strict-match    |     5|exact_match||0.8855|±  |0.0088|

# main
|Tasks|Version|     Filter     |n-shot|  Metric   |   |Value |   |Stderr|
|-----|------:|----------------|-----:|-----------|---|-----:|---|-----:|
|gsm8k|      3|flexible-extract|     5|exact_match||0.8590|±  |0.0096|
|     |       |strict-match    |     5|exact_match||0.8969|±  |0.0084|
VLLM_USE_DEEP_GEMM=1 vllm bench throughput --model Qwen/Qwen3-30B-A3B-FP8 --load-format dummy --input-len 1000 --output-len 100 --trust_remote_code --enable-expert-parallel
Throughput: 40.59 requests/s, 44557.64 total tokens/s, 4059.10 output tokens/s
# main
Throughput: 39.97 requests/s, 43880.62 total tokens/s, 3997.42 output tokens/s

Signed-off-by: yewentao256 <[email protected]>
Signed-off-by: yewentao256 <[email protected]>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enables DeepGEMM for FP8 linear layers on B200 GPUs by updating the device capability check. The changes also include refactoring the DeepGEMM eligibility check into the vllm.utils.deep_gemm module for better code organization. The implementation looks good, but I've found a small redundancy in the new check function that can be improved for clarity and maintainability.

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.

🚀

Signed-off-by: yewentao256 <[email protected]>
@yewentao256 yewentao256 changed the title [Feature] Enable DeepGEMM Linear on B200 [Feature] Enable DeepGEMM Linear on B200; 1.5% E2E throughput improvement Aug 21, 2025
@yewentao256
Copy link
Collaborator Author

@mgoin CC

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. Should we also take the opportunity to refactor the logic in fp8.py? It seems there is no logic about deepgemm in Fp8LinearMethod and Fp8MoEMethod has this possibly different local logic

        # Check for DeepGemm support.
        self.allow_deep_gemm = False
        if envs.VLLM_USE_DEEP_GEMM:
            if not has_deep_gemm():
                logger.warning_once("Failed to import DeepGemm kernels.")
            elif not self.block_quant:
                logger.warning_once("Model is not block quantized. Not using "
                                    "DeepGemm kernels")
            elif (is_deep_gemm_supported()):
                logger.info_once("Using DeepGemm kernels for Fp8MoEMethod.")
                self.allow_deep_gemm = True
            else:
                logger.warning_once(
                    "DeepGemm not supported on the current platform.")

@yewentao256
Copy link
Collaborator Author

LGTM. Should we also take the opportunity to refactor the logic in fp8.py? It seems there is no logic about deepgemm in Fp8LinearMethod and Fp8MoEMethod has this possibly different local logic

        # Check for DeepGemm support.
        self.allow_deep_gemm = False
        if envs.VLLM_USE_DEEP_GEMM:
            if not has_deep_gemm():
                logger.warning_once("Failed to import DeepGemm kernels.")
            elif not self.block_quant:
                logger.warning_once("Model is not block quantized. Not using "
                                    "DeepGemm kernels")
            elif (is_deep_gemm_supported()):
                logger.info_once("Using DeepGemm kernels for Fp8MoEMethod.")
                self.allow_deep_gemm = True
            else:
                logger.warning_once(
                    "DeepGemm not supported on the current platform.")

Sounds good, I record this done and will have a separate PR for this.

@mgoin mgoin enabled auto-merge (squash) August 21, 2025 19:40
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 21, 2025
@simon-mo simon-mo merged commit 394591e into vllm-project:main Aug 22, 2025
42 of 44 checks passed
@yewentao256 yewentao256 deleted the wye-fix-deepgemm-linear-issue branch August 22, 2025 18:58
Xu-Wenqing pushed a commit to Xu-Wenqing/vllm that referenced this pull request Aug 23, 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
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