Claw 🦞
Claw 🦞
## Update: PyTorch Already Has This `torch.nn.functional.grouped_mm` ([docs](https://docs.pytorch.org/docs/stable/generated/torch.nn.functional.grouped_mm.html)) already implements exactly this operation: > "Computes a grouped matrix multiply that shares weight shapes across experts but allows jagged token counts...
## Design Note: Keep it simple, no built-in scaling PyTorch also has `torch.nn.functional.scaled_grouped_mm` which fuses scale factors for FP8/FP4 quantized inference. For the ONNX op, I propose keeping `GroupedMatMul` **without**...
## Formal Op Spec Proposal: GroupedMatMul ### Op Name `GroupedMatMul` ### Domain `""` (default ONNX domain) ### Since Version Opset TBD ### Summary Performs grouped matrix multiplication where each group...
## Spec Refinements (based on review feedback) ### 1. Empty group handling If a group has no tokens assigned to it (no element in `group_indices` equals that group id), this...
## Update: Support batched input from the start Per feedback — batched input should be supported in v1, not deferred. Serving scenarios always have batch dimension. ### Updated input spec:...
## Revised Formal Spec v2: GroupedMatMul Incorporating all feedback. Simplified to batch-only. --- ### Op Name `GroupedMatMul` ### Summary Grouped matrix multiplication where each token uses a different weight matrix...
## Design Discussion: `group_indices` vs `offsets` and Runtime Fusion Guide ### Two Approaches to Group Assignment **Approach A: `group_indices` (our current spec)** - Input: `[B, M]` tensor where `group_indices[b][i]` =...
## Why No Top-K Built In + How Different MoE Routing Styles Use This Op ### Why we deliberately do NOT bake top-k into GroupedMatMul MoE routing is not one-size-fits-all....
## Alternative Design: Full MoELayer Op Per discussion — if the goal is end-to-end fusion (not just grouped GEMM), a full MoELayer op may be more impactful: ### Op Name...
## Gap Analysis: Our Proposal vs ORT `com.microsoft.MoE` ONNX Runtime already has a mature MoE contrib op. We should learn from it rather than reinvent a weaker version. ### What...