Tests: check producer metadata in direct DXIL shaders #1471

Closed
github-bot wants to merge 19 commits from gh-pr/1471/head into gh-pr/1471/base
Owner

@⁠philip-roy-jones on GitHub · 2026-11-24 16:37 UTC · original
philip-roy-jones:dxil-ident-rx580 → main · +19483 −30 · 74 files · 19 commits · closed without merging

This PR is closed. The runtime fix for producer metadata in direct-DXIL shaders shipped in upstream main at c160d86. That commit can be used for driver verification. Merged PR #1426

Stacked on #1426. Only the top commit, 3c64cae, belongs to this PR. Review the 20-line patch

Part of #1269. Direct compute shaders without LLVM producer metadata validated on the Radeon RX 580, then the driver exited during pipeline creation. #1426 now emits the metadata separately for compute and graphics. I verified its clean head bc93a3a runs the compute kernel and draws the VS/PS triangle. Parent's driver fix

What is in it

  • Disassemble compute, vertex, pixel and mesh shaders and verify that !llvm.ident references a nonempty producer string.
  • Document the compute and graphics XCL_DIRECT_DXIL switches in the README.

Tested

  • 3c64cae02baadbf6d42ec654fbc118426926bfdb, Radeon RX 580 (31.0.21925.1001, native wave64), Ryzen 7 7700X, Windows 11 Pro 26200.9974, Rust 1.100.0 MSVC, DXC 1.9.2609.5. Debug tests and release smoke builds.
  • cargo test -p xcl --lib direct_shaders_identify_their_producer -- --nocapture failed on 065aef3 with CS has no llvm.ident and passed on this head with both DXC 1.9 and Windows SDK DXC 1.8.2502.11.
  • cargo test -p xcl --lib gpu::dxil:: -- --test-threads=4 --nocapture reported 74 passed, 0 failed and 2 ignored, including 15 wave32 and 2 mesh hardware skips. With XCL_DIRECT_DXIL=1, the EXEC-divergence and scalar-loop tests both passed without skips.
  • cargo build --workspace succeeded. cargo test --workspace --no-fail-fast -- --test-threads=4 lost its library process. Running its 514 unreported cases separately completed the suite. 805 reported passing, 21 failed, 1 crashed and 43 were ignored. 19 passes were hardware skips (15 wave32, 4 mesh). All 22 unsuccessful cases had the same outcomes individually on clean bc93a3a.
  • The Windows CI command .\scripts\test.ps1 --skip test_title_runs_and_game_folder_is_untouched passed locally with hardware adapter selection disabled. It reported 826 passed, 0 failed, 43 ignored and 1 filtered. 231 passes were explicit skips.
  • Four small retail compute shaders produced signed DXIL in 29.5–30.0 ms total through direct translation and 275.6–320.9 ms through HLSL + DXC. Each pair used cold caches, timed pso::console_to_dxil_in and selected the first four distinct native-wave64 programs with 64–4096 input bytes. The RX 580 created every pipeline. Direct output totalled 361,960 bytes, HLSL-derived output 62,208 bytes. Pipeline creation was outside the timer.

Regression run

scripts/smoke.ps1 -Game <retail folder> -Xcl <release exe> -Seconds 60 on the RX 580 with XCL_ASYNC_PSO=0 (synchronous pipeline creation), no input and fresh writable game data each time. For each revision and backend, the first run started with an empty shader cache and the second reused it. All eight runs completed without crashes or device removal.

Translation Cache Frames, main / PR Peak commit in MB, main / PR
Default HLSL cold 341 / 419 12,388 / 12,427
Default HLSL warm 1,669 / 1,673 18,216 / 17,596
Direct DXIL enabled cold 363 / 234 12,312 / 14,550
Direct DXIL enabled warm 1,661 / 1,665 15,974 / 49,696

The default HLSL runs cleared the project's frame and memory thresholds. With XCL_DIRECT_DXIL=1, cold-cache frames fell below 80% of main. Warm-cache frames were comparable while peak commit exceeded the 125% limit. The two blocks below are the warm default HLSL comparison.

Upstream main

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: Radeon RX 580 Series
title: Retail
seconds: 60
exit: 0x0
frames shown: 1669 (PresentX 1669)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 18216 MB

PR head

xcl-smoke v1
commit: 3c64cae02baadbf6d42ec654fbc118426926bfdb
gpu: Radeon RX 580 Series
title: Retail
seconds: 60
exit: 0x0
frames shown: 1673 (PresentX 1673)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 17596 MB

Not tested

  • Gameplay, hardware mesh execution and wave32-only kernels. The default HLSL blocks exercise the default runtime path. The direct runs and focused shader tests above exercise the opt-in backend.
  • The hosted Windows run is waiting for a repository writer to approve it. Hosted CI

AI use

  • Codex (GPT-6) diagnosed the RX 580 issue, wrote the regression test and README update, and ran the comparisons.
**@⁠philip-roy-jones** on GitHub · 2026-11-24 16:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/1471) `philip-roy-jones:dxil-ident-rx580` → `main` · +19483 −30 · 74 files · 19 commits · closed without merging This PR is closed. The runtime fix for producer metadata in direct-DXIL shaders shipped in upstream `main` at `c160d86`. That commit can be used for driver verification. [Merged PR #1426](https://git.gtahub.st/github/xcl-dev--xcl/pulls/1426) Stacked on #1426. Only the top commit, `3c64cae`, belongs to this PR. [Review the 20-line patch](https://github.com/ivall/xcl/compare/bc93a3a6f1d5ce2f5836135b231bd5e09e8d1658...3c64cae02baadbf6d42ec654fbc118426926bfdb) Part of #1269. Direct compute shaders without LLVM producer metadata validated on the Radeon RX 580, then the driver exited during pipeline creation. #1426 now emits the metadata separately for compute and graphics. I verified its clean head `bc93a3a` runs the compute kernel and draws the VS/PS triangle. [Parent's driver fix](https://github.com/ivall/xcl/commit/ac9328fc7b502b0044e8cacc563c3ad79137b80d) **What is in it** - Disassemble compute, vertex, pixel and mesh shaders and verify that `!llvm.ident` references a nonempty producer string. - Document the compute and graphics `XCL_DIRECT_DXIL` switches in the README. **Tested** - `3c64cae02baadbf6d42ec654fbc118426926bfdb`, Radeon RX 580 (31.0.21925.1001, native wave64), Ryzen 7 7700X, Windows 11 Pro 26200.9974, Rust 1.100.0 MSVC, DXC 1.9.2609.5. Debug tests and release smoke builds. - `cargo test -p xcl --lib direct_shaders_identify_their_producer -- --nocapture` failed on `065aef3` with `CS has no llvm.ident` and passed on this head with both DXC 1.9 and Windows SDK DXC 1.8.2502.11. - `cargo test -p xcl --lib gpu::dxil:: -- --test-threads=4 --nocapture` reported 74 passed, 0 failed and 2 ignored, including 15 wave32 and 2 mesh hardware skips. With `XCL_DIRECT_DXIL=1`, the EXEC-divergence and scalar-loop tests both passed without skips. - `cargo build --workspace` succeeded. `cargo test --workspace --no-fail-fast -- --test-threads=4` lost its library process. Running its 514 unreported cases separately completed the suite. 805 reported passing, 21 failed, 1 crashed and 43 were ignored. 19 passes were hardware skips (15 wave32, 4 mesh). All 22 unsuccessful cases had the same outcomes individually on clean `bc93a3a`. - The Windows CI command `.\scripts\test.ps1 --skip test_title_runs_and_game_folder_is_untouched` passed locally with hardware adapter selection disabled. It reported 826 passed, 0 failed, 43 ignored and 1 filtered. 231 passes were explicit skips. - Four small retail compute shaders produced signed DXIL in 29.5–30.0 ms total through direct translation and 275.6–320.9 ms through HLSL + DXC. Each pair used cold caches, timed `pso::console_to_dxil_in` and selected the first four distinct native-wave64 programs with 64–4096 input bytes. The RX 580 created every pipeline. Direct output totalled 361,960 bytes, HLSL-derived output 62,208 bytes. Pipeline creation was outside the timer. **Regression run** `scripts/smoke.ps1 -Game <retail folder> -Xcl <release exe> -Seconds 60` on the RX 580 with `XCL_ASYNC_PSO=0` (synchronous pipeline creation), no input and fresh writable game data each time. For each revision and backend, the first run started with an empty shader cache and the second reused it. All eight runs completed without crashes or device removal. | Translation | Cache | Frames, main / PR | Peak commit in MB, main / PR | |---|---|---:|---:| | Default HLSL | cold | 341 / 419 | 12,388 / 12,427 | | Default HLSL | warm | 1,669 / 1,673 | 18,216 / 17,596 | | Direct DXIL enabled | cold | 363 / 234 | 12,312 / 14,550 | | Direct DXIL enabled | warm | 1,661 / 1,665 | 15,974 / 49,696 | The default HLSL runs cleared the project's frame and memory thresholds. With `XCL_DIRECT_DXIL=1`, cold-cache frames fell below 80% of main. Warm-cache frames were comparable while peak commit exceeded the 125% limit. The two blocks below are the warm default HLSL comparison. Upstream main ``` xcl-smoke v1 commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7 gpu: Radeon RX 580 Series title: Retail seconds: 60 exit: 0x0 frames shown: 1669 (PresentX 1669) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 18216 MB ``` PR head ``` xcl-smoke v1 commit: 3c64cae02baadbf6d42ec654fbc118426926bfdb gpu: Radeon RX 580 Series title: Retail seconds: 60 exit: 0x0 frames shown: 1673 (PresentX 1673) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 17596 MB ``` **Not tested** - Gameplay, hardware mesh execution and wave32-only kernels. The default HLSL blocks exercise the default runtime path. The direct runs and focused shader tests above exercise the opt-in backend. - The hosted Windows run is waiting for a repository writer to approve it. [Hosted CI](https://github.com/ivall/xcl/actions/runs/45440942717) **AI use** - Codex (GPT-6) diagnosed the RX 580 issue, wrote the regression test and README update, and ran the comparisons.
Emits signed DXIL containers without HLSL or DXC: LLVM 3.7 bitcode writer,
DXBC container with the retail digest, dx.op library (math, memory,
atomics, textures, wave ops), VS/PS/MS signatures and PSV0 matching DXC
byte for byte. DXC's validator is used as a test oracle only.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
LLVM's reader only accepted 7 because unknown codes fall back to seq_cst.
Adds a test-only reader for our unabbreviated bitstream to check record
layouts the validator cannot distinguish.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The validator derives these flags from the code; kernels that built i64 or
double instructions with plain Module methods (rather than the Shader
helpers that call require) failed with "Flags must match usage". Both
finish paths now scan the entry for i64 / double operands and results,
and for double division and int <-> double conversions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Seeded xorshift generator of random-but-valid kernels (integer / float /
i64 / double arithmetic with guards, phis, diamonds, switches, loops with
back-edge phis, selects, dx.op integer ops, group-shared exchange and
atomics with barriers, wave reads, raw buffer I/O). 2000 modules pass the
validator; the exactly-comparable ones (~1200) run on the GPU against a
CPU interpreter. Includes the regression test for shader-flag inference.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Empty DXC blobs may report a null buffer, which slice::from_raw_parts
forbids (UB); error-buffer casts no longer unwrap, and blobs over 4 GiB
are an error instead of a truncated length. Adds a malformed-input test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Garbage above a half / float constant's width made equal constants
intern twice (and relied on the reader truncating the record).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Port of the translator from dxil/core (olympus-based) onto main:
CFG/SSA, the EXEC/ballot lane model, SALU/VALU/memory/image/cross-lane
lowering, compute/VS/PS/mesh entry points (gpu::dxil::kernel).

Hooks re-done against main's recomp: runner (direct_dxil, direct_kernel,
direct_kernel_full, switch in run_code/run_code_with), pso (direct compute,
VS/PS and mesh pass with logged HLSL fallback; the on-disk translation
cache is bypassed while the switch is on), tests (direct_or/direct_check),
constant_samplers pub(crate).

