Fix silent bug with FP8 per tensor non-gated MoE#2882
Fix silent bug with FP8 per tensor non-gated MoE#2882aleozlx merged 3 commits intoflashinfer-ai:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughRemoved the activation-type validation guard in the FP8 per-tensor branch of Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello, 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 resolves a silent bug by lifting an unnecessary constraint within the FP8 per-tensor quantization logic for Mixture of Experts (MoE) models. Previously, the system incorrectly enforced that FP8 per-tensor quantization could only be applied to gated activations, which prevented its use in non-gated MoE setups. The change expands the compatibility of FP8 per-tensor quantization, allowing for greater flexibility and efficiency in MoE deployments. 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. 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. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request removes the restriction on using non-gated activations for FP8 per-tensor MoE configurations. However, this change exposes an existing bug in Fp8PerTensorLauncher::prepare_moe where buffer allocations for gemm1_output and gemm1_output_scale are hardcoded with a multiplier of 2. This hardcoded value is only correct for gated activations and will lead to inefficient memory allocation for non-gated activations. It is recommended to update these allocations to use intermediate_size_factor for correct handling of both gated and non-gated activations.
|
/bot run |
|
[FAILED] Pipeline #46907315: 12/20 passed |
Cherry-picked from upstream flashinfer-ai#2882 (3b0244b). Removes incorrect guard that rejected non-gated activations (Relu2/Nemotron) for FP8 per-tensor, silently forcing fallback to slower tactic.
|
CI was blocked on a known irrelevant nvshm compilation error. restarted CI and waiting for auto-merge |
📌 Description
This PR fixed a silent bug that forces fallback tactic with TRTLLM MoE FP8 and non-gated models (Nemotron).
There is no crash, only a performance bug (fallback tactic will always be selected).
The error raised from the C++ code seems to be hidden by this try-except in function
get_trtllm_moe_sm100_module:https://github.com/flashinfer-ai/flashinfer/blob/main/flashinfer/fused_moe/core.py#L924
Code:
Only by enabling
FLASHINFER_LOGGING_LEVEL=DEBUGthe error appears (logger.debug).This bug does not exist in flashinfer version 0.6.6.
With version 0.6.6
commit
70b142b75b46aa56e7f675a8e6ec1a977352c91fOutput:
With main branch
commit
b8931925fbda0b4a77a79ac4b6577a1da235f605(currently tagged asv0.6.7)Output:
In this case we can see the error I removed:
2026-03-24 12:36:01,582 - DEBUG - core.py:925 - flashinfer.jit: [Autotuner]: Failed to get valid tactics for ... Error occurred: FP8 per-tensor currently supports gated activations only, got act_type=6.But the test does not fail.
With this fix we are back to behavior of 0.6.6 (no
Failed to get valid tactics for).Notes:
All of the above tested using GB200 GPU.
The artifacts path for TRTLLM_GEN_BMM did not change between 0.6.6 and 0.6.7:
b55211623be7f5697c5262ffd8361fc06c147bc9.🔍 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
Summary by CodeRabbit