[KMCompiler]Fix fused moe vendor gating (metax fast paths) - #682
Open
LittleShun1214 wants to merge 2 commits into
Open
[KMCompiler]Fix fused moe vendor gating (metax fast paths)#682LittleShun1214 wants to merge 2 commits into
LittleShun1214 wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
[ Operator ]
Type of Change
[ Bug Fix ]
Description
Fix and refine the generic fused MoE operator for vendor-specific tuning.
Bug fixes
ops/fused_moe.py: remove the hard-coded metax-only activation switch (use_separate_activation_for_metax_qwen36_large) that was evaluated on every platform and changed the fused-MoE path for non-metax users running Qwen3.6 shapes (E=256, K=2048, M>=8192). The decision now comes from the vendor descriptor (moe_separate_activation), preserving the original path everywhere else._get_max_smem_bytes,_clamp_num_stages_for_vendor,_is_h20) and the H20SWAP_ABheuristic that were dropped from the generic config heuristics; NVIDIA default behavior is unchanged (VendorDescriptor defaults reproduce previous values exactly).New vendor-gated kernel paths (all default-off, other platforms unaffected)
USE_INT32_OFFSETS: int32 token/offset arithmetic when every offset product stays below 2^31 (saves registers); GEMM2 topk-merged rows are normalized back to model-level M before the vendor M threshold applies.FAST_BF16_OUTPUT: bf16 accumulator conversion withrtne_no_nan.VendorDescriptorfields (moe_use_int32_offsets,moe_fast_bf16_output,moe_separate_activation,moe_fast_paths_min_m) with safe defaults (False / 0), consistent with the existing MUSA vendor parameterization (max_smem_bytes,moe_direct_sum_enabled, ...).MetaX backend (
runtime/backend/_metax/)USE_INT32_OFFSETS,FAST_BF16_OUTPUT,SEPARATE_ACTIVATION) in favor of the descriptor fields.Issue
N/A
Progress
Performance
vs upstream vLLM metax baseline on MetaX C550, Qwen3.6 real shapes, bf16 fixed-seed CUDA Graph benchmark, SpeedUp = baseline / FlagGems (334 cases, 3 prefill scenarios x intermediate 128/512 x tokens 1..16384 incl. non-aligned):
ALL: min 0.715, max 1.708. i128 shapes peak at 1.70 (tokens 40-64) and 1.27 (tokens 16384); i512 shapes average ~0.99. Kernel parameters verified identical to the previous config-key implementation (no behavior/perf change, only the parameterization mechanism).