-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[Performance] Introduce Marlin-based GEMM kernels for the calibration-free RTN-based quantization #21865
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
Conversation
👋 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 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 🚀 |
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.
Code Review
This pull request introduces high-performance Marlin-based kernels for RTN quantization, significantly improving latency. The changes include a new CUDA kernel, modifications to build files, and updates to the Python-level quantization logic to use the new kernel. My review focuses on API correctness, code robustness, and maintainability within the new CUDA kernel. I've identified a few areas for improvement, such as using const
references for read-only tensors, replacing device-side assert(false)
with static_assert
for better error reporting, and ensuring consistent logic for determining quantization bit-width.
#else | ||
assert(false); | ||
#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.
Using assert(false)
in CUDA device code is not ideal. If triggered, it can lead to unhelpful error messages. It's better to use static_assert
to provide a clear compile-time error if an unsupported architecture is used.
#else
static_assert(false, "Unsupported CUDA architecture for this Marlin kernel path.");
#endif
#else | ||
assert(false); | ||
#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.
Using assert(false)
in CUDA device code is not ideal. If triggered, it can lead to unhelpful error messages. It's better to use static_assert
to provide a clear compile-time error if an unsupported architecture is used.
#else
static_assert(false, "Unsupported CUDA architecture for this Marlin kernel path.");
#endif
8c97d26
to
0ae970e
Compare
This PR enhances the work started in #18768 and #20766 by introducing Marlin-based kernels for the calibration-free RTN-based quantization.
These kernels substantially improve the performance of dense models quantized with RTN.
We ran
benchmark_latency
with several Llama models on a machine equipped with H100 GPUs. The exact command was[RTN_NUM_BITS=4] python benchmark_latency.py --model <model> --n 1 --num-iters-warmup 3 --num-iters 10 --input-len 256 --output-len 32 -tp <#GPUs> --batch-size <batch> [--quantization rtn]
Each data point is an average of 5 runs, the units are seconds (measuring generation latency, the lower the better).
Here are the results for Llama3.1-8B (ran on 1 GPU), for various batch sizes:
Here are the results for Llama3.3-70B (ran on 4 GPUs), for various batch sizes: