DXIL: fix heap_structured_buffer, texture_load, and wave_all_equal feature flags #2476

Open
github-bot wants to merge 1 commit from github-bot/gh-2476 into main AGit
Owner

@⁠Decodere on GitHub · 2026-11-25 19:41 UTC · original
Decodere:fix-dxil-ops-feature-flags → main · +64 −5 · 2 files · 1 commits · open

What is in it
Align three Shader op builders in crates/xcl/src/gpu/dxil/ops.rs (+5/-5) with DXC 1.9's validator feature-flag rules and add DXC 1.9 validator + SFI0 coverage in crates/xcl/src/gpu/dxil/ops_tests.rs (+59/-0, 69 lines total):

  • heap_structured_buffer: remove spurious self.require(Feature::RawAndStructuredBuffers) — ResourceDescriptorHeap structured buffers require only ResourceHeapIndexing (1 << 30, SFI0 = 0x200_0000), not the static raw/structured binding metadata flag (1 << 4), which caused dxil.dll to reject standalone heap structured-buffer shaders with Flags must match usage.
  • Texture / srv_texture / heap_texture / texture_load: record pub ncomp: u32 on Texture and gate Feature::TypedUavLoadAdditionalFormats (1 << 13, SFI0 = 0x800) on tex.uav && tex.ncomp > 1 instead of tex.comp != U32/I32/F32, fixing both 1-component false positives (UNormF32, SNormF32, F16) and multi-component F32/I32/U32 false negatives without removing typed_uav_load_additional_formats().
  • wave_all_equal: call self.wave_int64(v) matching the other typed wave helpers so Feature::Int64Ops and Feature::Doubles are recorded immediately on i64/f64 inputs.

Part of #1401
Part of #1833

Tested

  • Failing-first on unmodified origin/main (9ba6804f, DXC/dxil 1.9.2609.5): cargo test -p xcl --lib gpu::dxil::ops_tests::ops_feature_flags -- --test-threads=1 --nocapture failed 3 of 3 (ops_feature_flags_heap_structured_buffer rejected declared=1073741840, actual=1073741824; ops_feature_flags_typed_uav_texture_load rejected declared=1073741824, actual=1073750016; ops_feature_flags_wave_all_equal_64bit missed Int64Ops 16384 != 49152).
  • Post-fix gpu::dxil::ops_tests (c20e5829, rebased onto origin/main 06055a7a, DXC/dxil 1.9.2609.5):
    • Release RTX 4060 (cargo test --release -p xcl --lib gpu::dxil::ops_tests -- --test-threads=1 --nocapture): 27 passed; 0 failed; 0 ignored (0.33 s, 0 skips).
    • Release WARP (XCL_ADAPTER=warp cargo test --release -p xcl --lib gpu::dxil::ops_tests -- --test-threads=1 --nocapture): 27 passed; 0 failed; 0 ignored (0.06 s; 0 skips on all 3 new pure-CPU/DXC 1.9 tests, pre-existing GPU dispatch tests skip cleanly with no wave32).
  • Full release workspace (cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture, RTX 4060): 37 test binaries, 1416 passed; 0 failed; 46 ignored (183/183 gpu::dxil::*).
    • 29 pre-existing SKIPPED lines on this RTX 4060 host (21 no wave64, 3 per-lane wave32 refused, 3 no D3D12 debug layer / d3d12SDKLayers.dll, 1 no heap windows, 1 cannot disable driver cache; 0 skipped in gpu::dxil::ops_tests).

Regression run
Paired 60 s RTX 4060 smoke (scripts/smoke.ps1 -Seconds 60) on base origin/main vs PR head (1539 vs 1466 frames = 105.0%, 60 60 60 steady pace, 0 device removals, 0 crashes):

Base (origin/main):

xcl-smoke v1
commit: 06055a7a0fb43c5f83f55e7a2ce201417de171e9
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1466 (PresentX 1467)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 13983 MB

PR head:

xcl-smoke v1
commit: c20e5829a7b6bac8ff2acddcd58e697872b7bc00
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1539 (PresentX 1539)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14005 MB

