Handle mm/bmm/matmul: matrix multiplication without bias. All three ops compute matrix products with different dimension expectations: - mm: 2D x 2D - bmm: 3D x 3D (batched) - matmul: arbitrary dimensions (NumPy semantics) MLX's matmul handles all cases, so we emit AddmmNode wi
(P: MLXProgramBuilder, n: Node)
| 864 | ] |
| 865 | ) |
| 866 | def _mm_handler(P: MLXProgramBuilder, n: Node) -> Slot: |
| 867 | """Handle mm/bmm/matmul: matrix multiplication without bias. |
| 868 | |
| 869 | All three ops compute matrix products with different dimension expectations: |
| 870 | - mm: 2D x 2D |
| 871 | - bmm: 3D x 3D (batched) |
| 872 | - matmul: arbitrary dimensions (NumPy semantics) |
| 873 | |
| 874 | MLX's matmul handles all cases, so we emit AddmmNode with bias=None. |
| 875 | """ |
| 876 | args = P.args(n) |
| 877 | require_args(args, 2, 2, "aten.mm/bmm/matmul") |
| 878 | require_kwargs(P.kwargs(n), set(), "aten.mm/bmm/matmul") |
| 879 | mat1, mat2 = args[0], args[1] |
| 880 | |
| 881 | out = P.make_or_get_slot(n) |
| 882 | |
| 883 | P.emit( |
| 884 | AddmmNode( |
| 885 | mat1=P.slot_to_tid(mat1), |
| 886 | mat2=P.slot_to_tid(mat2), |
| 887 | out=P.slot_to_tid(out), |
| 888 | bias=None, |
| 889 | ) |
| 890 | ) |
| 891 | return out |
| 892 | |
| 893 | |
| 894 | @REGISTRY.register( |
nothing calls this directly
no test coverage detected