Skip to content

Update WebGPU - #8955

Open
shoaibkamil wants to merge 48 commits into
mainfrom
shoaibkamil/webgpu_use_promises
Open

Update WebGPU#8955
shoaibkamil wants to merge 48 commits into
mainfrom
shoaibkamil/webgpu_use_promises

Conversation

@shoaibkamil

Copy link
Copy Markdown
Contributor

Update to latest WebGPU, Node, Dawn, and emscripten versions. Use a promise-based API instead of old-style tick-based APIs. This unifies the backend, but requires specific support for timed waits on promises. Dawn is currently the only implementation that has this.

Shoaib Kamil and others added 30 commits December 15, 2025 17:42
- Replace WGPUShaderModuleWGSLDescriptor with WGPUShaderSourceWGSL
- Replace WGPUProgrammableStageDescriptor with WGPUComputeState
- Convert all string fields from const char* to WGPUStringView
- Update callbacks to use *CallbackInfo structures (WGPUBufferMapCallbackInfo, etc)
- Replace WGPU_*_INIT macros with explicit field initialization
- Change wgpuBufferReference to wgpuBufferAddRef
- Update WGPUConstantEntry.key to use WGPUStringView
- Initialize WGPUDeviceDescriptor.defaultQueue and uncapturedErrorCallbackInfo explicitly

Co-authored-by: AI Assistant (Cursor/Claude)
- Update callback signatures to use WGPUStringView and userdata2
- Replace WGPURequiredLimits/WGPUSupportedLimits with WGPULimits
- Fix WGPUStringView field initialization (data/length)
- Update device descriptor to use deviceLostCallbackInfo structure
- Convert wgpuAdapterRequestDevice/wgpuInstanceRequestAdapter to use callback info structures
- Change wgpuAdapterGetLimits return type check to WGPUStatus

Co-authored-by: AI Assistant (Cursor/Claude)
- Define NULL and SIZE_MAX in mini_webgpu.h for freestanding runtime
- Replace explicit field initialization with WGPU_*_INIT macros
- Replace ~(size_t)0 with WGPU_STRLEN for clarity

Co-authored-by: AI Assistant (Cursor/Claude)
Co-authored-by: AI Assistant (Cursor/Claude)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…e_promises

# Conflicts:
#	doc/WebGPU.md
#	src/LLVM_Runtime_Linker.cpp
#	src/runtime/CMakeLists.txt
#	vcpkg-configuration.json
- Add vcpkg overlay port for Dawn that forces SHARED library build
  (required for runtime dlopen loading in JITModule.cpp)
- Add arm64-osx-halide vcpkg triplet with dynamic linkage override
- Update FindHalide_WebGPU.cmake to resolve Dawn via vcpkg CMake config
  with Apple framework dependencies (Metal, IOSurface, etc.)
- Fix 32-bit ARM runtime target to use generic i386 to avoid
  cross-compilation issues
- Move arm64-osx-halide and x64-osx-halide triplets to cmake/vcpkg-triplets/
  (the canonical location per vcpkg-configuration.json); remove the shadowing
  copies from cmake/vcpkg/triplets/
- Fix both triplets to use static linkage for all packages except Dawn, which
  must remain a shared library for dlopen loading; add missing
  VCPKG_CMAKE_SYSTEM_NAME and VCPKG_OSX_ARCHITECTURES to arm64-osx-halide
- Drop the now-redundant cmake/vcpkg/triplets entry from vcpkg-configuration.json
- Fix JITModule.cpp: when HL_WEBGPU_NATIVE_LIB is not set the fallback library
  search was incorrectly skipped (error was still empty, making the guard false);
  change condition to `env_libname.empty() || !error.empty()` so the search runs
  when no env var is provided
- doc/WebGPU.md: update Dawn vcpkg port version, fix triplet description, remove
  duplicate HL_WEBGPU_NATIVE_LIB/HL_WEBGPU_NODE_BINDINGS note

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented May 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.18%. Comparing base (4b635d9) to head (390aa3a).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
src/LLVM_Runtime_Linker.cpp 0.00% 7 Missing ⚠️
src/JITModule.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8955      +/-   ##
==========================================
+ Coverage   70.17%   70.18%   +0.01%     
==========================================
  Files         255      255              
  Lines       78904    78910       +6     
  Branches    18866    18870       +4     
==========================================
+ Hits        55367    55386      +19     
- Misses      17883    17895      +12     
+ Partials     5654     5629      -25     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Shoaib Kamil and others added 6 commits July 10, 2026 15:23
Apply the same WebGPU cleanup pattern used in generator_gpu_only test:
device_free() buffers and halide_device_release() before exit.
WebGPU via Node requires all GPU object references to be released
or the process hangs.

Co-authored-by: OpenCode 1.17.15 [ds4/deepseek-v4-flash]
…alide into shoaibkamil/webgpu_use_promises
…creation errors

Several mullapudi2016 autoscheduler tests aborted with an opaque
"wgpuDeviceCreateComputePipelineAsync failed (3)" error. The async
pipeline-creation callback was discarding the WGPU error message,
hiding the real cause: device creation only raised buffer-size and
workgroup-storage limits, not maxComputeInvocationsPerWorkgroup or
maxComputeWorkgroupSizeX/Y/Z, so it fell back to the default 256
invocations per workgroup even though the adapter supports more.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
alexreinking added a commit that referenced this pull request Jul 24, 2026
Drops Metal and non-SSE4.1 testing from Intel macOS.

WebGPU will be restored as part of PR #8955 because our
backend is broken against the latest Dawn that still builds.
@shoaibkamil

Copy link
Copy Markdown
Contributor Author

I think this is now ready for review, but will not pass CI of course.

@alexreinking

Copy link
Copy Markdown
Member

Unless WebGPU is added to the coverage workflow, we're going to see "0%"

The solution isn't to run all the tests under coverage, it's just to compile_to_assembly them. We really need a compile-only mode for our tests...

@shoaibkamil
shoaibkamil marked this pull request as ready for review July 27, 2026 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants