[Kernel] Add gpt-oss Router GEMM kernel (#37205)

Signed-off-by: Xin Yang <xyangx@amazon.com>
This commit is contained in:
Xin Yang
2026-03-18 08:15:56 -07:00
committed by GitHub
parent 17808394bc
commit b1169d7be8
13 changed files with 875 additions and 13 deletions
+13
View File
@@ -2362,6 +2362,19 @@ def dsv3_router_gemm(
return output
def gpt_oss_router_gemm(
hidden_states: torch.Tensor, weight: torch.Tensor, bias: torch.Tensor
) -> torch.Tensor:
output = torch.empty(
hidden_states.shape[0],
weight.shape[0],
device=hidden_states.device,
dtype=hidden_states.dtype,
)
torch.ops._moe_C.gpt_oss_router_gemm(output, hidden_states, weight, bias)
return output
def topk_softmax(
topk_weights: torch.Tensor,
topk_ids: torch.Tensor,