com.microsoft.FusedMatMul
com.microsoft · ONNX Runtime contrib operator · contrib since_version 1
Description
Matrix product of two N-dimensional tensors A and B, following NumPy-style matrix-multiplication broadcasting. Supports optional transposition of either operand's last two dimensions, optional batch-dimension transposition, and a scalar alpha multiplier. Float32 and float16 are supported; double and bfloat16 are not.
See the ONNX Runtime FusedMatMul contrib-operator spec for the reference semantics.
Inputs
| Name | Bind key | Logical dtype | Rank | Shape | Description | Presence |
|---|---|---|---|---|---|---|
A |
A |
T |
— | — | N-dimensional matrix A. | required |
B |
B |
T |
— | — | N-dimensional matrix B. | required |
Outputs
| Name | Bind key | Logical dtype | Rank | Shape | Description | Presence |
|---|---|---|---|---|---|---|
Y |
Y |
T |
derived | derived; see description | Matrix-multiplication result whose shape follows NumPy-style rules after applying the requested batch and matrix transpositions. | required |
Attributes
Default values (overridable per request):
| Attribute | Default | Description |
|---|---|---|
alpha |
1 |
Scalar multiplier applied to the product of the input tensors. |
transA |
0 |
When non-zero, transposes A on its last two dimensions before multiplication. |
transB |
0 |
When non-zero, transposes B on its last two dimensions before multiplication. |
transBatchA |
0 |
When non-zero, transposes A on its first dimension and batch dimensions (dim-1 to dim-rank-2) before multiplication. |
transBatchB |
0 |
When non-zero, transposes B on its first dimension and batch dimensions (dim-1 to dim-rank-2) before multiplication. |
Type constraints
| Variable | Allowed dtypes |
|---|---|
T |
float32, float16 |
Device requirements
Some implementation variants require subgroup-matrix and subgroups. These are route-specific capabilities, not package-wide requirements; availability also depends on the request shape and dtype.
Files
metadata.json— kernel metadata (id, digests, provenance)manifest.json— the op contract (source of truth)test.json— correctness casesbench.json— benchmark + tuning casesfused-matmul-subgroup-matrix.wgsl.jinjamatmul-subgroup-matrix-ext.wgsl.jinjamatmul-tiled-general-reg.wgsl.jinjamatmul-tiled-general.wgsl.jinjamatmul-vector-matrix-vec4.wgsl.jinjareduce-axis0-splitk-combine.wgsl.jinja
Use with @huggingface/kernels
The loader derives every required output's shape and logical dtype from the manifest contract and this call. It then allocates the result tensors automatically.
The version: 1 option selects the published kernel contract; it is independent of any operator opset, contrib since_version, or model version.
Replace each *Data placeholder with a typed array containing the corresponding input data.
import { getKernel } from "@huggingface/kernels";
const kernel = await getKernel("webgpu-kernels/com.microsoft.FusedMatMul", { version: 1 });
const { Y } = await kernel({ A: { data: AData, shape: [3] }, B: { data: BData, shape: [3] } });
- Downloads last month
- -
Requires WebGPU support. See the compatibility table.