Skip to content

Commit 17ce7c1

Browse files
shiyi9801moz-wptsync-bot
authored andcommitted
Bug 1923968 [wpt PR 48568] - webnn: utilize constant nodes in DirectML backend, a=testonly
Automatic update from web-platform-tests webnn: utilize constant nodes in DirectML backend This CL utilizes `DML_GRAPH_NODE_TYPE_CONSTANT` introduced in `DML_FEATURE_LEVEL_6_2` for constant scalar inputs, which allows CPU memory to be directly consumed during graph compilation. Change-Id: I468e600e0b1dae59a0ab017ef7fe86b5e0e00c59 Bug: 366284850 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/+/5859935 Reviewed-by: Rafael Cintron <[email protected]> Commit-Queue: Shiyi Zou <[email protected]> Reviewed-by: ningxin hu <[email protected]> Auto-Submit: Shiyi Zou <[email protected]> Cr-Commit-Position: refs/heads/main@{#1367255} -- wpt-commits: 8903062b181d2fdf406e7b74083f13af59012c15 wpt-pr: 48568
1 parent 7bbe3c9 commit 17ce7c1

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

testing/web-platform/tests/webnn/conformance_tests/subgraph.https.any.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2464,6 +2464,65 @@ const subgraphTests = [
24642464
}
24652465
}
24662466
},
2467+
{
2468+
'name': 'add + sub + mul + gather default',
2469+
'graph': {
2470+
'inputs': {
2471+
'addA': {
2472+
'data': [10],
2473+
'descriptor': {shape: [], dataType: 'int32'},
2474+
'constant': true
2475+
},
2476+
'addB': {
2477+
'data': [20],
2478+
'descriptor': {shape: [], dataType: 'int32'},
2479+
'constant': true
2480+
},
2481+
'subB': {
2482+
'data': [40],
2483+
'descriptor': {shape: [], dataType: 'int32'},
2484+
},
2485+
'divA': {
2486+
'data': [-20],
2487+
'descriptor': {shape: [], dataType: 'int32'},
2488+
'constant': true
2489+
},
2490+
'gatherInput': {
2491+
'data': [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2],
2492+
'descriptor': {shape: [3, 4], dataType: 'float32'},
2493+
'constant': true
2494+
},
2495+
},
2496+
'operators': [
2497+
{
2498+
'name': 'add',
2499+
'arguments': [{'a': 'addA'}, {'b': 'addB'}],
2500+
'outputs': 'addOutput'
2501+
},
2502+
{
2503+
'name': 'sub',
2504+
'arguments': [{'a': 'addOutput'}, {'b': 'subB'}],
2505+
'outputs': 'subOutput'
2506+
},
2507+
{
2508+
'name': 'div',
2509+
'arguments': [{'a': 'divA'}, {'b': 'subOutput'}],
2510+
'outputs': 'divOutput'
2511+
},
2512+
{
2513+
'name': 'gather',
2514+
'arguments': [{'input': 'gatherInput'}, {'indices': 'divOutput'}],
2515+
'outputs': 'output'
2516+
},
2517+
],
2518+
'expectedOutputs': {
2519+
'output': {
2520+
'data': [0.9, 1.0, 1.1, 1.2],
2521+
'descriptor': {shape: [4], dataType: 'float32'}
2522+
}
2523+
}
2524+
}
2525+
},
24672526
];
24682527

24692528
if (navigator.ml) {

0 commit comments

Comments
 (0)