Skip to content

Conversation

Hongbosherlock
Copy link
Contributor

@Hongbosherlock Hongbosherlock commented Feb 9, 2025

Thanks to #11868

Currently only supports scale_a block shapes of 1x128 and scale_b block shapes of 128x128 (for deepseek v3)

This CUTLASS GEMM is slower when K is very large, such as m128-n1536-k7168 in deepseek v3.
To address this, I explored using both Stream-K and Split-K strategies to accelerate the GEMM computation.

Among these approaches, Stream-K demonstrated superior performance in most cases, achieving over 60% performance improvement compared to the baseline.

To achieve overall better performance, use Stream-K only when K > 3N.

Below are the test results based on the GEMM shape of DeepSeek-V3, tested on H800 with TP-4.

[----------------- scaled-torch.float8_e4m3fn-gemm ------------------]
                           |  cutlass_fp8_fp8_fp16_scaled_mm_blockwise
  -------------------------------------------------------------------------------  
                                             cutlass-base             streamk                                 
1 threads: ----------------------------------------------------------------------
      MKN=(128x7168x1536)  |                    28.5                  17.1                large K       
      MKN=(128x1536x6144)  |                    10.4                  10.7
      MKN=(128x4096x7168)  |                    19.3                  19.3
      MKN=(128x7168x9216)  |                    32.7                  32.7
      MKN=(128x4608x7168)  |                    20.6                  20.6
      MKN=(128x7168x1024)  |                    26.4                  17                  large K
      MKN=(128x512x7168)   |                    10.4                  10.8
      MKN=(256x7168x4096)  |                    28.9                  29.3
      MKN=(256x7168x2048)  |                    29.8                  22                  large K

Times are in microseconds (us).

Copy link

github-actions bot commented Feb 9, 2025

👋 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.

🚀

@Hongbosherlock Hongbosherlock changed the title Add streamK for block-quantized CUTLASS kernels [Kernel]Add streamK for block-quantized CUTLASS kernels Feb 9, 2025
@robertgshaw2-redhat
Copy link
Collaborator

robertgshaw2-redhat commented Feb 9, 2025

cc @LucasWilkinson

@LucasWilkinson
Copy link
Collaborator

@Hongbosherlock Awesome thanks for the contribution! thats some nice speedups! Left a couple nits.

@Hongbosherlock
Copy link
Contributor Author

@Hongbosherlock Awesome thanks for the contribution! thats some nice speedups! Left a couple nits.

Thank you for the feedback! I’ll take a look at the nits and address them ASAP.

@Hongbosherlock
Copy link
Contributor Author

Hi @LucasWilkinson
Thank you for the feedback! I’ve addressed the nits and verified the performance improvements.
Could you please check if it’s ready to be merged?

Signed-off-by: leoneo <[email protected]>
Copy link
Collaborator

@LucasWilkinson LucasWilkinson left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the hardwork!

@mgoin mgoin added the ready ONLY add when PR is ready to merge/full CI is needed label Feb 11, 2025
@DarkLight1337 DarkLight1337 enabled auto-merge (squash) February 21, 2025 06:14
@simon-mo simon-mo merged commit 839b27c into vllm-project:main Feb 21, 2025
64 of 70 checks passed
@Hongbosherlock Hongbosherlock deleted the cutlass_streamK branch February 23, 2025 07:57
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.

5 participants