Skip to content

Commit 96203e6

Browse files
committed
Bug 1927492 [wpt PR 48841] - [WebNN] Fix DCHECK(!isShared()) failure of reading MLTensor, a=testonly
Automatic update from web-platform-tests [WebNN] Fix `DCHECK(!isShared())` failure of reading MLTensor There is a `DCHECK(!isShared())` failure when trying to read MLTensor to a shared array buffer. This CL uses `ByteSpanMaybeShared()` instead of `ByteSpan()` for both `DOMArrayBufferBase` and `DOMArrayBufferView` to read MLTensor on blink side to fix this issue, and also expands the existing tests to verify this fix. Bug: 373168867 Change-Id: Id5f68bd0479d9d870550a2b091ef8affdb690c83 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/+/5936137 Reviewed-by: ningxin hu <ningxin.huintel.com> Commit-Queue: Mingming1 Xu <mingming1.xuintel.com> Reviewed-by: Reilly Grant <reillygchromium.org> Cr-Commit-Position: refs/heads/main{#1375715} -- wpt-commits: 025e64cfa6749e6277675d491a77c28be2660da8 wpt-pr: 48841 UltraBlame original commit: d9a7e6de3a17e6110a0b3342a7d17f079b6e2997
1 parent 121f867 commit 96203e6

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@ promise_test(async () => {
9494
assert_array_equals(new Uint32Array(arrayBuffer), testContents);
9595
}, `readTensor() with an ArrayBuffer`);
9696

97+
promise_test(async () => {
98+
const sharedArrayBuffer = new SharedArrayBuffer(testContents.byteLength);
99+
100+
await mlContext.readTensor(mlTensor, sharedArrayBuffer);
101+
102+
assert_array_equals(new Uint32Array(sharedArrayBuffer), testContents);
103+
}, `readTensor() with a SharedArrayBuffer`);
104+
105+
promise_test(async () => {
106+
const sharedArrayBuffer = new SharedArrayBuffer(testContents.byteLength);
107+
const typedArray = new Uint32Array(sharedArrayBuffer);
108+
109+
await mlContext.readTensor(mlTensor, typedArray);
110+
111+
assert_array_equals(typedArray, testContents);
112+
}, `readTensor() with a typeArray from a SharedArrayBuffer`);
113+
97114
promise_test(async () => {
98115

99116

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Cross-Origin-Embedder-Policy: require-corp
2+
Cross-Origin-Opener-Policy: same-origin

0 commit comments

Comments
 (0)