Skip to content

fix cutlass_3x_gemm_fp8_blockwise on sm103a - #32224

Merged
vllm-bot merged 16 commits into
vllm-project:mainfrom
IwakuraRein:fix-cutlass_3x_gemm_fp8_blockwise
Feb 2, 2026
Merged

vllm-bot merged 16 commits into
vllm-project:mainfrom
IwakuraRein:fix-cutlass_3x_gemm_fp8_blockwise

Conversation

@IwakuraRein

@IwakuraRein IwakuraRein commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

Purpose

When compiling with sm103a, the output of cutlass_3x_gemm_fp8_blockwise is garbage value.

Updated the helpers in csrc/cutlass_extensions/common.hpp to include sm103a.

Also added a runtime error message when the kernel is executed but not compiled.

Test Plan

pytest tests/kernels/quantization/test_block_fp8.py::test_w8a8_block_fp8_cutlass_matmul

Test Result


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.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>

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

Copy link
Copy Markdown
Contributor

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 aims to fix an issue with cutlass_3x_gemm_fp8_blockwise on the sm103a architecture by introducing a new preprocessor guard, enable_sm100f_only, which correctly includes sm103a. The change also adds compiler warnings for kernels used on unsupported architectures, which is a good practice. However, the implementation of these warnings is flawed in several places, causing them to be triggered during host code compilation, which can be very noisy. My review includes suggestions to correct this behavior so that warnings are only shown for device code compilation on unsupported architectures.

Comment thread csrc/cutlass_extensions/common.hpp Outdated
CUTLASS_DEVICE void operator()(Args&&... args) {
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ >= 900
Kernel::operator()(std::forward<Args>(args)...);
#else

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The use of #else here will cause a compiler warning to be emitted during host-side compilation, as __CUDA_ARCH__ is not defined. This can lead to a large number of unnecessary warnings. To ensure the warning is only triggered for device compilation on an unsupported architecture, you should use #elif defined(__CUDA_ARCH__). This pattern is already correctly used for enable_sm100f_only in this same file.

#elif defined(__CUDA_ARCH__)

Comment thread csrc/cutlass_extensions/common.hpp Outdated
CUTLASS_DEVICE void operator()(Args&&... args) {
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ == 900
Kernel::operator()(std::forward<Args>(args)...);
#else

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The use of #else here will cause a compiler warning to be emitted during host-side compilation, as __CUDA_ARCH__ is not defined. This can lead to a large number of unnecessary warnings. To ensure the warning is only triggered for device compilation on an unsupported architecture, you should use #elif defined(__CUDA_ARCH__). This pattern is already correctly used for enable_sm100f_only in this same file.

#elif defined(__CUDA_ARCH__)

Comment thread csrc/cutlass_extensions/common.hpp Outdated
CUTLASS_DEVICE void operator()(Args&&... args) {
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ == 1000
Kernel::operator()(std::forward<Args>(args)...);
#else

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The use of #else here will cause a compiler warning to be emitted during host-side compilation, as __CUDA_ARCH__ is not defined. This can lead to a large number of unnecessary warnings. To ensure the warning is only triggered for device compilation on an unsupported architecture, you should use #elif defined(__CUDA_ARCH__). This pattern is already correctly used for enable_sm100f_only in this same file.

#elif defined(__CUDA_ARCH__)

Comment thread csrc/cutlass_extensions/common.hpp Outdated
CUTLASS_DEVICE void operator()(Args&&... args) {
#if defined __CUDA_ARCH__ && __CUDA_ARCH__ == 1200
Kernel::operator()(std::forward<Args>(args)...);
#else

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The use of #else here will cause a compiler warning to be emitted during host-side compilation, as __CUDA_ARCH__ is not defined. This can lead to a large number of unnecessary warnings. To ensure the warning is only triggered for device compilation on an unsupported architecture, you should use #elif defined(__CUDA_ARCH__). This pattern is already correctly used for enable_sm100f_only in this same file.

#elif defined(__CUDA_ARCH__)

Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>
Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>
@IwakuraRein
IwakuraRein force-pushed the fix-cutlass_3x_gemm_fp8_blockwise branch from 4575a3c to 764db01 Compare January 13, 2026 18:21
Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>
@IwakuraRein
IwakuraRein force-pushed the fix-cutlass_3x_gemm_fp8_blockwise branch from 764db01 to 42d3ba8 Compare January 13, 2026 18:26
Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>
@IwakuraRein
IwakuraRein force-pushed the fix-cutlass_3x_gemm_fp8_blockwise branch from 64b930e to b859962 Compare January 13, 2026 18:34
Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>
Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>
Kernel::operator()(std::forward<Args>(args)...);
#else
printf("This kernel only supports sm100a.\n");
asm("trap;");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you check, in case of real fail, will this print appears?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. I have tested and the print appears.

Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>
@IwakuraRein
IwakuraRein marked this pull request as ready for review January 13, 2026 21:53
@IwakuraRein IwakuraRein moved this to Ready in NVIDIA Jan 13, 2026
@pavanimajety pavanimajety added the ready ONLY add when PR is ready to merge/full CI is needed label Jan 14, 2026

@vadiklyutiy vadiklyutiy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks good

@mxz297

mxz297 commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

Thanks for the identifying and fixing this issue!

@IwakuraRein

Copy link
Copy Markdown
Contributor Author

Looks like the ci/cd failed due to some bugs in the scaled_dequantize at quant_utils.py

@mgoin mgoin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@vllm-bot
vllm-bot merged commit 089cd4f into vllm-project:main Feb 2, 2026
92 of 95 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to Done in NVIDIA Feb 2, 2026
PiratePai pushed a commit to PiratePai/epd_shm that referenced this pull request Feb 3, 2026
Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>
Co-authored-by: Pavani Majety <pmajety@nvidia.com>
Signed-off-by: Pai <416932041@qq.com>
PiratePai pushed a commit to PiratePai/epd_shm that referenced this pull request Feb 3, 2026
Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>
Co-authored-by: Pavani Majety <pmajety@nvidia.com>
Signed-off-by: Pai <416932041@qq.com>
gameofdimension pushed a commit to gameofdimension/vllm that referenced this pull request Feb 5, 2026
Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>
Co-authored-by: Pavani Majety <pmajety@nvidia.com>
Signed-off-by: felix01.yu <felix01.yu@vipshop.com>
mystous pushed a commit to mystous/vllm_hybrid that referenced this pull request May 10, 2026
Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>
Co-authored-by: Pavani Majety <pmajety@nvidia.com>
my-other-github-account pushed a commit to my-other-github-account/vllm that referenced this pull request May 15, 2026
Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>
Co-authored-by: Pavani Majety <pmajety@nvidia.com>
0826joyce pushed a commit to 0826joyce/vllm-serving-optimization that referenced this pull request May 19, 2026
Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>
Co-authored-by: Pavani Majety <pmajety@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nvidia ready ONLY add when PR is ready to merge/full CI is needed

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants