Skip to content

Build and ship DXC on Windows - #20

Merged
dj2 merged 1 commit into
dawn-gpu:mainfrom
slimbuck:windows-dxc
Sep 30, 2026
Merged

dj2 merged 1 commit into
dawn-gpu:mainfrom
slimbuck:windows-dxc

Conversation

@slimbuck

Copy link
Copy Markdown
Contributor

Fixes https://issues.chromium.org/issues/566251711

Without DAWN_USE_BUILT_DXC, Dawn forces the D3D12 backend onto FXC. On a Gaussian splat compute rasterizer, FXC ran the raster pass 44–51x slower than DXC (1241 ms vs 28 ms and 1166 ms vs 23 ms on two frames) and could hang the device with DXGI_ERROR_DEVICE_HUNG. The issue has the controlled comparison.

Changes

  • build/build.js: on Windows, configure with -DDAWN_USE_BUILT_DXC=ON. Dawn's default platform then prefers DXC wherever the adapter supports shader model 6.0+ and falls back to FXC otherwise, so no runtime toggle is needed.
  • build/build.js: copy dxcompiler.dll into dist/win32-<arch>/ beside dawn.node, where Dawn loads it from. CI already uploads and publishes that whole directory, so the workflow only needed a comment update.
  • DXC's LICENSE.TXT and ThirdPartyNotices.txt ship alongside as dxcompiler-LICENSE.TXT and dxcompiler-ThirdPartyNotices.txt.
  • No new dependencies: gclient sync already fetches DXC at the revision pinned in Dawn's DEPS.

Open question

-DDAWN_DXC_ENABLE_ASSERTS_IN_NDEBUG=OFF matches the configuration tested in the issue. Dawn's default is ON, which keeps DXC's asserts in release builds so an internal DXC failure traps instead of continuing. Happy to drop the flag if you'd rather keep Dawn's default.

Cost

Compressed CI artifact size and job time, compared with the latest main run:

Target Artifact Job time
win32-x64 6.7 → 14.5 MB 40 → 67 min
win32-arm64 8.1 → 15.8 MB 38 → 61 min

Linux and macOS artifacts are unchanged.

Testing

Without DAWN_USE_BUILT_DXC, dawn forces the d3d12 backend onto FXC. FXC
was measured ~45x slower than DXC on a compute rasterizer and can hang the
device (crbug.com/566251711). With built DXC, dawn prefers DXC wherever the
adapter supports shader model 6.0+, falling back to FXC otherwise.

dxcompiler.dll and DXC's license notices are copied into dist/win32-<arch>/
beside dawn.node, where dawn loads it from and where CI already uploads
and publishes from.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread build/build.js
// supports shader model 6.0+. copyResult ships dxcompiler.dll alongside.
...addElemIf(isWin, '-DDAWN_USE_BUILT_DXC=ON'),
// dawn otherwise keeps DXC's asserts in release builds, where they trap.
...addElemIf(isWin, '-DDAWN_DXC_ENABLE_ASSERTS_IN_NDEBUG=OFF'),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a need to turn this off? Those asserts do a lot of work to make DXC safer to use.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We enable asserts in release primarily for security reasons. Keeping them off should make DXC run faster, although we've never measured the performance gain. Whether you want to enable this or not depends on the use-case for node-webgpu.

@dj2

dj2 commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

@amaiorano does this look correct to you since you did a lot of the DXC integration work?

@amaiorano

Copy link
Copy Markdown

@amaiorano does this look correct to you since you did a lot of the DXC integration work?

Looks good to me.

@dj2
dj2 merged commit e996e2f into dawn-gpu:main Sep 30, 2026
6 checks passed
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.

3 participants