[feat] Add SITU trtllmgen MOE - #4180
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughFP4 block-scale MoE now supports SiTU activation with validated GEMM1 parameters, updated activation mappings, dtype-aware tile selection, trace propagation, artifact metadata updates, and regression tests. ChangesFP4 SiTU MoE support
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant FP4MoEEntryPoint
participant TraceOrReference
participant FP4Kernel
participant Autotuner
Caller->>FP4MoEEntryPoint: select activation_type=Situ
FP4MoEEntryPoint->>FP4MoEEntryPoint: validate GEMM1 parameters
FP4MoEEntryPoint->>TraceOrReference: provide activation parameters
TraceOrReference->>FP4Kernel: compute or launch SiTU activation
Autotuner->>FP4Kernel: query dtype-aware tile configurations
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
80e911e to
92ead86
Compare
92ead86 to
5b2cef5
Compare
|
/bot run tests/moe |
Signed-off-by: Siyuan Fu <siyuanf@nvidia.com>
|
/bot run tests/moe |
|
/bot run tests/moe |
…ion (#4252) <!-- .github/pull_request_template.md --> Add SiTU activation support for TRTLLM-Gen MoE for MXFP4 × MXFP8 and NVFP4 × NVFP4 <!-- Link any related issues here --> Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete. - [x] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [x] I have installed the hooks with `pre-commit install`. - [x] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). - [x] Tests have been added or updated as needed. - [x] All tests are passing (`unittest`, etc.). <!-- Optional: anything you'd like reviewers to focus on, concerns, etc. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> * **New Features** * Added SiTU gated activation support for FP4 MoE in routed and non-routed execution, with configurable per-expert `gemm1_alpha`, `gemm1_beta`, and `gemm1_clamp_limit`. * Extended FP4 MoE trace templates with an `activation_type` input to select SiTU. * **Bug Fixes** * Improved activation-type mapping/validation so SiTU uses the correct gated behavior. * Made MoE kernel/tile selection dtype-aware (activation + weight) and corrected per-token scaling eligibility during config generation. * **Tests** * Expanded MoE coverage for SiTU and optional per-expert parameters, including additional routed-logit and autotune regression checks. * **Chores** * Updated the remote BMM artifact reference and checksum. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- (cherry picked from commit a34a735) <!-- .github/pull_request_template.md --> ## 📌 Description <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 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 - [ ] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [ ] I have installed the hooks with `pre-commit install`. - [ ] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## 🧪 Tests - [ ] Tests have been added or updated as needed. - [ ] All tests are passing (`unittest`, etc.). ## Reviewer Notes <!-- Optional: anything you'd like reviewers to focus on, concerns, etc. --> --------- Signed-off-by: Siyuan Fu <siyuanf@nvidia.com> Co-authored-by: Jiahan Chang (Cyrus) <173873397+jiahanc@users.noreply.github.com> Co-authored-by: Siyuan Fu <siyuanf@nvidia.com> Co-authored-by: Vinnie6167 <Vinnie6167@users.noreply.github.com>
…4460) <!-- .github/pull_request_template.md --> ## 📌 Description Adds SiTU-GLU activation support to the CUTLASS fused-MoE backend, covering all SM variants (SM89/90/100/103/120) via the shared activation kernel code. - Adds `ActivationType::Situ = 10` enum value (consistent with the TRT-LLM Gen path in #4180) - Implements `SituAdaptor` with `beta` (default 4.0) and `linear_beta` (default 25.0) per the SiTU paper (Kimi-K3) - Uses `2·sigmoid(2z)−1` for tanh (matching the CuTe-DSL path in #4009) — avoids `tanh.approx.f32` error amplification at `linear_beta=25` - Supports per-expert `situ_beta` / `situ_linear_beta` tensors - Refactors per-expert activation param dispatch into `setPerExpertActivationParams()` / `hasPerExpertActivationParams()` helpers (reduces duplication across `doGatedActivationKernel` and `doActivationKernel`) - Tests both default and per-expert parameters in BF16 and FP8 ## 🚀 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 - [x] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [x] I have installed the hooks with `pre-commit install`. - [x] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## 🧪 Tests - [x] Tests have been added or updated as needed. - [x] `pytest tests/moe/test_trtllm_cutlass_fused_moe.py` — SiTU cases in both `test_moe` (BF16) and `test_moe_fp8` ## Reviewer Notes <!-- Optional: anything you'd like reviewers to focus on, concerns, etc. --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added SiTU-GLU activation support for fused Mixture-of-Experts operations. - Added optional global or per-expert SiTU scaling parameters. - Added support across standard, low-latency, and FP8 MoE execution paths. - Added default SiTU scaling values when custom parameters are not provided. - Added validation for per-expert scaling inputs. - **Tests** - Added coverage for default and per-expert SiTU scales, including FP8 execution. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Mickael Seznec <mickael@mistral.ai> Co-authored-by: Claude <noreply@anthropic.com>
📌 Description
Add SiTU activation support for TRTLLM-Gen MoE for MXFP4 × MXFP8 and NVFP4 × NVFP4
🔍 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
gemm1_alpha,gemm1_beta, andgemm1_clamp_limit.activation_typeinput to select SiTU.