[ROCm][gpt-oss] Pass GateMode.INTERLEAVE for MXFP4 W4A16 fused MoE (#44893)
Signed-off-by: Rohan Potdar <rohan.potdar@amd.com> Signed-off-by: Rohan138 <rohanpotdar138@gmail.com> Signed-off-by: Rohan Potdar <66227218+Rohan138@users.noreply.github.com>
This commit is contained in:
@@ -351,6 +351,21 @@ def rocm_aiter_fused_experts(
|
||||
intermediate_pad // 64 * 64 * (2 if moe_config.tp_size == 1 else 1)
|
||||
)
|
||||
|
||||
# https://github.com/ROCm/aiter/pull/3123 specialized the AITER stage1 GEMMs
|
||||
# for interleaved vs separated gate and up weights.
|
||||
# For gpt-oss i.e. use_mxfp4_w4a16=True, the weights are shuffled by
|
||||
# `rocm_aiter_ops.shuffle_weight_a16w4` in `oracle/mxfp4.py`,
|
||||
# which always sets `is_guinterleave=True`.
|
||||
# Hence, we pass in GateMode.INTERLEAVE to match the weight shuffling.
|
||||
gate_mode = ""
|
||||
if quant_config.use_mxfp4_w4a16:
|
||||
try:
|
||||
from aiter.ops.flydsl.moe_common import GateMode
|
||||
|
||||
gate_mode = GateMode.INTERLEAVE.value
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
return rocm_aiter_ops.fused_moe(
|
||||
hidden_states,
|
||||
w1,
|
||||
@@ -369,6 +384,7 @@ def rocm_aiter_fused_experts(
|
||||
output_dtype=output_dtype,
|
||||
hidden_pad=hidden_pad,
|
||||
intermediate_pad=intermediate_pad,
|
||||
gate_mode=gate_mode,
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user