-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Kernel] Add CUTLASS sparse support, heuristics, and torch operators #10340
base: main
Are you sure you want to change the base?
Conversation
👋 Hi! Thank you for contributing to the vLLM project. 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:
🚀 |
CMakeLists.txt
Outdated
|
||
FetchContent_Declare( | ||
cutlass | ||
GIT_REPOSITORY https://github.com/nvidia/cutlass.git | ||
GIT_TAG v3.5.1 | ||
GIT_TAG be692b48b01620eedabeef8325df5d4eeed6c2ae |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are pointing to a TAG, we cannot use GIT_SHALLOW -- see comment a few lines down
CMakeLists.txt
Outdated
# | ||
# The cutlass_scaled_mm kernels for Hopper (c3x, i.e. CUTLASS 3.x) require | ||
# CUDA 12.0 or later (and only work on Hopper, 9.0/9.0a for now). | ||
cuda_archs_loose_intersection(SCALED_MM_3X_ARCHS "9.0;9.0a" "${CUDA_ARCHS}") | ||
if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_GREATER 12.0 AND SCALED_MM_3X_ARCHS) | ||
set(SRCS "csrc/sparse/cutlass/sparse_compressor.cu") | ||
set_gencode_flags_for_srcs( | ||
SRCS "${SRCS}" | ||
CUDA_ARCHS "${SCALED_MM_3X_ARCHS}") | ||
list(APPEND VLLM_EXT_SRC "${SRCS}") | ||
list(APPEND VLLM_GPU_FLAGS "-DENABLE_SCALED_MM_C3X=1") | ||
message(STATUS "Building test_util for archs: ${SCALED_MM_3X_ARCHS}") | ||
else() | ||
if (NOT ${CMAKE_CUDA_COMPILER_VERSION} VERSION_GREATER 12.0 AND SCALED_MM_3X_ARCHS) | ||
message(STATUS "Not building test_util as CUDA Compiler version is " | ||
"not >= 12.0, we recommend upgrading to CUDA 12.0 or " | ||
"later if you intend on running FP8 quantized models on " | ||
"Hopper.") | ||
else() | ||
message(STATUS "Not building test_util as no compatible archs found " | ||
"in CUDA target architectures") | ||
endif() | ||
|
||
# clear SCALED_MM_3X_ARCHS so the scaled_mm_c2x kernels know we didn't | ||
# build any 3x kernels | ||
set(SCALED_MM_3X_ARCHS) | ||
endif() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of copying this block of code, we should be able to add files to the set defined on line 256:
set(SRCS "csrc/quantization/cutlass_w8a8/scaled_mm_c3x.cu",
"csrc/sparse/cutlass/sparse_compressor.cu",
"csrc/sparse/cutlass/sparse_scaled_mm_c3x.cu")
nm_cutlass_c.cmake
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this file needed?
This pull request has merge conflicts that must be resolved before it can be |
Implements NVIDIA Cutlass 2:4 structured sparsity support in VLLM for LLM inference. This sparsification pattern maintains at most 2 non-zero weights out of every 4 weights in the model.
Changes