Translator fixes for tests only main has: f64/cvt output modifiers and
clamp, integer/packed/dot clamp, wave32 src_vccz/src_execz, b32 saveexec
with m0, SDWA f16 inline constants, cube T#s as cube arrays.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The translated cache identity now includes the backend (HLSL / direct
compute / direct all) and gpu::dxil::kernel::TRANSLATOR_VERSION when
XCL_DIRECT_DXIL is set; the HLSL identity is unchanged, so existing
entries stay valid. Caching is re-enabled for the direct path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Translator state is only looked up through hash maps (never iterated
into output), so no fix was needed; the test pins it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
act() and the cross-lane instructions' wave mask can be overridden, so an
external control-flow analysis can reuse the per-instruction lowering while
deciding EXEC itself. Default behaviour unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Module records the first misuse (forward reference outside phis,
instruction after a terminator, GEP/extractvalue/load into wrong types,
function redeclared with another type, bad call arity, bad constants,
add_incoming to a non-phi, use of a void value) and carries on with a
placeholder. New additive API: Module::fail/error/try_to_bitcode,
Shader::try_finish, Shader::try_finish_graphics; existing finish /
finish_graphics / to_bitcode keep their signatures (panic on a recorded
error). The translator uses the try_ variants, so pso.rs routing falls
back to HLSL with a log. Regression tests for each former panic.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The PR check only accepts binaries under tests/data/.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On the no-GPU CI runner (WARP / Basic Render Driver) even a DXC-compiled
VS/PS draw through runner::draw removes the device, which then fails every
later GPU test in the process (mesh_dispatch included). Gate the draw tests
the way recomp's gpu_ready() does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
NVIDIA Blackwell drivers fail CreateComputePipelineState with E_OUTOFMEMORY
for every fuzz module containing a groupshared atomicrmw sub (82/82 failing
seeds on an RTX 5070 Ti, 0 of 1141 without it). Neither DXC nor the
translator emits that form. debug_seed now prints size and GPU-runs the seed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
AMD's driver compiler (amdxc64.dll) crashes at PSO creation on modules
without it (RX 9070 / RX 7800 XT reports).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Windows SDK's DXC 1.6/1.7 rejects dx.valver 1.8 before checking
anything else. valver stays 1.8 (PSV0 carries PSVRuntimeInfo3, new in 1.8);
with an older validator validate() reports a SKIPPED line per test and the
GPU parts still run. Malformed containers still fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Radeon RX 580 driver exited during pipeline creation when the LLVM producer was missing. Disassemble each supported shader stage and check that its llvm.ident node references a nonempty producer string. Document the direct backend switches alongside the runtime options.

Assisted-by: Codex (GPT-6)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:54:47 +00:00
github-bot closed this pull request 2026-11-26 04:54:47 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 18:54 UTC · original

Verification on RTX 3060 Ti (Windows 11): merge conflict with current main in crates/xcl/src/gpu/recomp/tests.rs — needs a rebase before it can be tested.

**@⁠DavidM1911** on GitHub · 2026-11-24 18:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/1471#issuecomment-7141314632) Verification on RTX 3060 Ti (Windows 11): **merge conflict with current `main`** in `crates/xcl/src/gpu/recomp/tests.rs` — needs a rebase before it can be tested.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.