[NPU] replace swiglu with custom kernel
This commit is contained in:
@@ -115,6 +115,8 @@ def npu_fused_experts(
|
||||
def npu_fused_moe_without_routing_weights_bf16(
|
||||
layer, hidden_states, group_list_type, group_list, output_dtype
|
||||
):
|
||||
from sgl_kernel_npu.activation.swiglu_quant import swiglu_quant
|
||||
|
||||
# gmm1: gate_up_proj
|
||||
hidden_states = torch.ops.npu.npu_grouped_matmul(
|
||||
x=[hidden_states],
|
||||
@@ -125,7 +127,9 @@ def npu_fused_moe_without_routing_weights_bf16(
|
||||
group_list=group_list,
|
||||
output_dtype=output_dtype,
|
||||
)[0]
|
||||
hidden_states = torch.ops.npu.npu_swiglu(hidden_states)
|
||||
hidden_states, _ = swiglu_quant(
|
||||
hidden_states, group_list, group_list_type, need_quant=False
|
||||
)
|
||||
# gmm2: down_proj
|
||||
hidden_states = torch.ops.npu.npu_grouped_matmul(
|
||||
x=[hidden_states],
|
||||
|
||||
Reference in New Issue
Block a user