Skip to content

Commit 7ed33ce

Browse files
committed
Update
[ghstack-poisoned]
2 parents 673cbcd + 84aee5e commit 7ed33ce

6 files changed

Lines changed: 14 additions & 12 deletions

File tree

.ci/scripts/setup-webgpu-linux-deps.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# private prebuilt:
1010
# * Dawn : Google's official nightly prebuilt, downloaded directly from
1111
# github.com/google/dawn/releases (pinned tag+rev+sha256) -- the same
12-
# "fetch upstream's published binary" pattern as setup-wgpu-native.sh.
12+
# "fetch a pinned upstream prebuilt" pattern used for other CI deps.
1313
# * SwiftShader : reuse the prebuilt ALREADY on the ossci-android bucket (the one
1414
# setup-vulkan-linux-deps.sh uses). No new S3 uploads anywhere.
1515
# Dawn (Chrome's WebGPU impl; its WGSL compiler Tint is the spec reference) on

backends/webgpu/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ target_link_libraries(webgpu_backend PRIVATE vulkan_schema executorch_core)
5959
find_package(Threads REQUIRED)
6060
find_package(Dawn REQUIRED)
6161
set(WEBGPU_GPU_LIB dawn::webgpu_dawn)
62-
target_link_libraries(webgpu_backend PUBLIC dawn::webgpu_dawn)
62+
target_link_libraries(webgpu_backend PUBLIC ${WEBGPU_GPU_LIB})
6363

6464
if(APPLE)
6565
target_link_libraries(

backends/webgpu/runtime/WebGPUCompat.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@ namespace executorch::backends::webgpu {
2222
// Make progress on pending WebGPU callbacks; callers loop until their done flag
2323
// is set. Native (Dawn): pump the event queue + brief yield (no busy-spin).
2424
// Browser: yield to the JS event loop.
25-
inline void webgpu_poll(WGPUInstance instance, WGPUDevice device) {
25+
inline void webgpu_poll(WGPUInstance instance) {
2626
#if defined(__EMSCRIPTEN__)
2727
(void)instance;
28-
(void)device;
2928
emscripten_sleep(0);
3029
#else
31-
(void)device;
3230
wgpuInstanceProcessEvents(instance);
3331
std::this_thread::sleep_for(std::chrono::microseconds(50));
3432
#endif

backends/webgpu/runtime/WebGPUGraph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ void WebGPUGraph::copy_outputs(std::vector<std::pair<void*, size_t>>& outputs) {
512512

513513
bool all_mapped = false;
514514
while (!all_mapped) {
515-
webgpu_poll(instance_, device_);
515+
webgpu_poll(instance_);
516516
all_mapped = true;
517517
for (size_t i = 0; i < count; i++) {
518518
if (outputs[i].second != 0 && !cb_data[i].done) {

backends/webgpu/test/native/test_dispatch_order.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,15 @@ std::vector<float> read_f32_bin(const std::string& path) {
4747
if (!f) {
4848
return {};
4949
}
50-
const size_t bytes =
51-
static_cast<size_t>(f.tellg()) / sizeof(float) * sizeof(float);
50+
const auto file_size = static_cast<size_t>(f.tellg());
51+
if (file_size % sizeof(float) != 0) {
52+
return {}; // truncated/corrupt golden; caller treats empty as failure
53+
}
5254
f.seekg(0);
53-
std::vector<float> data(bytes / sizeof(float));
55+
std::vector<float> data(file_size / sizeof(float));
5456
f.read(
5557
reinterpret_cast<char*>(data.data()),
56-
static_cast<std::streamsize>(bytes));
58+
static_cast<std::streamsize>(file_size));
5759
return data;
5860
}
5961

backends/webgpu/test/native/test_scratch_buffer.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,10 @@ std::vector<float> readback(
6666
ci.callback = map_cb;
6767
ci.userdata1 = &cb;
6868
wgpuBufferMapAsync(staging, WGPUMapMode_Read, 0, nbytes, ci);
69-
while (!cb.done) {
70-
webgpu_poll(instance, device);
69+
// Bounded poll so a never-delivered callback fails the test instead of
70+
// hanging forever (~5s at 50us/spin).
71+
for (int spins = 0; !cb.done && spins < 100000; ++spins) {
72+
webgpu_poll(instance);
7173
}
7274

7375
std::vector<float> out(nbytes / sizeof(float));

0 commit comments

Comments
 (0)