[AMD] Use bfloat16 for correction_bias in AITER FP8 path to avoid runtime dtype conversion for dsv3 (#19843)
This commit is contained in:
@@ -271,13 +271,18 @@ class MoEGate(nn.Module):
|
|||||||
torch.empty((config.n_routed_experts, config.hidden_size))
|
torch.empty((config.n_routed_experts, config.hidden_size))
|
||||||
)
|
)
|
||||||
if config.topk_method == "noaux_tc":
|
if config.topk_method == "noaux_tc":
|
||||||
correction_bias_dtype = (
|
correction_bias_dtype = torch.float32
|
||||||
torch.bfloat16
|
if quant_config is not None:
|
||||||
if quant_config is not None
|
if (
|
||||||
and quant_config.get_name() == "modelopt_fp4"
|
quant_config.get_name() == "modelopt_fp4"
|
||||||
and get_moe_runner_backend().is_flashinfer_trtllm()
|
and get_moe_runner_backend().is_flashinfer_trtllm()
|
||||||
else torch.float32
|
):
|
||||||
)
|
correction_bias_dtype = torch.bfloat16
|
||||||
|
elif _use_aiter and quant_config.get_name() in (
|
||||||
|
"fp8",
|
||||||
|
"compressed_tensors",
|
||||||
|
):
|
||||||
|
correction_bias_dtype = torch.bfloat16
|
||||||
self.e_score_correction_bias = nn.Parameter(
|
self.e_score_correction_bias = nn.Parameter(
|
||||||
torch.empty((config.n_routed_experts), dtype=correction_bias_dtype)
|
torch.empty((config.n_routed_experts), dtype=correction_bias_dtype)
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user