MCPcopy Create free account
hub / github.com/pytorch/executorch / _mm_handler

Function _mm_handler

backends/mlx/ops.py:866–891  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

864 ]
865)
866def _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(

Callers

nothing calls this directly

Calls 7

require_argsFunction · 0.85
require_kwargsFunction · 0.85
argsMethod · 0.80
kwargsMethod · 0.80
emitMethod · 0.80
slot_to_tidMethod · 0.80
make_or_get_slotMethod · 0.45

Tested by

no test coverage detected