refactor: unify autotuner for bmm_fp8#1479
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @ttyio, 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 introduces a unified autotuning mechanism for bmm_fp8 (batch matrix multiplication with FP8 precision) operations. It adds an "auto" backend option that intelligently selects the most performant implementation among cuBLAS, cuDNN, and CUTLASS, thereby optimizing performance for various hardware and input configurations.
Highlights
- New "auto" backend for bmm_fp8: The
bmm_fp8function now supports an "auto" backend option, which automatically selects the most performant GEMM (General Matrix Multiply) kernel among available implementations (cuBLAS, cuDNN, CUTLASS) for FP8 batch matrix multiplication. - Refactored FP8 GEMM implementations: The cuBLAS and CUTLASS FP8 GEMM implementations have been refactored into
TunableRunnerclasses, making them compatible with the autotuning framework for dynamic performance optimization. - Added cuDNN FP8 GEMM TunableRunner: A new
TunableRunnerhas been introduced for cuDNN FP8 GEMM operations, expanding the range of backends available for autotuning. - Unified FP8 GEMM dispatch logic: The dispatch logic for
bmm_fp8has been consolidated into a single autotuning entry point (fp8_gemm_sm100), streamlining the process of selecting the optimal backend based on runtime characteristics. - Updated test suite for "auto" backend: The test suite for
bmm_fp8has been updated to include test cases for the new "auto" backend, ensuring its correctness and performance across various 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.
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.
Code Review
This pull request introduces an "auto" backend for bmm_fp8 to enable autotuning across cutlass, cudnn, and cublas backends, which is a great enhancement. The code is well-structured and the new autotuning logic is centralized. My feedback focuses on improving code clarity and maintainability by adding missing type hints and simplifying some expressions. I've also suggested a change to improve robustness by handling invalid inputs defensively. Finally, there's a critical fix for the tests to ensure the new autotuning capabilities are properly verified.
33049ae to
0702506
Compare
|
@nvjullin please comment if this works. thanks! |
add "auto" backend and autotune tactics among cutlass, cudnn and cublas. Signed-off-by: Vincent Huang <vincenth@nvidia.com>
f352aa1 to
3db1044
Compare
|
@yongwww can I get this merged? thank you! |
add "auto" backend and autotune tactics among cutlass, cudnn and cublas.
📌 Description
🔍 Related Issues
🚀 Pull Request Checklist
Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.
✅ Pre-commit Checks
pre-commitby runningpip install pre-commit(or used your preferred method).pre-commit install.pre-commit run --all-filesand fixed any reported issues.🧪 Tests
unittest, etc.).Reviewer Notes