[Perf] Restore the 16-token router GEMM threshold on SM10X (#34953)
Co-authored-by: Mohammad Angkad <mohammad.angkad@radixark.ai>
This commit is contained in:
co-authored by
Mohammad Angkad
parent
ee1f2e8dfd
commit
1beb805356
@@ -525,11 +525,9 @@ class MoEGate(nn.Module):
|
|||||||
return linear_bf16_fp32(hidden_states, self.weight)
|
return linear_bf16_fp32(hidden_states, self.weight)
|
||||||
return F.linear(hidden_states, self.weight, None)
|
return F.linear(hidden_states, self.weight, None)
|
||||||
else:
|
else:
|
||||||
# NOTE(b8zhong): this threshold has been empirically verified
|
|
||||||
max_router_gemm_tokens = 4 if _device_sm in (100, 103) else 16
|
|
||||||
if (
|
if (
|
||||||
_is_cuda
|
_is_cuda
|
||||||
and hidden_states.shape[0] <= max_router_gemm_tokens
|
and hidden_states.shape[0] <= 16
|
||||||
and hidden_states.shape[1] % 1024 == 0
|
and hidden_states.shape[1] % 1024 == 0
|
||||||
and (self.weight.shape[0] == 256 or self.weight.shape[0] == 384)
|
and (self.weight.shape[0] == 256 or self.weight.shape[0] == 384)
|
||||||
and _device_sm >= 90
|
and _device_sm >= 90
|
||||||
|
|||||||
Reference in New Issue
Block a user