Skip to content

Commit

Permalink
Bug 1902792 [wpt PR 46770] - webnn: Give an MLBuffer an MLOperandDesc…
Browse files Browse the repository at this point in the history
…riptor, a=testonly

Automatic update from web-platform-tests
webnn: Give an MLBuffer an MLOperandDescriptor

This CL gives MLBufferDescriptor an MLOperandDescriptor as per
webmachinelearning/webnn#542

To represent this descriptor, this CL also creates a new typemapped
OperandDescriptor type which ensures that the buffer descriptor is
valid. OperandDescriptor will be used more pervasively within WebNN
in follow-up CLs

1) Move Operand::DataType to DataType (MERGED)
2) Create a typemapped OperandDescriptor class for MLBuffer <-- this CL
3) Use OperandDescriptor in mojom::Operand
4+) Remove duplicate code (especially with //components)

Fuchsia binary size seems to be unavoidable for now, and I suspect
may be temporary once duplicate code is removed in follow-ups.
bloaty shows a binary size increase primarily in
//t/b/r/m/ml/webnn/ml_graph_type_converter.cc, as well as a handful
of other renderer-side files which depend on the mojom component

Bug: 343638938, 325598628
Fuchsia-Binary-Size: See commit description
Cq-Include-Trybots: luci.chromium.try​:win11-blink-rel
Change-Id: I775340f5c5e0e80942332cbae750d0d305cdd458
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5604163
Reviewed-by: ningxin hu <[email protected]>
Commit-Queue: Austin Sullivan <[email protected]>
Reviewed-by: Alex Gough <[email protected]>
Reviewed-by: Reilly Grant <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1315553}

--

wpt-commits: ed9e9309618bdf76de06ff85757edbc8e1d7da82
wpt-pr: 46770
  • Loading branch information
a-sully authored and moz-wptsync-bot committed Jun 20, 2024
1 parent 5a4695c commit 69d331a
Show file tree
Hide file tree
Showing 2 changed files with 279 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// META: variant=?cpu
// META: variant=?gpu
// META: variant=?npu
// META: script=../resources/utils_validation.js
// META: script=../resources/utils.js
// META: timeout=long

Expand All @@ -11,7 +12,18 @@
// https://webmachinelearning.github.io/webnn/#api-mlbuffer

if (navigator.ml) {
testCreateWebNNBuffer('create', 4);
testCreateWebNNBuffer('create', {dataType: 'float16', dimensions: [2, 3]});
testCreateWebNNBuffer('create', {dataType: 'float32', dimensions: [1, 5]});
testCreateWebNNBuffer('create', {dataType: 'int32', dimensions: [4]});
testCreateWebNNBuffer('create', {dataType: 'uint8', dimensions: [3, 2, 4]});

testCreateWebNNBufferFails(
'createFailsEmptyDimension', {dataType: 'int32', dimensions: [2, 0, 3]});
testCreateWebNNBufferFails('createFailsTooLarge', {
dataType: 'int32',
dimensions: [kMaxUnsignedLong, kMaxUnsignedLong, kMaxUnsignedLong]
});

testDestroyWebNNBuffer('destroyTwice');
testReadWebNNBuffer('read');
testWriteWebNNBuffer('write');
Expand Down
Loading

0 comments on commit 69d331a

Please sign in to comment.