-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[Perf] SM100 FP8 GEMM Optimizations after cutlass_profiler #20071
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
[Perf] SM100 FP8 GEMM Optimizations after cutlass_profiler #20071
Conversation
Signed-off-by: ilmarkov <imarkov@redhat.com>
👋 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.
Summary of Changes
Hello @ilmarkov, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request implements performance optimizations for FP8 General Matrix Multiply (GEMM) operations by refining the underlying CUTLASS configurations. The changes focus on improving efficiency for various matrix dimensions, especially for smaller M
values (up to 256), based on extensive profiling data. The goal is to enhance throughput and reduce computation time for relevant workloads.
Highlights
- CUTLASS Configuration Tuning: Optimized CUTLASS GEMM configurations (TileShape and ClusterShape) for FP8 operations on SM100 architecture, specifically targeting
M
dimensions up to 256. These adjustments are based on insights fromcutlass_profiler
. - Refined M-Dimension Dispatch Logic: The dispatch mechanism for FP8 GEMM kernels has been updated to apply the newly tuned configurations more precisely across different
M
(batch size) ranges. This includes adjusting theM
thresholds and corresponding configuration struct names. - Performance Improvements: The changes are intended to yield performance gains, particularly for smaller batch sizes, as demonstrated by the provided benchmark results showing speedups up to 1.54x for certain configurations.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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
The code changes tune CUTLASS configurations for M <= 256 based on cutlass_profiler insights. The changes involve adjusting the tile shape and cluster shape for different ranges of M, and updating the dispatch logic to use the new configurations. The review focuses on ensuring that the comments accurately reflect the new ranges for M, and that the changes align with the performance tuning results.
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.
LGTM considering the large improvements for Llama 70B, thanks!
Additional performance optimizations after #19566
Tune CUTLASS configs for M <= 256 using cutlass_profiler insights.
The PR allows to get from 1.12x to 1.5x speedup for certain NxK pairs without affecting performance for the other NxK.
Cutlass profiler results.
We pick the best configuration that has best performance across different NxK pairs for static M.
cta_m, cta_n, cta_k, cluster_m, cluster_n, cluster_k are the parameters. Rank represents the rank of the performance parameters set for a single NxK in cutlass_profiler comparison, GFPLOPs - performance results in the corresponding benchmark for all NxK pairs.
M=16
M=32
M=64
M=128
Kernel benchmarks using #17126 on B200.
python benchmarks/kernels/bench_fp8_gemm.py --model meta-llama/Llama-3.1-8B-Instruct --tp-sizes 1
and
python benchmarks/kernels/bench_fp8_gemm.py --model meta-llama/Llama-3.3-70B-Instruct --tp-sizes 4
meta-llama/Llama-3.1-8B-Instruct
N=4096 K=14336
meta-llama/Llama-3.1-8B-Instruct
N=4096 K=4096
meta-llama/Llama-3.1-8B-Instruct
N=6144 K=4096
meta-llama/Llama-3.1-8B-Instruct
N=28672 K=4096
meta-llama/Llama-3.3-70B-Instruct
N=14336 K=8192
meta-llama/Llama-3.3-70B-Instruct
N=2560 K=8192
meta-llama/Llama-3.3-70B-Instruct
N=8192 K=2048
meta-llama/Llama-3.3-70B-Instruct
N=8192 K=7168
Raw results: