Skip to content

Commit 11bcce3

Browse files
authored
[webgpu] Bump version of Dawn to c3999d7e3 (microsoft#24935)
1 parent f250ffc commit 11bcce3

File tree

5 files changed

+29
-91
lines changed

5 files changed

+29
-91
lines changed

cmake/deps.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ extensions;https://github.com/microsoft/onnxruntime-extensions/archive/c24b7bab0
5959
composable_kernel;https://github.com/ROCmSoftwarePlatform/composable_kernel/archive/204da9c522cebec5220bba52cd3542ebcaf99e7a.zip;1827348efd47831c13074245274d41b7cae8a557
6060
directx_headers;https://github.com/microsoft/DirectX-Headers/archive/refs/tags/v1.613.1.zip;47653509a3371eabb156360f42faf582f314bf2e
6161
cudnn_frontend;https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v1.7.0.zip;d0753d8d5b39947ca0729d7773cb84653a129eb1
62-
dawn;https://github.com/google/dawn/archive/4cb1f9be152a4fa6bb695c08cd707ab078a1e2fb.zip;de39336b7715f53c14eec61072293b85cc73b691
62+
dawn;https://github.com/google/dawn/archive/c3999d7e32b1accce2ce2f2431db487541a4f15e.zip;08e145215cbb47cb2383a1e2fed047f7ab69cec4
6363
kleidiai;https://github.com/ARM-software/kleidiai/archive/refs/tags/v1.4.0.tar.gz;22d3b57b54a61c194ab256ff11b0353a3b220244

cmake/external/onnxruntime_external_deps.cmake

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -723,36 +723,21 @@ if (onnxruntime_USE_WEBGPU)
723723
)
724724
else()
725725
set(ONNXRUNTIME_Dawn_PATCH_COMMAND
726-
# The dawn.patch contains the following changes:
726+
# The dawn_destroy_buffer_on_destructor.patch contains the following changes:
727727
#
728728
# - (private) Allow WGPUBufferImpl class to destroy the buffer in the destructor
729729
# In native implementation, wgpuBufferRelease will trigger the buffer destroy (if refcount decreased to 0). But
730730
# in emwgpu implementation, the buffer destroy won't happen. This change adds a destructor to the buffer class
731731
# to destroy the buffer when the refcount is 0 for non-external buffers.
732732
#
733-
# - (private) Remove hard-coded CMAKE_OSX_DEPLOYMENT_TARGET in Dawn's CMake files
734-
# https://github.com/microsoft/onnxruntime/pull/23729
735-
#
736-
# - (private) Reduce unsafe buffer usage warning in aligned_storage.h
737-
# https://github.com/microsoft/onnxruntime/pull/24308
738-
# The patch disables the UNSAFE_BUFFER_USAGE warning around the AlignedStorage struct in aligned_storage.h. This is done
739-
# by using TINT_BEGIN_DISABLE_WARNING and TINT_END_DISABLE_WARNING macros, which helps in warnings related to unsafe buffer usage
740-
# usage when compiling the code, making the build process cleaner and faster.
741-
#
742-
${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/dawn/dawn.patch &&
733+
${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/dawn/dawn_destroy_buffer_on_destructor.patch &&
743734

744735
# The dawn_force_enable_f16_nvidia_vulkan.patch contains the following changes:
745736
#
746737
# - (private) Force enable f16 support for NVIDIA Vulkan
747738
# Dawn disabled f16 support for NVIDIA Vulkan by default because of crashes in f16 CTS tests (crbug.com/tint/2164).
748739
# Since the crashes are limited to specific GPU models, we patched Dawn to remove the restriction.
749-
${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/dawn/dawn_force_enable_f16_nvidia_vulkan.patch &&
750-
751-
# The dawn_fix_copy_dxil_dll.patch contains the following changes:
752-
#
753-
# - (private) Fix copy of dxil.dll in Dawn
754-
# The patch ensures the copy of dxil.dll to be done after the build step of `dxcompiler` target.
755-
${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/dawn/dawn_fix_copy_dxil_dll.patch)
740+
${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/dawn/dawn_force_enable_f16_nvidia_vulkan.patch)
756741

757742
onnxruntime_fetchcontent_declare(
758743
dawn

cmake/patches/dawn/dawn.patch

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git a/third_party/emdawnwebgpu/pkg/webgpu/src/webgpu.cpp b/third_party/emdawnwebgpu/pkg/webgpu/src/webgpu.cpp
2+
index be0bb93781..4fe1d34b29 100644
3+
--- a/third_party/emdawnwebgpu/pkg/webgpu/src/webgpu.cpp
4+
+++ b/third_party/emdawnwebgpu/pkg/webgpu/src/webgpu.cpp
5+
@@ -734,6 +734,7 @@ struct WGPUBufferImpl final : public EventSource,
6+
WGPUBufferImpl(const EventSource* source, bool mappedAtCreation);
7+
// Injection constructor used when we already have a backing Buffer.
8+
WGPUBufferImpl(const EventSource* source, WGPUBufferMapState mapState);
9+
+ ~WGPUBufferImpl();
10+
11+
void Destroy();
12+
const void* GetConstMappedRange(size_t offset, size_t size);
13+
@@ -1416,6 +1417,12 @@ WGPUBufferImpl::WGPUBufferImpl(const EventSource* source,
14+
RefCountedWithExternalCount(kImportedFromJS),
15+
mMapState(mapState) {}
16+
17+
+WGPUBufferImpl::~WGPUBufferImpl() {
18+
+ if (!IsImported()) {
19+
+ Destroy();
20+
+ }
21+
+}
22+
+
23+
void WGPUBufferImpl::Destroy() {
24+
emwgpuBufferDestroy(this);
25+
AbortPendingMap("Buffer was destroyed before mapping was resolved.");

cmake/patches/dawn/dawn_fix_copy_dxil_dll.patch

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)