Not tested

  • Wave64 GPU execution paths (21 pre-existing wave64 tests skip on RTX 4060 wave32-only hardware; all feature-flag cases are validated directly by DXC/dxil 1.9.2609.5 and SFI0 assertions).
  • D3D12 debug layer (d3d12SDKLayers.dll not installed on this host).

AI use
Written and verified with Google Antigravity (Gemini 4 Neon). All changes were validated locally with failing-first DXC 1.9 tests, full release workspace tests, and paired 60 s RTX 4060 smoke runs.

**@⁠Decodere** on GitHub · 2026-11-25 19:41 UTC · [original](https://github.com/xcl-dev/xcl/pull/2476) `Decodere:fix-dxil-ops-feature-flags` → `main` · +64 −5 · 2 files · 1 commits · open **What is in it** Align three `Shader` op builders in `crates/xcl/src/gpu/dxil/ops.rs` (`+5/-5`) with DXC 1.9's validator feature-flag rules and add DXC 1.9 validator + `SFI0` coverage in `crates/xcl/src/gpu/dxil/ops_tests.rs` (`+59/-0`, `69` lines total): - `heap_structured_buffer`: remove spurious `self.require(Feature::RawAndStructuredBuffers)` — `ResourceDescriptorHeap` structured buffers require only `ResourceHeapIndexing` (`1 << 30`, `SFI0 = 0x200_0000`), not the static raw/structured binding metadata flag (`1 << 4`), which caused `dxil.dll` to reject standalone heap structured-buffer shaders with `Flags must match usage`. - `Texture` / `srv_texture` / `heap_texture` / `texture_load`: record `pub ncomp: u32` on `Texture` and gate `Feature::TypedUavLoadAdditionalFormats` (`1 << 13`, `SFI0 = 0x800`) on `tex.uav && tex.ncomp > 1` instead of `tex.comp != U32/I32/F32`, fixing both 1-component false positives (`UNormF32`, `SNormF32`, `F16`) and multi-component `F32`/`I32`/`U32` false negatives without removing `typed_uav_load_additional_formats()`. - `wave_all_equal`: call `self.wave_int64(v)` matching the other typed wave helpers so `Feature::Int64Ops` and `Feature::Doubles` are recorded immediately on `i64`/`f64` inputs. Part of #1401 Part of #1833 **Tested** - Failing-first on unmodified `origin/main` (`9ba6804f`, DXC/dxil `1.9.2609.5`): `cargo test -p xcl --lib gpu::dxil::ops_tests::ops_feature_flags -- --test-threads=1 --nocapture` failed `3` of `3` (`ops_feature_flags_heap_structured_buffer` rejected `declared=1073741840, actual=1073741824`; `ops_feature_flags_typed_uav_texture_load` rejected `declared=1073741824, actual=1073750016`; `ops_feature_flags_wave_all_equal_64bit` missed `Int64Ops` `16384 != 49152`). - Post-fix `gpu::dxil::ops_tests` (`c20e5829`, rebased onto `origin/main` `06055a7a`, DXC/dxil `1.9.2609.5`): - Release RTX 4060 (`cargo test --release -p xcl --lib gpu::dxil::ops_tests -- --test-threads=1 --nocapture`): `27 passed; 0 failed; 0 ignored` (`0.33 s`, `0` skips). - Release WARP (`XCL_ADAPTER=warp cargo test --release -p xcl --lib gpu::dxil::ops_tests -- --test-threads=1 --nocapture`): `27 passed; 0 failed; 0 ignored` (`0.06 s`; `0` skips on all 3 new pure-CPU/DXC 1.9 tests, pre-existing GPU dispatch tests skip cleanly with `no wave32`). - Full release workspace (`cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture`, RTX 4060): `37` test binaries, `1416 passed; 0 failed; 46 ignored` (`183/183` `gpu::dxil::*`). - `29` pre-existing `SKIPPED` lines on this RTX 4060 host (`21` no wave64, `3` per-lane wave32 refused, `3` no D3D12 debug layer / `d3d12SDKLayers.dll`, `1` no heap windows, `1` cannot disable driver cache; `0` skipped in `gpu::dxil::ops_tests`). **Regression run** Paired 60 s RTX 4060 smoke (`scripts/smoke.ps1 -Seconds 60`) on base `origin/main` vs PR head (`1539` vs `1466` frames = `105.0%`, `60 60 60` steady pace, `0` device removals, `0` crashes): Base (`origin/main`): ``` xcl-smoke v1 commit: 06055a7a0fb43c5f83f55e7a2ce201417de171e9 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1466 (PresentX 1467) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 13983 MB ``` PR head: ``` xcl-smoke v1 commit: c20e5829a7b6bac8ff2acddcd58e697872b7bc00 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1539 (PresentX 1539) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14005 MB ``` **Not tested** - Wave64 GPU execution paths (`21` pre-existing wave64 tests skip on RTX 4060 wave32-only hardware; all feature-flag cases are validated directly by DXC/dxil `1.9.2609.5` and `SFI0` assertions). - D3D12 debug layer (`d3d12SDKLayers.dll` not installed on this host). **AI use** Written and verified with Google Antigravity (Gemini 4 Neon). All changes were validated locally with failing-first DXC 1.9 tests, full release workspace tests, and paired 60 s RTX 4060 smoke runs.
Align three `Shader` op builders in `gpu/dxil/ops.rs` with DXC 1.9's
validator feature-flag rules:
- `heap_structured_buffer`: drop spurious `Feature::RawAndStructuredBuffers`
  (`ResourceDescriptorHeap` structured buffers require only
  `ResourceHeapIndexing`, not the static raw/structured binding flag).
- `Texture` / `texture_load`: record `pub ncomp: u32` on `Texture` (set in
  `srv_texture` and `heap_texture`) and gate
  `Feature::TypedUavLoadAdditionalFormats` on `tex.uav && tex.ncomp > 1`
  instead of `comp != U32/I32/F32`, fixing both 1-component false positives
  (`UNormF32`, `SNormF32`, `F16`) and multi-component `F32`/`I32`/`U32`
  false negatives.
- `wave_all_equal`: call `self.wave_int64(v)` matching the other typed wave
  helpers so `Int64Ops` and `Doubles` are declared immediately on `i64`/`f64`
  inputs.

Part of #1401
Part of #1833

Assisted-by: Google Antigravity (Gemini 4 Neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:31:39 +00:00
Author
Owner

@⁠DarkPanda69 on GitHub · 2026-11-25 19:53 UTC · original

The wave64 GPU paths listed as untested, on an AMD card with native wave64, plus an RTX 3060, paired against main with the direct translator on for the whole GPU suite (so every directly translated program carries the changed flags).

Head c20e582 applied on main 6d051da, debug, Windows 11 Pro 26200, XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu:: --test-threads=4, on main and on this PR for each card:

main this PR
RX 9070 XT (RDNA4, 32.0.32029.2010, native wave64) 696 passed, 2 failed, 6 SKIPPED 699 passed, 2 failed, 6 SKIPPED
RTX 3060 (32.0.16.1088, wave32) 698 passed, 0 failed, 24 SKIPPED 701 passed, 0 failed, 24 SKIPPED

Per-test comparison: on both cards the only differences are the 3 new ops_feature_flags_* tests (all ok). No existing test changes result or skip state; on the RX 9070 XT none of the wave64 tests skip, so the drivers accept the pipelines with the new flags there too. The 2 RX 9070 XT failures are the AMD fuzz seeds tracked in #2115, the same on main.

Not tested: the D3D12 debug layer (not installed here), a title.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

**@⁠DarkPanda69** on GitHub · 2026-11-25 19:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/2476#issuecomment-7172908019) The wave64 GPU paths listed as untested, on an AMD card with native wave64, plus an RTX 3060, paired against `main` with the direct translator on for the whole GPU suite (so every directly translated program carries the changed flags). Head `c20e582` applied on `main` `6d051da`, debug, Windows 11 Pro 26200, `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu:: --test-threads=4`, on `main` and on this PR for each card: | | `main` | this PR | |---|---|---| | RX 9070 XT (RDNA4, 32.0.32029.2010, native wave64) | 696 passed, 2 failed, 6 SKIPPED | 699 passed, 2 failed, 6 SKIPPED | | RTX 3060 (32.0.16.1088, wave32) | 698 passed, 0 failed, 24 SKIPPED | 701 passed, 0 failed, 24 SKIPPED | Per-test comparison: on both cards the only differences are the 3 new `ops_feature_flags_*` tests (all ok). No existing test changes result or skip state; on the RX 9070 XT none of the wave64 tests skip, so the drivers accept the pipelines with the new flags there too. The 2 RX 9070 XT failures are the AMD fuzz seeds tracked in #2115, the same on `main`. Not tested: the D3D12 debug layer (not installed here), a title. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Author
Owner

@⁠emirduran707 on GitHub · 2026-11-25 20:09 UTC · original

Independent AMD RDNA4 (native wave64) test report on exact head c20e5829a7b6bac8ff2acddcd58e697872b7bc00 (clean detached checkout, no local changes).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (stable-x86_64-pc-windows-msvc), DXC 1.9.2602.17; tests debug, smoke release.
  • cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4: 1414 passed, 2 failed, 46 ignored; 8 SKIPPED (6 in lower_dxil::tests::{f16,f32}_programs_on_the_gpu refused by per-lane form; heap_window_out_of_memory_falls_back_to_the_switch_form; pso_measurement_compiles_an_exact_synthetic_record). All native wave64 GPU tests ran and passed.
    • All 3 PR tests passed: gpu::dxil::ops_tests::ops_feature_flags_heap_structured_buffer, ops_feature_flags_typed_uav_texture_load, and ops_feature_flags_wave_all_equal_64bit.
    • The 2 failures (gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1 seed 722 and fuzz_validate_and_gpu_3 seed 1599) are pre-existing on unmodified main on this GPU.

Regression run (60 s retail-title smoke, XCL_NETWORK=0, release)

xcl-smoke v1
commit: c20e5829a7b6bac8ff2acddcd58e697872b7bc00
gpu: AMD Radeon RX 9060 XT
title: 21222967
seconds: 60
exit: 0x0
frames shown: 1613 (PresentX 1613)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 16252 MB

(Matched main 68a284a baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.)

Not tested

  • D3D12 debug layer; Intel GPUs.

AI use

  • Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.
**@⁠emirduran707** on GitHub · 2026-11-25 20:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/2476#issuecomment-7173272327) Independent AMD RDNA4 (native wave64) test report on exact head `c20e5829a7b6bac8ff2acddcd58e697872b7bc00` (clean detached checkout, no local changes). **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64, driver 32.0.31044.16), Ryzen 5 5600, 32 GB RAM, Windows 11 Pro 26300, Rust 1.100.0 (`stable-x86_64-pc-windows-msvc`), DXC 1.9.2602.17; tests debug, smoke release. - `cargo build --workspace && cargo test --workspace --no-fail-fast -- --test-threads=4`: **1414 passed, 2 failed, 46 ignored; 8 SKIPPED** (6 in `lower_dxil::tests::{f16,f32}_programs_on_the_gpu` refused by per-lane form; `heap_window_out_of_memory_falls_back_to_the_switch_form`; `pso_measurement_compiles_an_exact_synthetic_record`). All native wave64 GPU tests ran and passed. - All 3 PR tests passed: `gpu::dxil::ops_tests::ops_feature_flags_heap_structured_buffer`, `ops_feature_flags_typed_uav_texture_load`, and `ops_feature_flags_wave_all_equal_64bit`. - The 2 failures (`gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1` seed 722 and `fuzz_validate_and_gpu_3` seed 1599) are pre-existing on unmodified `main` on this GPU. **Regression run** (60 s retail-title smoke, `XCL_NETWORK=0`, release) ``` xcl-smoke v1 commit: c20e5829a7b6bac8ff2acddcd58e697872b7bc00 gpu: AMD Radeon RX 9060 XT title: 21222967 seconds: 60 exit: 0x0 frames shown: 1613 (PresentX 1613) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 16252 MB ``` (Matched `main` `68a284a` baseline on the same machine today: 1573 frames, 14420 MB peak, 0 device removals, 0 crashes.) **Not tested** - D3D12 debug layer; Intel GPUs. **AI use** - Antigravity with Gemini 4 Neon ran the build, test suite, and smoke run and drafted this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 20:37 UTC · original

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 20:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/2476#issuecomment-7173955781) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun. Thanks!
Author
Owner

@⁠Decodere on GitHub · 2026-11-25 20:49 UTC · original

Thanks for reviewing! We verified this directly against Microsoft dxc.exe / dxil.dll 1.9.2609.5 (and all 8 format/component-count cases in ops_feature_flags_typed_uav_texture_load pass live dxil.dll validation via check(&c)):

Compiling RWTexture2D<T> u; u[t.xy] = u[t.xy]; with dxc -T cs_6_6 emits:

  • float, unorm float, snorm float (ncomp == 1): SFI0 = 0x00000000 (TypedUAVLoadAdditionalFormats = false)
  • float16_t (ncomp == 1, -enable-16bit-types): SFI0 = 0x00040000 (NativeLowPrecision only, TypedUAVLoadAdditionalFormats = false)
  • float4, uint4 (ncomp == 4): SFI0 = 0x00000800 (TypedUAVLoadAdditionalFormats = true)
  • float16_t4 (ncomp == 4, -enable-16bit-types): SFI0 = 0x00040800 (TypedUAVLoadAdditionalFormats = true)

DXIL resource metadata encodes component type + component count (not DXGI_FORMAT), and dxil.dll's validator requires TypedUAVLoadAdditionalFormats (0x800) strictly when a typed UAV load reads > 1 component (ncomp > 1) — setting 0x800 on 1-component UNormF32/SNormF32/F16 (as main did previously) is rejected by dxil.dll with a shader feature-flag mismatch.

**@⁠Decodere** on GitHub · 2026-11-25 20:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/2476#issuecomment-7174240227) Thanks for reviewing! We verified this directly against Microsoft `dxc.exe` / `dxil.dll 1.9.2609.5` (and all 8 format/component-count cases in `ops_feature_flags_typed_uav_texture_load` pass live `dxil.dll` validation via `check(&c)`): Compiling `RWTexture2D<T> u; u[t.xy] = u[t.xy];` with `dxc -T cs_6_6` emits: - `float`, `unorm float`, `snorm float` (`ncomp == 1`): `SFI0 = 0x00000000` (`TypedUAVLoadAdditionalFormats = false`) - `float16_t` (`ncomp == 1`, `-enable-16bit-types`): `SFI0 = 0x00040000` (`NativeLowPrecision` only, `TypedUAVLoadAdditionalFormats = false`) - `float4`, `uint4` (`ncomp == 4`): `SFI0 = 0x00000800` (`TypedUAVLoadAdditionalFormats = true`) - `float16_t4` (`ncomp == 4`, `-enable-16bit-types`): `SFI0 = 0x00040800` (`TypedUAVLoadAdditionalFormats = true`) DXIL resource metadata encodes component type + component count (not `DXGI_FORMAT`), and `dxil.dll`'s validator requires `TypedUAVLoadAdditionalFormats` (`0x800`) strictly when a typed UAV load reads `> 1` component (`ncomp > 1`) — setting `0x800` on 1-component `UNormF32`/`SNormF32`/`F16` (as `main` did previously) is rejected by `dxil.dll` with a shader feature-flag mismatch.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-25 20:52 UTC · original

gpu_ suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.

**@⁠SlopTart** on GitHub · 2026-11-25 20:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/2476#issuecomment-7174294304) `gpu_` suite (cold cache): 164 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2476/head:github-bot/gh-2476'
git switch 'github-bot/gh-2476'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2476'
git switch 'github-bot/gh-2476'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2476'
git switch 'github-bot/gh-2476'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2476'
git switch 'main'
git merge --squash 'github-bot/gh-2476'
git switch 'main'
git merge --ff-only 'github-bot/gh-2476'
git switch 'main'
git merge 'github-bot/gh-2476'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.