[Blackwell] Make mxint4 flashinfer_trtllm moe gemm set by default on blackwell#18136
Conversation
Summary of ChangesHello @vincentzed, 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 optimizes the performance of certain Kimi K2/K2.5 models on Blackwell GPUs by automatically configuring the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
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 enables the flashinfer_trtllm MoE backend by default for Kimi int4 models on Blackwell GPUs. The changes introduce logic to detect this specific quantization configuration. My review identified a potential critical issue where this detection might fail if the model's quantization information is stored under compression_config instead of quantization_config. I've provided a code suggestion to make the detection more robust by checking both locations. Additionally, I've included a medium-severity suggestion to improve maintainability by replacing magic values in the detection logic with named constants.
| quant_method = get_quantization_config(hf_config) | ||
| quant_cfg = getattr(hf_config, "quantization_config", None) or {} |
There was a problem hiding this comment.
The logic here for getting quant_method and quant_cfg only considers hf_config.quantization_config. However, as seen in the _parse_quant_hf_config method within ModelConfig, models using the compressed-tensors format might store their configuration under hf_config.compression_config. If the Kimi model uses compression_config, this detection logic will fail as both quant_method and quant_cfg will be None or empty. The logic should be updated to check for compression_config as a fallback, similar to _parse_quant_hf_config.
| quant_method = get_quantization_config(hf_config) | |
| quant_cfg = getattr(hf_config, "quantization_config", None) or {} | |
| quant_cfg = getattr(hf_config, "quantization_config", None) or getattr(hf_config, "compression_config", None) or {} | |
| quant_method = quant_cfg.get("quant_method") |
| is_kimi_k2_k25_thinking_int4 = ( | ||
| quant_method == "compressed-tensors" | ||
| and weights_cfg.get("num_bits") == 4 | ||
| and weights_cfg.get("group_size") == 32 | ||
| and weights_cfg.get("strategy") == "group" | ||
| and weights_cfg.get("type") == "int" | ||
| ) |
There was a problem hiding this comment.
8f46313 to
9e84744
Compare
|
/tag-and-rerun-ci |
|
/rerun-failed-ci |
|
@vincentzed @b8zhong I meet this error: When launch kimi-k25 by: |
…ault on blackwell (sgl-project#18136)" This reverts commit 894e887.
…blackwell (sgl-project#18136) Signed-off-by: vincentzed <207368749+vincentzed@users.noreply.github.com>
…blackwell (sgl-project#18136) Signed-off-by: vincentzed <207368749+vincentzed@users.noreply.github.com>
…blackwell (sgl-project#18136) Signed-off-by: vincentzed <207368749+vincentzed@users.noreply.github.com>
Motivation
After #16892, we found that it was suitable to enable by default.
Modifications
python3 -m sglang.launch_server --model-path moonshotai/Kimi-K2-Thinking --tp 8 --trust-remote-code --tool-call-parser kimi_k2 --reasoning-parser kimi_k2python3 -m sglang.bench_one_batch_server --model None --tokenizer-path xxx --base-url http://localhost:30000 --batch-size 1 4 8 16 32 64 128 256 --input-len 8192 --output-len 1024 --show-reporthttps://huggingface.co/moonshotai/Kimi-K2-Thinking/blob/main/config.json
Important: K2 regular and K2 0905 are not Marlin (neither)
Accuracy Tests
Benchmarking and Profiling
Checklist
Review Process
/tag-run-ci-label,/rerun-failed-ci,/tag-and-rerun-ci