Skip to content

Commit 2128fae

Browse files
WebNN: Reject batched MatMul with large K dimension size on OV NPU
The OpenVINO NPU EP will take a very long time to compile models with batched MatMul operations whose K dimension size is too large. This CL rejects such MatMul operations to prevent WebNN from becoming unresponsive. Bug: 467442135 Cq-Include-Trybots: luci.chromium.try:win11-blink-rel Change-Id: I35797f771829a2ff2908a61242a6b287e264893a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7245170 Reviewed-by: Hu, Ningxin <ningxin.hu@intel.com> Commit-Queue: Hu, Ningxin <ningxin.hu@intel.com> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/main@{#1566584}
1 parent 2a9061a commit 2128fae

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

webnn/conformance_tests/matmul.https.any.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,60 @@ const matmulTests = [
10811081
}
10821082
}
10831083
}
1084+
},
1085+
{
1086+
'name': 'matmul float32 2D tensors with K dimension size > 8192',
1087+
'graph': {
1088+
'inputs': {
1089+
'inputA': {
1090+
'data': new Array(2 * 8193).fill(1.0),
1091+
'descriptor': {shape: [2, 8193], dataType: 'float32'}
1092+
},
1093+
'inputB': {
1094+
'data': new Array(8193 * 2).fill(1.0),
1095+
'descriptor': {shape: [8193, 2], dataType: 'float32'}
1096+
}
1097+
},
1098+
'operators': [{
1099+
'name': 'matmul',
1100+
'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
1101+
'outputs': 'output'
1102+
}],
1103+
'expectedOutputs': {
1104+
'output': {
1105+
'data': [8193.0, 8193.0, 8193.0, 8193.0],
1106+
'descriptor': {shape: [2, 2], dataType: 'float32'}
1107+
}
1108+
}
1109+
}
1110+
},
1111+
{
1112+
'name': 'matmul float32 3D tensors with K dimension size > 8192',
1113+
'graph': {
1114+
'inputs': {
1115+
'inputA': {
1116+
'data': new Array(2 * 2 * 8193).fill(1.0),
1117+
'descriptor': {shape: [2, 2, 8193], dataType: 'float32'}
1118+
},
1119+
'inputB': {
1120+
'data': new Array(2 * 8193 * 2).fill(1.0),
1121+
'descriptor': {shape: [2, 8193, 2], dataType: 'float32'}
1122+
}
1123+
},
1124+
'operators': [{
1125+
'name': 'matmul',
1126+
'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
1127+
'outputs': 'output'
1128+
}],
1129+
'expectedOutputs': {
1130+
'output': {
1131+
'data': [
1132+
8193.0, 8193.0, 8193.0, 8193.0, 8193.0, 8193.0, 8193.0, 8193.0
1133+
],
1134+
'descriptor': {shape: [2, 2, 2], dataType: 'float32'}
1135+
}
1136+
}
1137+
}
10841138
}
10851139
];
10861140

0 commit comments

Comments
 (0)