[ROCm][Perf] Expose AITER MoE sorting dispatch policy via env var (#39177)

Signed-off-by: nholmber <nholmber@users.noreply.github.com>
This commit is contained in:
Nico Holmberg
2026-05-27 13:11:02 +08:00
committed by GitHub
parent 1fc2cee50a
commit 7b54690244
3 changed files with 32 additions and 0 deletions
@@ -246,6 +246,7 @@ def rocm_aiter_fused_experts(
a1q_scale: torch.Tensor | None = None,
num_local_tokens: torch.Tensor | None = None,
output_dtype: torch.dtype | None = None,
moe_sorting_dispatch_policy: int = 0,
) -> torch.Tensor:
"""ROCm AITER fused MoE expert computation."""
if quant_config is None:
@@ -361,6 +362,7 @@ def rocm_aiter_fused_experts(
intermediate_pad=intermediate_pad // 64 * 64 * 2,
bias1=quant_config.w1_bias if quant_config.use_mxfp4_w4a16 else None,
bias2=quant_config.w2_bias if quant_config.use_mxfp4_w4a16 else None,
moe_sorting_dispatch_policy=moe_sorting_dispatch_policy,
)
@@ -504,6 +506,7 @@ class AiterExperts(mk.FusedMoEExpertsModular):
a1q_scale=a1q_scale,
num_local_tokens=num_local_tokens,
output_dtype=output.dtype,
moe_sorting_dispatch_policy=rocm_aiter_ops.get_moe_dispatch_policy(),
)
# avoid redundant copy when output is a view of the result
if (