[ROCm] [Bugfix] Fix Triton fused shared expert alignment (#51632)

Signed-off-by: Aakif Nawaz <aakif.nawaz@amd.com>
This commit is contained in:
akii96
2026-08-20 00:14:52 +08:00
committed by GitHub
parent 525b7bbb3a
commit 583a00257d
2 changed files with 50 additions and 2 deletions
@@ -315,13 +315,15 @@ class TritonExperts(LoRAExpertsMixin, mk.FusedMoEExpertsModular):
)
intermediate_cache3 = _resize_cache(workspace2, (num_tokens, top_k_num, K))
# Include fused shared-expert rows while preserving EP remapping.
num_align_experts = w1.shape[0] if expert_map is None else global_num_experts
sorted_token_ids, expert_ids, num_tokens_post_padded = (
_prepare_expert_assignment(
topk_ids,
config,
num_tokens,
top_k_num,
global_num_experts,
num_align_experts,
expert_map,
use_int8_w8a16=self.quant_config.use_int8_w8a16,
use_int4_w4a16=self.quant_config.use_int4_w4a16,
@@ -688,8 +690,10 @@ class TritonWNA16Experts(TritonExperts):
)
intermediate_cache3 = _resize_cache(workspace2, (num_tokens, top_k_num, K))
# Include fused shared-expert rows while preserving EP remapping.
num_align_experts = w1.shape[0] if expert_map is None else global_num_experts
sorted_token_ids, expert_ids, num_tokens_post_padded = moe_align_block_size(
topk_ids, config["BLOCK_SIZE_M"], global_num_experts, expert_map
topk_ids, config["BLOCK_SIZE_M"], num_align_experts, expert_map
)
invoke_fused_moe_wna16_triton_kernel(