Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
_is_cuda = is_cuda()

if _is_cuda:
from sgl_kernel import silu_and_mul
from sgl_kernel import moe_sum_reduce, silu_and_mul


def get_scalar_type(num_bits: int, has_zp: bool):
Expand Down Expand Up @@ -204,9 +204,15 @@ def fused_marlin_moe(
).view(-1, topk, K)

output = hidden_states if inplace else torch.empty_like(hidden_states)
torch.sum(intermediate_cache3.view(*intermediate_cache3.shape), dim=1, out=output)
if routed_scaling_factor is not None:
output *= routed_scaling_factor

if routed_scaling_factor is None:
routed_scaling_factor = 1.0

moe_sum_reduce(
intermediate_cache3,
output,
routed_scaling_factor,
)
return output


Expand Down
Loading