Skip to content

Commit

Permalink
Reland "WebNN: Flatten adjacent dimensions for GEMM > 4D for DirectML"
Browse files Browse the repository at this point in the history
This is a reland of commit 0dfa0868aa787cf6d8a32fca83e37ea422b1d0b4

This CL updates the WPT expected results in
`matmul.https.any_gpu-expected.txt` on win11-arm64-rel-tests.

Original change's description:
> WebNN: Flatten adjacent dimensions for GEMM > 4D for DirectML
>
> This CL flattens adjacent dimensions for GEMM > 4D because
> DML_GEMM_OPERATOR_DESC[1] restricts tensor's rank <= 4.
>
> [1] https://learn.microsoft.com/en-us/windows/win32/api/directml/ns-directml-dml_gemm_operator_desc
>
> Bug: 353856233
> Change-Id: Ifbced3d3081594ec6fdefc3a2d381ba675aba7cf
> Cq-Include-Trybots: luci.chromium.try:win11-blink-rel
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5810975
> Reviewed-by: ningxin hu <ningxin.hu@intel.com>
> Commit-Queue: Mingming1 Xu <mingming1.xu@intel.com>
> Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
> Cr-Commit-Position: refs/heads/main@{#1354311}

Bug: 353856233
Change-Id: Ia2ae737316d2a328275bdc6063b86b9b0888b51f
Cq-Include-Trybots: luci.chromium.try:win11-blink-rel, mac14.arm64-blink-rel, mac14-blink-rel, mac15.arm64-blink-rel, mac15-blink-rel, linux-blink-rel
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5858369
Reviewed-by: Rafael Cintron <rafael.cintron@microsoft.com>
Reviewed-by: ningxin hu <ningxin.hu@intel.com>
Commit-Queue: Mingming1 Xu <mingming1.xu@intel.com>
Cr-Commit-Position: refs/heads/main@{#1355556}
  • Loading branch information
mingmingtasd authored and chromium-wpt-export-bot committed Sep 14, 2024
1 parent be5d397 commit 6f8ccf3
Showing 1 changed file with 82 additions and 1 deletion.
83 changes: 82 additions & 1 deletion webnn/conformance_tests/matmul.https.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,8 @@ const matmulTests = [
}
},
{
'name': 'matmul float32 5D and 5D tensors',
'name':
'matmul float32 5D and 5D tensors, broadcast the two leftmost dimensions of inputB',
'graph': {
'inputs': {
'inputA': {
Expand Down Expand Up @@ -496,6 +497,86 @@ const matmulTests = [
}
}
},
{
'name':
'matmul float32 5D and 5D tensors, broadcast the leftmost dimensions of inputB',
'graph': {
'inputs': {
'inputA': {
'data': [
33.75957107543945, 97.24552917480469, 83.7085189819336,
64.53984069824219, 29.57938003540039, 17.19923973083496,
67.94749450683594, 97.45838165283203, 54.449283599853516,
29.552200317382812, 51.99970245361328, 36.03101348876953,
9.701058387756348, 27.04842185974121, 6.020919322967529,
22.940902709960938, 53.1243896484375, 15.292234420776367,
48.21302795410156, 87.40799713134766, 51.34442138671875,
21.1557559967041, 27.589487075805664, 58.412384033203125,
5.963276386260986, 84.74938201904297, 55.45738220214844,
50.858699798583984, 23.763574600219727, 62.330928802490234,
35.774959564208984, 17.340242385864258, 29.16901397705078,
23.191360473632812, 27.060928344726562, 1.2828527688980103,
8.720425605773926, 48.45281219482422, 99.0130386352539,
65.86412048339844, 92.69683074951172, 85.43540954589844,
37.49127960205078, 51.397132873535156, 53.19015121459961,
38.33119201660156, 75.20586395263672, 3.8537938594818115
],
'descriptor': {'dimensions': [2, 2, 1, 3, 4], 'dataType': 'float32'}
},
'inputB': {
'data': [
88.1700439453125, 78.4012680053711, 14.819003105163574,
3.6923038959503174, 45.906429290771484, 43.083919525146484,
47.199466705322266, 60.92521667480469, 8.162760734558105,
20.333263397216797, 20.438398361206055, 27.0194091796875,
15.601424217224121, 87.46969604492188, 65.79554748535156,
69.31697082519531, 31.984439849853516, 12.291812896728516,
13.304834365844727, 85.26705169677734, 88.1700439453125,
78.4012680053711, 14.819003105163574, 3.6923038959503174,
45.906429290771484, 43.083919525146484, 47.199466705322266,
60.92521667480469, 8.162760734558105, 20.333263397216797,
20.438398361206055, 27.0194091796875, 15.601424217224121,
87.46969604492188, 65.79554748535156, 69.31697082519531,
31.984439849853516, 12.291812896728516, 13.304834365844727,
85.26705169677734
],
'descriptor': {'dimensions': [1, 2, 1, 4, 5], 'dataType': 'float32'}
}
},
'operators': [{
'name': 'matmul',
'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
'outputs': 'output'
}],
'expectedOutputs': {
'output': {
'data': [
13350.8759765625, 11562.755859375, 8524.271484375,
9099.0927734375, 14537.8701171875, 11493.283203125,
8083.90869140625, 3744.22216796875, 7489.62353515625,
14488.2314453125, 9634.3720703125, 8221.173828125,
3861.51416015625, 5470.0556640625, 9594.072265625,
3733.946533203125, 2933.679931640625, 2167.611083984375,
1088.48193359375, 3347.576416015625, 12387.083984375,
8985.1884765625, 3545.52783203125, 5701.10595703125,
13374.9169921875, 10051.3671875, 7637.7470703125,
3198.221435546875, 3552.6796875, 9583.1220703125,
8835.94921875, 7592.7666015625, 6742.10400390625,
6241.31396484375, 9982.404296875, 6713.85205078125,
6326.3173828125, 4920.9609375, 3956.46875,
6190.67626953125, 4213.013671875, 4153.708984375,
2283.152099609375, 2681.085693359375, 3700.47509765625,
9445.5869140625, 7752.5400390625, 5435.56005859375,
9964.6591796875, 13516.18359375, 16182.931640625,
13956.9560546875, 7795.52685546875, 5002.8349609375,
12841.802734375, 8145.45654296875, 8134.66650390625,
4344.25, 7138.79052734375, 8497.98046875
],
'descriptor': {'dimensions': [2, 2, 1, 3, 5], 'dataType': 'float32'}
}
}
}
},
{
'name': 'matmul float32 5D and 2D tensors',
'graph': {
Expand Down

0 comments on commit 6f8ccf3

Please sign in to comment.