Skip to content

Commit 2b13541

Browse files
authored
upgrade dawn to 13c1635a14574ebb7116b56a69f5519301417fda (microsoft#25703)
### Description Upgrade dawn. Following up of microsoft#25461. This PR includes: - Fix to bug introduced by google/dawn@062be63. Revert temporary workaround - make corresponding changes to https://dawn-review.googlesource.com/c/dawn/+/251714 (remove DLL preload since it's correctly handled in dawn) - fix Java binding (missing dxc DLLs) Tasks: - [x] verify emscripten build (debug/release) - [ ] verify node.js binding
1 parent b49e3b1 commit 2b13541

File tree

5 files changed

+11
-75
lines changed

5 files changed

+11
-75
lines changed

cmake/deps.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ cutlass;https://github.com/NVIDIA/cutlass/archive/refs/tags/v3.9.2.zip;b7f8dc4a8
5555
extensions;https://github.com/microsoft/onnxruntime-extensions/archive/c24b7bab0c12f53da76d0c31b03b9f0f8ec8f3b4.zip;239063aee4946a9af147b473a4c3da78ba7413b4
5656
directx_headers;https://github.com/microsoft/DirectX-Headers/archive/refs/tags/v1.613.1.zip;47653509a3371eabb156360f42faf582f314bf2e
5757
cudnn_frontend;https://github.com/NVIDIA/cudnn-frontend/archive/refs/tags/v1.12.0.zip;7e733cfdc410d777b76122d64232499205589a96
58-
dawn;https://github.com/google/dawn/archive/794b6fadc4171f7b853a77ffdf0948fbec431f41.zip;77bb02deace0d140411f02a2fb8f5f925ea6a1b6
58+
dawn;https://github.com/google/dawn/archive/13c1635a14574ebb7116b56a69f5519301417fda.zip;0aadd28fc385cf7d657d5fc70a352372d2d3c76a
5959
kleidiai;https://github.com/ARM-software/kleidiai/archive/refs/tags/v1.9.0.tar.gz;a2765979f64efb173a4b8ba4de39dcba9c655786
6060
duktape;https://github.com/svaarala/duktape/releases/download/v2.7.0/duktape-2.7.0.tar.xz;8200c8e417dbab7adcc12c4dbdef7651cfc55794

java/src/main/java/ai/onnxruntime/OnnxRuntime.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ final class OnnxRuntime {
8484
/** The short name of the WebGPU DAWN library */
8585
static final String ONNXRUNTIME_LIBRARY_WEBGPU_DAWN_NAME = "webgpu_dawn";
8686

87+
/** The short name of the WebGPU DXC library "dxil.dll" */
88+
static final String ONNXRUNTIME_LIBRARY_WEBGPU_DXC_DXIL_NAME = "dxil";
89+
90+
/** The short name of the WebGPU DXC library "dxcompiler.dll" */
91+
static final String ONNXRUNTIME_LIBRARY_WEBGPU_DXC_DXCOMPILER_NAME = "dxcompiler";
92+
8793
/** The OS & CPU architecture string */
8894
private static final String OS_ARCH_STR = initOsArch();
8995

@@ -172,9 +178,11 @@ static synchronized void init() throws IOException {
172178
// the ONNX Runtime native library will load it
173179
extractProviderLibrary(ONNXRUNTIME_LIBRARY_SHARED_NAME);
174180

175-
// Extract and prepare the Dawn shared library (if present) but don't try to load it,
176-
// the ONNX Runtime native library will load it
181+
// Extract and prepare the Dawn shared libraries (if present) but don't try to load them,
182+
// the ONNX Runtime native library will load them
177183
extractProviderLibrary(ONNXRUNTIME_LIBRARY_WEBGPU_DAWN_NAME);
184+
extractProviderLibrary(ONNXRUNTIME_LIBRARY_WEBGPU_DXC_DXIL_NAME);
185+
extractProviderLibrary(ONNXRUNTIME_LIBRARY_WEBGPU_DXC_DXCOMPILER_NAME);
178186

179187
if (!isAndroid()) {
180188
load(ONNXRUNTIME_LIBRARY_NAME);

onnxruntime/core/providers/webgpu/webgpu_context.cc

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,6 @@ void WebGpuContext::Initialize(const WebGpuBufferCacheConfig& buffer_cache_confi
4141
std::call_once(init_flag_, [this, &buffer_cache_config, backend_type, enable_pix_capture]() {
4242
if (device_ == nullptr) {
4343
// Create wgpu::Adapter
44-
#if !defined(__wasm__) && defined(_MSC_VER) && defined(DAWN_ENABLE_D3D12) && !defined(USE_EXTERNAL_DAWN)
45-
// If we are using the D3D12 backend on Windows and the build does not use external Dawn, dxil.dll and dxcompiler.dll are required.
46-
//
47-
// Dawn will try to load them later, but if they are in the different directory to the executable, it may fail to find them.
48-
// To avoid this issue, we try to load them from the same directory as current module (usually onnxruntime.dll).
49-
auto runtime_path = Env::Default().GetRuntimePath();
50-
if (!runtime_path.empty()) {
51-
Status status;
52-
void* module_handle = nullptr;
53-
54-
PathString dxil_path = runtime_path + ToPathString(L"dxil.dll");
55-
status = Env::Default().LoadDynamicLibrary(dxil_path, false, &module_handle);
56-
if (status.IsOK() && module_handle != nullptr) {
57-
modules_.Add(dxil_path, module_handle);
58-
}
59-
60-
PathString dxcompiler_path = runtime_path + ToPathString(L"dxcompiler.dll");
61-
status = Env::Default().LoadDynamicLibrary(dxcompiler_path, false, &module_handle);
62-
if (status.IsOK() && module_handle != nullptr) {
63-
modules_.Add(dxcompiler_path, module_handle);
64-
}
65-
}
66-
#endif
67-
6844
wgpu::RequestAdapterOptions req_adapter_options = {};
6945
req_adapter_options.backendType = static_cast<wgpu::BackendType>(backend_type);
7046
req_adapter_options.powerPreference = wgpu::PowerPreference::HighPerformance;

onnxruntime/core/providers/webgpu/webgpu_context.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "core/providers/webgpu/webgpu_external_header.h"
1010

1111
#include "core/common/common.h"
12-
#include "core/framework/library_handles.h"
1312
#include "core/providers/webgpu/buffer_manager.h"
1413
#include "core/providers/webgpu/program_manager.h"
1514

@@ -227,8 +226,6 @@ class WebGpuContext final {
227226

228227
std::once_flag init_flag_;
229228

230-
LibraryHandles modules_;
231-
232229
wgpu::Instance instance_;
233230
wgpu::Device device_;
234231

onnxruntime/wasm/wasm_post_build.js

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -47,49 +47,4 @@ if (path.basename(mjsFilePath).includes('-threaded')) {
4747
);
4848
}
4949

50-
// STEP.2 - Workaround the issue referred in https://issues.chromium.org/issues/435879324
51-
52-
// Closure compiler will minimize the key of object `FeatureNameString2Enum`, turning `subgroup` into something else.
53-
54-
// This workaround is to replace the generated code as following:
55-
//
56-
// (for debug build)
57-
//
58-
// > subgroups: "18",
59-
// --- change to -->
60-
// > "subgroups": "18",
61-
//
62-
// (for release build)
63-
//
64-
// > Pe:"18",
65-
// --- change to -->
66-
// > "subgroups":"18",
67-
//
68-
69-
// This step should only be applied for WebGPU EP builds
70-
if (path.basename(mjsFilePath).includes('.async')) {
71-
const regexDebug = 'subgroups: "18"';
72-
const regexRelease = '[a-zA-Z_$][a-zA-Z0-9_$]*:"18"';
73-
74-
const matchesDebug = [...contents.matchAll(new RegExp(regexDebug, 'g'))];
75-
const matchesRelease = [...contents.matchAll(new RegExp(regexRelease, 'g'))];
76-
77-
if (matchesDebug.length === 1 && matchesRelease.length === 0) {
78-
contents = contents.replace(
79-
new RegExp(regexDebug),
80-
'"subgroups": "18"',
81-
);
82-
} else if (matchesDebug.length === 0 && matchesRelease.length === 1) {
83-
contents = contents.replace(
84-
new RegExp(regexRelease),
85-
'"subgroups":"18"',
86-
);
87-
} else {
88-
throw new Error(
89-
`Unexpected number of matches for "${regexDebug}" and "${regexRelease}" in "${mjsFilePath}": Debug=${matchesDebug.length}, Release=${matchesRelease.length}.`,
90-
);
91-
}
92-
}
93-
94-
9550
fs.writeFileSync(mjsFilePath, contents);

0 commit comments

Comments
 (0)