Re-enable Flashinfer TRTLLM GEN MHA and Add Unit Test#12885
Re-enable Flashinfer TRTLLM GEN MHA and Add Unit Test#12885Fridge003 merged 8 commits intosgl-project:mainfrom
Conversation
Summary of ChangesHello @samuellees, 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 focuses on enhancing the attention backend capabilities for Blackwell GPUs by re-enabling and thoroughly testing the Flashinfer TRTLLM GEN MHA with BF16 precision. The changes ensure that this high-performance attention mechanism is properly supported and validated, contributing to improved model efficiency and reliability on the latest NVIDIA hardware. Highlights
Using Gemini Code AssistThe 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 by creating a comment using either
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 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
|
There was a problem hiding this comment.
Code Review
This pull request re-enables the Flashinfer TRTLLM GEN MHA backend and adds a corresponding unit test. The changes look good overall. I've made a few suggestions to improve code readability and maintainability in both the main logic and the new test file. These include simplifying a condition check, using constants for hardcoded values, deriving the test host from the base URL for consistency, and removing a debug print statement from the test.
| runner.server_args.attention_backend == "triton" | ||
| ), "triton backend is the only supported backend on Blackwell GPUs for hybrid GDN models, use --attention-backend triton to specify the backend." | ||
| or runner.server_args.attention_backend == "trtllm_mha" | ||
| ), "triton or trtllm_mha backend are the only supported backends on Blackwell GPUs for hybrid GDN models, use --attention-backend triton or --attention-backend trtllm_mha to specify the backend." |
There was a problem hiding this comment.
For better readability and maintainability, you can use the in operator to check if the attention backend is one of the supported values. This makes the code more concise and easier to extend. Additionally, the assertion message can be simplified.
runner.server_args.attention_backend in ("triton", "trtllm_mha")
), "Only 'triton' or 'trtllm_mha' backends are supported on Blackwell GPUs for hybrid GDN models. Use --attention-backend to specify one."| class TestFlashinferTrtllmGenAttnBackend(CustomTestCase): | ||
| @classmethod | ||
| def setUpClass(cls): | ||
| cls.model = "Qwen/Qwen3-Next-80B-A3B-Instruct" |
There was a problem hiding this comment.
To improve maintainability, it's a good practice to define hardcoded strings like model names as constants. This makes it easier to manage and update the model name if needed.
| cls.model = "Qwen/Qwen3-Next-80B-A3B-Instruct" | |
| cls.model = "Qwen/Qwen3-Next-80B-A3B-Instruct" # Consider defining as a module-level constant |
| num_questions=200, | ||
| max_new_tokens=512, | ||
| parallel=128, | ||
| host="http://127.0.0.1", |
There was a problem hiding this comment.
| port=int(self.base_url.split(":")[-1]), | ||
| ) | ||
| metrics = run_eval(args) | ||
| print(f"{metrics=}") |
|
@samuellees Please add this test to b200 nightly test suite |
Done |
Motivation
Re-enable Flashinfer TRTLLM GEN MHA BF16. And add unit test for it. It was disabled non-intentionally.
Related PR cc @DomBrown
Related PR cc @netanel-haber
cc @yizhang2077
Modifications
Accuracy Tests
Benchmarking and Profiling
Checklist