3333 from flashinfer import (mxfp8_quantize , shuffle_matrix_a ,
3434 shuffle_matrix_sf_a , trtllm_fp4_block_scale_moe )
3535
36- if current_platform .is_rocm ():
36+ if current_platform .is_rocm () and envs . VLLM_ROCM_USE_AITER_FUSED_MOE_A16W4 :
3737 import aiter
3838 from aiter .fused_moe import fused_topk , moe_sorting
3939 from aiter .ops .shuffle import shuffle_mxfp4_weight , shuffle_mxfp4_scale
@@ -374,7 +374,7 @@ def swap_every_two_rows(x, axis=-1):
374374 else :
375375 num_warps = 8
376376
377- if current_platform .is_rocm ():
377+ if current_platform .is_rocm () and envs . VLLM_ROCM_USE_AITER_FUSED_MOE_A16W4 :
378378 w13_aiter_weight = layer .w13_weight .contiguous ()
379379 w13_aiter_scale = layer .w13_weight_scale .contiguous ()
380380 w2_aiter_weight = layer .w2_weight .contiguous ()
@@ -542,7 +542,7 @@ def apply(
542542 )[0 ]
543543 return trtllm_gen_output
544544 else :
545- if current_platform .is_rocm ():
545+ if current_platform .is_rocm () and envs . VLLM_ROCM_USE_AITER_FUSED_MOE_A16W4 :
546546 token_num = x .shape [0 ]
547547 BLOCKM = 16 if token_num < 2048 else 32
548548 topk_weights , topk_ids = fused_topk (x , router_logits , top_k , True )
@@ -566,8 +566,8 @@ def apply(
566566 sorted_expert_ids ,
567567 num_valid_ids ,
568568 top_k ,
569- 0 , # n_pad_zeros
570- 0 , # k_pad_zeros
569+ 192 , # n_pad_zeros
570+ 128 , # k_pad_zeros
571571 None , # sorted_weights
572572 None ,
573573 self .w13_scale_aiter_tensor ,
@@ -582,8 +582,8 @@ def apply(
582582 sorted_expert_ids ,
583583 num_valid_ids ,
584584 top_k ,
585- 0 , # n_pad_zeros
586- 0 , # k_pad_zeros
585+ 192 , # n_pad_zeros
586+ 128 , # k_pad_zeros
587587 sorted_weights , # sorted_weights
588588 None ,
589589 self .w2_scale_aiter_tensor ,
0 commit comments