Skip to content

Conversation

@varun-sundar-rabindranath
Copy link
Contributor

@varun-sundar-rabindranath varun-sundar-rabindranath commented Nov 5, 2024

Refactor Cutlass c3x kernels for better maintainability and easier experimentation.

  • Break scaled_mm_c3x.cu into,
    • scaled_mm_c3x.cuh : All the base cutlass c3x code (cutlass_3x_gemm and cutlass_gemm_caller).
    • scaled_mm_c3x_sm90_fp8_dispatch.cuh : All fp8 kernels along with the gemm shape based dispatch function.
    • scaled_mm_c3x_sm90_int8_dispatch.cuh : All int8 kernels along with the gemm shape based dispatch function.
    • scaled_mm_c3x.cu : interfaces expected by scaled_mm_entry.cu

@github-actions
Copy link

github-actions bot commented Nov 5, 2024

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

🚀

@varun-sundar-rabindranath varun-sundar-rabindranath marked this pull request as draft November 5, 2024 20:35
@varun-sundar-rabindranath varun-sundar-rabindranath marked this pull request as ready for review November 12, 2024 03:27
@varun-sundar-rabindranath
Copy link
Contributor Author

@tlrmchlsmth @ProExpertProg @LucasWilkinson PTAL. Thanks!

@LucasWilkinson
Copy link
Collaborator

LGTM (just FYI may conflict with #9855)

Copy link
Member

@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

@tlrmchlsmth tlrmchlsmth added the ready ONLY add when PR is ready to merge/full CI is needed label Nov 12, 2024
@varun-sundar-rabindranath varun-sundar-rabindranath force-pushed the varun/cutlass-c3x-refactor branch 2 times, most recently from 7dbe3b3 to 4f44aac Compare November 15, 2024 14:35
@mergify
Copy link

mergify bot commented Nov 18, 2024

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @varun-sundar-rabindranath.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@varun-sundar-rabindranath
Copy link
Contributor Author

@tlrmchlsmth re-requesting review as the PR is now rebased.

Copy link
Member

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

Looks good! (Likely wait for #10995)

Copy link
Member

Choose a reason for hiding this comment

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

Actually do you need to turn off clang-format here? The reason for turning it off is that CUTLASS headers need to be included in a specific order but it looks like that's not the case following the refactor

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using clang-format in this block, turns,

#include <cudaTypedefs.h>

#if defined CUDA_VERSION && CUDA_VERSION >= 12000

#include "scaled_mm_c3x_sm90_fp8_dispatch.cuh"
#include "scaled_mm_c3x_sm90_int8_dispatch.cuh"

#include "cutlass_extensions/epilogue/scaled_mm_epilogues_c3x.hpp"

using namespace vllm;

into

#include <cudaTypedefs.h>

#if defined CUDA_VERSION && CUDA_VERSION >= 12000

    #include "scaled_mm_c3x_sm90_fp8_dispatch.cuh"
    #include "scaled_mm_c3x_sm90_int8_dispatch.cuh"

    #include "cutlass_extensions/epilogue/scaled_mm_epilogues_c3x.hpp"

using namespace vllm;

the #if seems trigger inconsistent indenting. I switched off clang-format in this block to avoid that.

I moved the original clang-format toggle to scaled_mm_c3x.cuh. https://github.com/vllm-project/vllm/blob/dad8e4760f9d24faadfc076a13ed7d130211ea2d/csrc/quantization/cutlass_w8a8/scaled_mm_c3x.cuh#L3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had second thoughts about this and removed the clang-format block. It is probably better to stick to the convention.

@varun-sundar-rabindranath varun-sundar-rabindranath force-pushed the varun/cutlass-c3x-refactor branch 2 times, most recently from 55d9927 to e5f324b Compare December 18, 2024 16:13
Varun Sundar Rabindranath added 2 commits December 19, 2024 03:28
Signed-off-by: Varun Sundar Rabindranath <[email protected]>
Signed-off-by: Varun Sundar Rabindranath <[email protected]>
@tlrmchlsmth tlrmchlsmth enabled auto-merge (squash) December 19, 2024 03:31
@tlrmchlsmth tlrmchlsmth merged commit 8936316 into vllm-project:main Dec 19, 2024
75 checks passed
mzusman pushed a commit to mzusman/vllm that referenced this pull request Mar 12, 2025
Signed-off-by: Varun Sundar Rabindranath <[email protected]>
Co-authored-by: Varun Sundar Rabindranath <[email protected]>
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.

4 participants