gpu: direct RDNA2 -> DXIL backend (no HLSL / DXC), behind XCL_DIRECT_DXIL #1426

Manually merged
github merged 34 commits from gh-pr/1426/head into gh-pr/1426/base 2026-11-26 04:53:27 +00:00
Owner

@⁠bmjask on GitHub · 2026-11-24 15:49 UTC · original
bmjask:shaders/direct-dxil-main → main · +19641 −30 · 73 files · 34 commits · merged 2026-11-24 18:29 UTC

A backend that translates console RDNA2 programs straight to signed DXIL containers, with no HLSL text and no DXC at run time. It sits next to the HLSL path, is off by default, and is selected with XCL_DIRECT_DXIL=1: console compute shaders, the mesh pass and (with =all) VS/PS. Anything it can't translate falls back to the HLSL path and is logged. It is the base for the per-lane mode that @⁠gefydev's team is building on it (#1269).

What is in it

  • crates/xcl/src/gpu/dxil/:
    • Bitcode writer: bitstream.rs and module.rs write LLVM 3.7 bitcode. Blocks are written in reverse post-order of the CFG, so a lowering may create blocks in any order; replace_all_uses is available.
    • Cleanup passes: module/opt.rs removes trivial phis, merges duplicate pure instructions along the dominator tree, and removes dead code. XCL_DXIL_NO_OPT=phi,cse,dce|all turns passes off for bisecting. There is no fast-math or float reassociation, and wave ops are only merged within one block.
    • DXIL layer: shader.rs and ops.rs cover dx.op calls, handles, resource metadata and shader flags. Every dx.op declaration's attributes are checked against DXC's table. The op library covers math, memory, atomics, typed/raw/structured buffers, textures/samplers, wave ops and derivatives.
    • Graphics: graphics.rs and container.rs write ISG1/OSG1/PSG1, PSV0 and the view-ID tables, and handle VS/PS/MS entries. The digest is computed in-tree and matches DXC byte for byte.
    • Translator: cfg.rs, ssa.rs, lanes.rs, lower*.rs, kernel.rs. It builds a CFG, constructs SSA on the fly, keeps lane masks and lowers every instruction, using the same EXEC model as the HLSL path. Lw::inst_guarded lets an external control-flow analysis reuse the per-instruction lowering.
    • Coverage: coverage.rs adds xcl shaders <pack> --direct [--sample N] [--validate] [--compare] to sweep a pack, and XCL_DIRECT_DXIL_STATS=1 prints live fallback statistics at exit.
    • Oracle: validate.rs wraps DXC's validator and disassembler, used in tests only. With a validator older than 1.8 only the validation step is skipped.
  • Hooks:
    • recomp/pso.rs: routing with HLSL fallback, and a separate on-disk cache identity per backend and TRANSLATOR_VERSION. HLSL cache entries are unchanged.
    • recomp/runner.rs: test-only additions.
    • recomp/tests.rs: backend switch.
  • Heap memory windows (XCL_HEAP_WINDOWS, merged from main) are not translated yet; those shaders take the HLSL path.
  • Fixed from reports in this thread:
    • AMD driver crash: !llvm.ident is now emitted.
    • AMD's 64-bit Bfrev miscompile: halves are now reversed separately.
    • WaveMultiPrefixBit* is now signed, as DXC emits it. The unsigned form removed the device on RDNA4.
    • waveGetLaneIndex is readonly (@⁠Kalmarv).
    • VS/PS that branch before their exports (@⁠Kalmarv).
    • The fuzzer no longer emits groupshared atomicrmw sub, which NVIDIA rejects.
    • Validator 1.7 handling, and draw tests skip on CI/WARP.
    • Fixtures are in tests/data/dxil/.
    • The test validator wrapper refuses input shorter than a container header, because DXC 1.8 read past it (patch by @⁠upipibi, reported by @⁠DavidM1911).
    • Builder misuse is recorded as an error and falls back to HLSL.
    • Irreducible console control flow. The console compiler emits loops entered in the middle. The CFG builder now splits nodes until every loop has one entry, so the DXIL is reducible, as DXIL requires. If that would grow the CFG past 4×, the program falls back to HLSL. This is the cause of the amdxc64.dll fault HKEY-Funk-Machine isolated on cs 62b584e061c05fc5: release builds skip the validator, and NVIDIA tolerated the irreducible CFG.
    • Countbits.i64 is emitted per 32-bit half, a workaround like the one for Bfrev.i64.
    • XCL_DXIL_DUMP=<hash|all> writes the direct DXIL of chosen programs. xcl shaders --direct --hash <h> --dump <dir> does the same in sweeps.
    • Translation time: a guarded region now merges only the registers it writes. On the sample, p50 is 29 ms, p95 0.38 s and max about 1 s, down from 64 ms / 1.6 s / 3.7 s.

Tested

  • RTX 4090 (wave32 only), NVIDIA driver, Windows 11, Rust 1.96 MSVC, debug, DXC 1.9.2602.17 (test oracle only), head 81d2ad5a9d06.

  • cargo test --workspace -- --test-threads=4: 858 passed, 0 failed, 42 ignored. SKIPPED GPU tests: gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).

  • XCL_DIRECT_DXIL=1 and =all, cargo test -p xcl --lib gpu::recomp: 194 passed, 0 failed, 18 ignored each. Every kernel/compute/mesh/VS/PS test goes through the direct path, with no fallback in tests.

  • Retail pack sample (xcl shaders shaders.rpf --direct --sample 200 --seed 1 --validate --compare):

    before the fixes in this round now
    translated (all validator-clean) 113 / 200 197 / 200 (the 3 left are ES+GS, not in this PR)
    translation time p50 / p95 605 ms / 10 s 29 ms / 0.38 s
    size vs HLSL+DXC 14.5× 1.25×
  • Also checked:

    • Signature and PSV0 parts match DXC byte for byte on 16+ references.
    • Randomised differential tests (2000 modules validated, about 1230 compared with a CPU interpreter on the GPU) ran on this code; they move to the stacked follow-up PR to keep this diff under GitHub's 20 000-line limit.
    • The same container is produced across runs and threads.
  • Testers on this PR:

    • Kalmarv (RTX 5070 Ti): whole suite with DXC 1.7 and 1.9; dxil.dll and dxil-spirv checks of 303 containers; smoke pairs.
    • mastrr9 (RTX 5080).
    • vitor127wt (RTX 5070 Ti, Linux).
    • ArturoWolff (RTX 4060, Proton).
    • emirduran707 (RX 9060 XT): no crash after !llvm.ident.
    • HKEY-Funk-Machine (RX 9070).
    • SlopTart (RX 7900 XT, RADV).

Regression run
The retail title, 60 s each, RTX 4090, release builds, back to back on an idle machine, XCL_DIRECT_DXIL unset, no uncommitted changes. PR (head 81d2ad5a9d06): 97 % of main's frames, 111 % of its peak commit (one earlier run on this head stalled near its end on a busy machine, 1400 frames; the rerun on an idle machine is the block below), no crash or device removal.

main:

xcl-smoke v1
commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485
gpu: NVIDIA GeForce RTX 4090
title: game
seconds: 60
exit: 0x0
frames shown: 1590 (PresentX 1590)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 15360 MB

PR:

xcl-smoke v1
commit: 81d2ad5a9d06f6d11211f0c2524d5db9c3362bcf
gpu: NVIDIA GeForce RTX 4090
title: game
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: 17128 MB

Not tested

  • AMD: the Bfrev and multi-prefix fixes come from testers' bisections and are not yet re-run on RDNA. The amdxc64.dll fault on one retail program is fixed (irreducible CFG, above) but not yet re-run on AMD. Fuzz seed 722 on RDNA4 looks like the driver moving a wave op into a divergent branch. RADV seeds 1003/1698 are a Mesa folding bug, traced in the thread.
  • Hardware: native wave64 hardware, and Intel.
  • Direct path in a title on this head (only the default path was smoke-tested here).
  • Not in this PR: geometry mode (ES+GS), MSAA, non-default f32 round modes, heap memory windows, and the randomised fuzz tests (kept out to stay under GitHub's 20 000-line diff limit). These exist on follow-up branches and will come as a stacked PR.

AI use

  • Claude Code (Claude Opus 5.5): designed and wrote the code and tests (several coordinated agents), ran the suites, the sample sweep and the regression runs on the RTX 4090, and drafted this description. Written from scratch. The references are the LLVM 3.7 bitcode format and DXC (NCSA licence), plus DXC's output for small HLSL programs. No code from GPL-3 projects was used.

🤖 Generated with Claude Code

**@⁠bmjask** on GitHub · 2026-11-24 15:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426) `bmjask:shaders/direct-dxil-main` → `main` · +19641 −30 · 73 files · 34 commits · merged 2026-11-24 18:29 UTC A backend that translates console RDNA2 programs **straight to signed DXIL containers**, with no HLSL text and no DXC at run time. It sits next to the HLSL path, is **off by default**, and is selected with `XCL_DIRECT_DXIL=1`: console compute shaders, the mesh pass and (with `=all`) VS/PS. Anything it can't translate falls back to the HLSL path and is logged. It is the base for the per-lane mode that @⁠gefydev's team is building on it (#1269). **What is in it** - `crates/xcl/src/gpu/dxil/`: - **Bitcode writer:** `bitstream.rs` and `module.rs` write LLVM 3.7 bitcode. Blocks are written in reverse post-order of the CFG, so a lowering may create blocks in any order; `replace_all_uses` is available. - **Cleanup passes:** `module/opt.rs` removes trivial phis, merges duplicate pure instructions along the dominator tree, and removes dead code. `XCL_DXIL_NO_OPT=phi,cse,dce|all` turns passes off for bisecting. There is no fast-math or float reassociation, and wave ops are only merged within one block. - **DXIL layer:** `shader.rs` and `ops.rs` cover dx.op calls, handles, resource metadata and shader flags. Every dx.op declaration's attributes are checked against DXC's table. The op library covers math, memory, atomics, typed/raw/structured buffers, textures/samplers, wave ops and derivatives. - **Graphics:** `graphics.rs` and `container.rs` write ISG1/OSG1/PSG1, PSV0 and the view-ID tables, and handle VS/PS/MS entries. The digest is computed in-tree and matches DXC byte for byte. - **Translator:** `cfg.rs`, `ssa.rs`, `lanes.rs`, `lower*.rs`, `kernel.rs`. It builds a CFG, constructs SSA on the fly, keeps lane masks and lowers every instruction, using the same EXEC model as the HLSL path. `Lw::inst_guarded` lets an external control-flow analysis reuse the per-instruction lowering. - **Coverage:** `coverage.rs` adds `xcl shaders <pack> --direct [--sample N] [--validate] [--compare]` to sweep a pack, and `XCL_DIRECT_DXIL_STATS=1` prints live fallback statistics at exit. - **Oracle:** `validate.rs` wraps DXC's validator and disassembler, used in tests only. With a validator older than 1.8 only the validation step is skipped. - **Hooks:** - `recomp/pso.rs`: routing with HLSL fallback, and a separate on-disk cache identity per backend and `TRANSLATOR_VERSION`. HLSL cache entries are unchanged. - `recomp/runner.rs`: test-only additions. - `recomp/tests.rs`: backend switch. - **Heap memory windows** (`XCL_HEAP_WINDOWS`, merged from main) are not translated yet; those shaders take the HLSL path. - **Fixed from reports in this thread:** - AMD driver crash: `!llvm.ident` is now emitted. - AMD's 64-bit `Bfrev` miscompile: halves are now reversed separately. - `WaveMultiPrefixBit*` is now signed, as DXC emits it. The unsigned form removed the device on RDNA4. - `waveGetLaneIndex` is readonly (@⁠Kalmarv). - VS/PS that branch before their exports (@⁠Kalmarv). - The fuzzer no longer emits groupshared `atomicrmw sub`, which NVIDIA rejects. - Validator 1.7 handling, and draw tests skip on CI/WARP. - Fixtures are in `tests/data/dxil/`. - The test validator wrapper refuses input shorter than a container header, because DXC 1.8 read past it (patch by @⁠upipibi, reported by @⁠DavidM1911). - Builder misuse is recorded as an error and falls back to HLSL. - **Irreducible console control flow.** The console compiler emits loops entered in the middle. The CFG builder now splits nodes until every loop has one entry, so the DXIL is reducible, as DXIL requires. If that would grow the CFG past 4×, the program falls back to HLSL. This is the cause of the `amdxc64.dll` fault HKEY-Funk-Machine isolated on `cs 62b584e061c05fc5`: release builds skip the validator, and NVIDIA tolerated the irreducible CFG. - `Countbits.i64` is emitted per 32-bit half, a workaround like the one for `Bfrev.i64`. - `XCL_DXIL_DUMP=<hash|all>` writes the direct DXIL of chosen programs. `xcl shaders --direct --hash <h> --dump <dir>` does the same in sweeps. - **Translation time:** a guarded region now merges only the registers it writes. On the sample, p50 is 29 ms, p95 0.38 s and max about 1 s, down from 64 ms / 1.6 s / 3.7 s. **Tested** - RTX 4090 (wave32 only), NVIDIA driver, Windows 11, Rust 1.96 MSVC, debug, DXC 1.9.2602.17 (test oracle only), head `81d2ad5a9d06`. - `cargo test --workspace -- --test-threads=4`: 858 passed, 0 failed, 42 ignored. SKIPPED GPU tests: `gpu_geometry_wave32_prefix_count_over_a_mask` (no wave64), `gpu_wave32_program_in_wave64_hardware` (no wave64), `heap_window_out_of_memory_falls_back_to_the_switch_form` (no heap windows). - `XCL_DIRECT_DXIL=1` and `=all`, `cargo test -p xcl --lib gpu::recomp`: 194 passed, 0 failed, 18 ignored each. Every kernel/compute/mesh/VS/PS test goes through the direct path, with no fallback in tests. - **Retail pack sample** (`xcl shaders shaders.rpf --direct --sample 200 --seed 1 --validate --compare`): | | before the fixes in this round | now | |---|---|---| | translated (all validator-clean) | 113 / 200 | 197 / 200 (the 3 left are ES+GS, not in this PR) | | translation time p50 / p95 | 605 ms / 10 s | 29 ms / 0.38 s | | size vs HLSL+DXC | 14.5× | 1.25× | - **Also checked:** - Signature and PSV0 parts match DXC byte for byte on 16+ references. - Randomised differential tests (2000 modules validated, about 1230 compared with a CPU interpreter on the GPU) ran on this code; they move to the stacked follow-up PR to keep this diff under GitHub's 20 000-line limit. - The same container is produced across runs and threads. - **Testers on this PR:** - **Kalmarv** (RTX 5070 Ti): whole suite with DXC 1.7 and 1.9; dxil.dll and dxil-spirv checks of 303 containers; smoke pairs. - **mastrr9** (RTX 5080). - **vitor127wt** (RTX 5070 Ti, Linux). - **ArturoWolff** (RTX 4060, Proton). - **emirduran707** (RX 9060 XT): no crash after `!llvm.ident`. - **HKEY-Funk-Machine** (RX 9070). - **SlopTart** (RX 7900 XT, RADV). **Regression run** The retail title, 60 s each, RTX 4090, release builds, back to back on an idle machine, `XCL_DIRECT_DXIL` unset, no uncommitted changes. PR (head `81d2ad5a9d06`): 97 % of main's frames, 111 % of its peak commit (one earlier run on this head stalled near its end on a busy machine, 1400 frames; the rerun on an idle machine is the block below), no crash or device removal. main: ``` xcl-smoke v1 commit: 9e3831e1f570d3646e53ab753b19ec07eb8f1485 gpu: NVIDIA GeForce RTX 4090 title: game seconds: 60 exit: 0x0 frames shown: 1590 (PresentX 1590) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 15360 MB ``` PR: ``` xcl-smoke v1 commit: 81d2ad5a9d06f6d11211f0c2524d5db9c3362bcf gpu: NVIDIA GeForce RTX 4090 title: game 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: 17128 MB ``` **Not tested** - **AMD:** the Bfrev and multi-prefix fixes come from testers' bisections and are not yet re-run on RDNA. The `amdxc64.dll` fault on one retail program is fixed (irreducible CFG, above) but not yet re-run on AMD. Fuzz seed 722 on RDNA4 looks like the driver moving a wave op into a divergent branch. RADV seeds 1003/1698 are a Mesa folding bug, traced in the thread. - **Hardware:** native wave64 hardware, and Intel. - **Direct path in a title** on this head (only the default path was smoke-tested here). - **Not in this PR:** geometry mode (ES+GS), MSAA, non-default f32 round modes, heap memory windows, and the randomised fuzz tests (kept out to stay under GitHub's 20 000-line diff limit). These exist on follow-up branches and will come as a stacked PR. **AI use** - Claude Code (Claude Opus 5.5): designed and wrote the code and tests (several coordinated agents), ran the suites, the sample sweep and the regression runs on the RTX 4090, and drafted this description. Written from scratch. The references are the LLVM 3.7 bitcode format and DXC (NCSA licence), plus DXC's output for small HLSL programs. No code from GPL-3 projects was used. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
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]>
xcl shaders <pack> --direct [--sample N] [--seed S] [--validate] [--compare]
runs the direct translator per program: per-stage translated / unsupported /
validator / panicked / timeout, a ranked histogram of failure reasons, time
p50/p95/max and DXIL size vs HLSL+DXC. pso.rs fallbacks log stage + reason
and feed a summary printed at exit with XCL_DIRECT_DXIL_STATS=1. First
200-record sample of shaders.rpf in docs/specs/direct-dxil-coverage.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The translator creates the exit block before the program's blocks and
wrote the epilogue into it. The module writer numbers values in block
order and refuses a reference to a later value outside a phi, so a
vertex or pixel shader whose exports come after a branch or a guarded
memory access failed with "direct DXIL builder error: forward reference
to value 128 at instruction 90 (blocks must be in dominance order)" and
the stage went to the HLSL path. The kernel epilogue was not affected:
its stores go into a guard block that is created last.

The epilogue now has a block of its own, created after the program's
blocks; the exit block keeps the phis and branches to it.

The test translates a vertex and a pixel shader that branch on s0
before their exports and compares their draws with the HLSL path's for
both directions of the branch.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
DXC 1.9.2609 declares dx.op.waveGetLaneIndex "nounwind readonly"
(DXC 1.7.2308 declared it readnone); the emitter declared it readnone.
dxil.dll 1.7.2308 and 1.9.2609 accept either, so this only brings the
declaration in line with current DXC output. The other dx.op
declarations already match DXC 1.9.2609's table.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The two commits before this one change the containers the direct
translator emits (an epilogue block of its own; waveGetLaneIndex
readonly), and kernel::TRANSLATOR_VERSION is part of the identity of
the translation disk cache: entries made by version 1 are not reused.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
The writer lays the entry's blocks out in reverse post-order of its CFG and
numbers values in that order, so a lowering may create blocks in any order
(requested for the per-lane mode). Unreachable blocks and their phi edges are
dropped. replace_all_uses rewrites instruction and metadata operands (e.g. to
remove trivial phis).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Bfrev.i64: reverse each 32-bit half and swap them. AMD's driver
  (amdxc64, RDNA3/4) writes the reversed low half into both halves for
  Bfrev.i64 (fuzz seeds 328, 662, 1206, 1599; also s_brev_b64).
- WaveMultiPrefixOp: bitwise ops (And/Or/Xor) always use sop = signed,
  as DXC does. sop = unsigned on BitXor removes the device on RDNA4
  in CreateComputePipelineState (wave_ops_match_cpu).
- half_precision_overloads_run: reduce a value that is not an FAbs.f16;
  the AMD driver drops FAbs.f16 feeding WaveActiveMax.f16 (DXC's DXIL
  for the HLSL fails the same way).
- shader::dxc_fn_attrs: the attributes DXC declares per opcode; Shader::op
  checks each declaration in debug builds, and dx_op_attrs_match_dxc checks
  every literal declaration in the backend.
- TRANSLATOR_VERSION 3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- module: write blocks in reverse postorder (unreachable ones dropped); the
  epilogue block was created before the program's blocks and read registers
  they define ("forward reference ... dominance order", 32 VS/PS programs).
  Globals and function declarations nothing references are not written
  (CS "Internal declaration 'xcl_xs' is unused").
- ssa: sealed joins read their operands first and only make a phi when the
  edges disagree or a loop comes back around (Braun et al.'s trivial phis):
  every join a read walked through used to get a phi per register.
- module/opt: Module::optimize before finishing: trivial phi removal, CSE
  (pure ops along the dominator tree, wave ops per block), DCE of pure values
  and flag-neutral dx.op calls. XCL_DXIL_NO_OPT=phi,cse,dce bisects.
- graphics: view-id control dependence from an immediate post-dominator tree
  instead of per-block post-dominator sets (quadratic time and memory).
- lower_gfx: SV_IsFrontFace declared uint.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	crates/xcl/src/gpu/dxil/core_tests.rs
#	crates/xcl/src/gpu/dxil/module.rs
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Heap memory windows (XCL_HEAP_WINDOWS) from main are not supported by the
direct translator yet: it refuses them, so those shaders take the HLSL path.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
DXC 1.8's validator reads a whole 32-byte header past the end of a shorter
blob starting with DXBC (b"DXBC" faulted in malformed_containers_are_errors).
Patch by upipibi, reported by DavidM1911.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The randomised differential tests (fuzz_tests.rs) move to the stacked
follow-up PR, and the working progress notes are dropped (the design doc and
the coverage doc stay). Past 20 000 changed lines GitHub returns files without
a patch, which the PR check reads as binaries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The console compiler emits loops entered in the middle (GTA VI CS
62b584e061c05fc5: 7 such loops). The direct path mapped them to DXIL as is,
which DXIL forbids ("Execution flow must be reducible"); release builds
skip the validator, so the container reached the driver and amdxc64
faulted at +0x6800a4 building it. Cfg::build now copies the multi-entry
region (minus its first entry) for the other entries until the CFG is
reducible, failing over to the HLSL path past 4x the block count.

Countbits.i64 is emitted as two i32 counts (AMD's i64 bit ops, see
Bfrev.i64; fuzz seed 1599 on RDNA4). TRANSLATOR_VERSION 4.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lw::guarded logs the registers its body writes; the join then merges just
those over both edges and every other register reads straight through the
guard's condition block. Reads no longer walk both edges of every guard
(thousands in long programs). Sample of 200 retail programs: p50 64 -> 29 ms,
p95 1.6 s -> 0.38 s, max 3.7 s -> 0.96 s; output 1.27x -> 1.25x HLSL+DXC.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:53:26 +00:00
github manually merged commit 81d2ad5a9d into gh-pr/1426/base 2026-11-26 04:53:27 +00:00
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 15:57 UTC · original

This overlaps with the direct DXIL work tracked in #1269. The two halves fit, so I'd rather build on this than finish a second writer.

What #1426 lists as future work is what gefydev/xcl recomp-lane-masks has:

  • Lane-mask analysis (gpu/recomp/lane_masks.rs). Each mask is followed as a per-lane boolean function, to work out which vector instructions still need an EXEC guard. On the retail pack, 25 695 of 26 698 programs are analysed and 37.1 % of 28.7 M vector instructions keep a guard, against 100 % today. It also exports the CFG and which branches are per-lane.
  • Lowering with per-lane control flow (gpu/recomp/ssa.rs, gpu/recomp/lower.rs). It keeps the console CFG, builds SSA over register dwords on the fly, and makes mask branches per-lane branches. It refuses, so the program falls back, where a mask written while some lanes were elsewhere is read after they meet again. Kernel and compute mode and memory are done. It writes through a small Ir trait, and its tests compare it with the HLSL path on the GPU: registers and memory agree (GTX 1650, wave32).

The proposal, also posted in #1269: this PR is the infrastructure, and I rebase onto it and implement the Ir trait on your module builder. The lowering then gives XCL_DIRECT_DXIL a per-lane mode as a follow-up on top of #1426, falling back to your per-instruction masking wherever the analysis refuses a program.

Two questions:

  1. Is module.rs / shader.rs meant as the API a second lowering can target? The Ir trait needs blocks, br / conditional br, phis with incoming values added later and trivial ones replaced, integer ops and compares, select, lane / thread / group ids, ballot, and raw buffer loads and stores.
  2. Would you take that per-lane mode as a follow-up PR once this one lands, or should it wait for review here first?

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 15:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7136882875) This overlaps with the direct DXIL work tracked in #1269. The two halves fit, so I'd rather build on this than finish a second writer. What #1426 lists as future work is what [`gefydev/xcl` `recomp-lane-masks`](https://github.com/gefydev/xcl/tree/recomp-lane-masks) has: - **Lane-mask analysis** (`gpu/recomp/lane_masks.rs`). Each mask is followed as a per-lane boolean function, to work out which vector instructions still need an EXEC guard. On the retail pack, 25 695 of 26 698 programs are analysed and 37.1 % of 28.7 M vector instructions keep a guard, against 100 % today. It also exports the CFG and which branches are per-lane. - **Lowering with per-lane control flow** (`gpu/recomp/ssa.rs`, `gpu/recomp/lower.rs`). It keeps the console CFG, builds SSA over register dwords on the fly, and makes mask branches per-lane branches. It refuses, so the program falls back, where a mask written while some lanes were elsewhere is read after they meet again. Kernel and compute mode and memory are done. It writes through a small `Ir` trait, and its tests compare it with the HLSL path on the GPU: registers and memory agree (GTX 1650, wave32). The proposal, also posted in #1269: this PR is the infrastructure, and I rebase onto it and implement the `Ir` trait on your module builder. The lowering then gives `XCL_DIRECT_DXIL` a per-lane mode as a follow-up on top of #1426, falling back to your per-instruction masking wherever the analysis refuses a program. Two questions: 1. Is `module.rs` / `shader.rs` meant as the API a second lowering can target? The `Ir` trait needs blocks, `br` / conditional `br`, phis with incoming values added later and trivial ones replaced, integer ops and compares, `select`, lane / thread / group ids, ballot, and raw buffer loads and stores. 2. Would you take that per-lane mode as a follow-up PR once this one lands, or should it wait for review here first? AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.
Author
Owner

@⁠mastrr9 on GitHub · 2026-11-24 16:04 UTC · original

RTX 5080 (Blackwell, wave32 / split-wave64) test report for head 065aef35c30f364d2a9be2431a1466cddf05e761 (Windows 11, DXC 1.9.2602.17, Rust MSVC, debug build, clean worktree):

  • cargo build --workspace: OK (0 new compiler warnings).
  • cargo test --workspace -- --test-threads=4: 768 passed, 4 failed, 23 ignored (stopped at xcl lib).
  • cargo test --workspace -- --test-threads=1: 768 passed, 4 failed, 23 ignored (identical deterministic failures).

gpu::dxil breakdown: 61 passed, 2 ignored, 4 failed — all four are deterministic fuzz seeds that pass validation and fail in the NVIDIA Blackwell driver at fuzz_tests.rs:1158:110 with GPU run: CreateComputePipelineState: Not enough memory resources are available (0x8007000E):

  • fuzz_tests::fuzz_validate_and_gpu_0 (seed 62)
  • fuzz_tests::fuzz_validate_and_gpu_1 (seed 545)
  • fuzz_tests::fuzz_validate_and_gpu_2 (seed 1019)
  • fuzz_tests::fuzz_validate_and_gpu_3 (seed 1507)

Happy to re-run on the RTX 5080 whenever a follow-up lands!

Not tested: AMD, Linux/Wine, retail smoke (scripts/smoke.ps1).
AI use: T3 Code (Antigravity / Claude Sonnet 5.5) built the worktree, ran both --test-threads=4 and --test-threads=1 on our RTX 5080, and drafted this report.

**@⁠mastrr9** on GitHub · 2026-11-24 16:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7137085855) RTX 5080 (Blackwell, wave32 / split-wave64) test report for head `065aef35c30f364d2a9be2431a1466cddf05e761` (Windows 11, DXC 1.9.2602.17, Rust MSVC, debug build, clean worktree): - `cargo build --workspace`: OK (0 new compiler warnings). - `cargo test --workspace -- --test-threads=4`: **768 passed, 4 failed, 23 ignored** (stopped at `xcl` lib). - `cargo test --workspace -- --test-threads=1`: **768 passed, 4 failed, 23 ignored** (identical deterministic failures). **`gpu::dxil` breakdown:** 61 passed, 2 ignored, **4 failed** — all four are deterministic fuzz seeds that pass validation and fail in the NVIDIA Blackwell driver at `fuzz_tests.rs:1158:110` with `GPU run: CreateComputePipelineState: Not enough memory resources are available (0x8007000E)`: - `fuzz_tests::fuzz_validate_and_gpu_0` (seed `62`) - `fuzz_tests::fuzz_validate_and_gpu_1` (seed `545`) - `fuzz_tests::fuzz_validate_and_gpu_2` (seed `1019`) - `fuzz_tests::fuzz_validate_and_gpu_3` (seed `1507`) Happy to re-run on the RTX 5080 whenever a follow-up lands! **Not tested:** AMD, Linux/Wine, retail smoke (`scripts/smoke.ps1`). **AI use:** T3 Code (Antigravity / Claude Sonnet 5.5) built the worktree, ran both `--test-threads=4` and `--test-threads=1` on our RTX 5080, and drafted this report.
Author
Owner

@⁠HKEY-Funk-Machine on GitHub · 2026-11-24 16:08 UTC · original

Test report: #1426 at 065aef3 on AMD RDNA4 (Windows): every GPU test of the emitted DXIL crashes the AMD driver

@⁠bmjask @⁠gefydev: an RDNA4 data point, since #1426 is now the base for the direct path. On this card, every DXIL container the backend emits crashes the AMD shader compiler (amdxc64.dll) on PSO creation. It reproduces from the PR's own tests, no game data needed.

Tested

  • RX 9070 (RDNA4, native wave64), AMD driver 32.0.32015.7029 · Ryzen 9 7945HX3D · 32 GB · Windows 11 Pro 26300 · Rust 1.100.0 · release · DXC 1.9.2602.17 (only as the test oracle)
  • Clean 065aef3 for the tests.

1. The PR's direct-DXIL tests, each run alone (xcl-*.exe --exact <test> --test-threads=1, all 67 tests under gpu::dxil):

  • 42 passed: every CPU-side test, including container::tests::digest_matches_dxc_signed_container and psv_matches_dxc_layout_for_compute_with_two_raw_uavs.
  • 25 crash the test process with 0xC0000005: every test that creates a pipeline from emitted DXIL and dispatches or draws it. That includes the smallest, tests::emitted_kernel_runs_on_the_gpu, plus all ops_tests::* (integer, float, wave, atomics, typed/raw buffers, textures, doubles, int64, half), all four fuzz_tests::fuzz_validate_and_gpu_*, graphics::tests::emitted_{vs_ps,ms_ps}_draw_a_triangle, emitted_ps_samples_a_texture_with_implicit_lod, emitted_ms_primitive_attribute_reaches_the_pixel_shader, and core_tests::direct_and_hlsl_graphics_stages_link.
  • cargo test --release -p xcl --lib -- gpu::dxil --test-threads=1 stops at the first of them (direct_and_hlsl_graphics_stages_link) with STATUS_ACCESS_VIOLATION.
  • Not counted: the rest of the workspace suite (not run on this tree).

2. Retail title, tree 065aef3 + #751 + #1288 + one local patch that skips InitializeApiImplEx2, XCL_NETWORK=0:

  • XCL_DIRECT_DXIL=1: crashes 3 s after start, 3 runs out of 3, always at amdxc64.dll+0x1ab0cf7 (read at 0x40), on three PSO threads at once. By then the direct path had translated only three compute programs, all tiny (128–368 B of console code, 12.5–35 KB of DXIL, wave64), with no HLSL fallbacks.
  • XCL_SPLIT_WAVE64=1 XCL_DIRECT_DXIL=1: same crash at the same address, so it is not the native-wave64 form.
  • Same build without XCL_DIRECT_DXIL: runs normally (410 compute PSOs in 60 s, no crash).

On @⁠Kalmarv's open question (the in-tree digest on AMD): D3D12 accepts the containers here. There is no E_INVALIDARG at PSO creation; the fault comes later, inside the driver's compiler. For comparison, @⁠mastrr9's RTX 5080 run above fails only the four fuzz_validate_and_gpu_* seeds (E_OUTOFMEMORY from the driver), where this card crashes on all 25 GPU tests.

So the digest matches DXC's, but something in the module or container that NVIDIA's compiler accepts makes AMD's crash, independent of the program and the wave size. I can run a build with more logging, or check a candidate fix on this card.

Not tested

  • Other AMD driver versions (emirduran707's RX 9060 XT runs 32.0.32029.2010, newer than mine), RDNA2/3, the debug layer's validator on the emitted containers, XCL_DIRECT_DXIL=all.
  • I added a local log line to name the translated programs in the title run; the tests above ran without it.

AI use: Claude Code (Claude Opus 5.5) built the trees, ran the tests and the title, classified the per-test results, and drafted this report.

**@⁠HKEY-Funk-Machine** on GitHub · 2026-11-24 16:08 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7137193329) **Test report: #1426 at `065aef3` on AMD RDNA4 (Windows): every GPU test of the emitted DXIL crashes the AMD driver** @⁠bmjask @⁠gefydev: an RDNA4 data point, since #1426 is now the base for the direct path. On this card, every DXIL container the backend emits crashes the AMD shader compiler (`amdxc64.dll`) on PSO creation. It reproduces from the PR's own tests, no game data needed. **Tested** - RX 9070 (RDNA4, native wave64), AMD driver 32.0.32015.7029 · Ryzen 9 7945HX3D · 32 GB · Windows 11 Pro 26300 · Rust 1.100.0 · release · DXC 1.9.2602.17 (only as the test oracle) - Clean `065aef3` for the tests. **1. The PR's direct-DXIL tests, each run alone** (`xcl-*.exe --exact <test> --test-threads=1`, all 67 tests under `gpu::dxil`): - **42 passed**: every CPU-side test, including `container::tests::digest_matches_dxc_signed_container` and `psv_matches_dxc_layout_for_compute_with_two_raw_uavs`. - **25 crash the test process with `0xC0000005`**: every test that creates a pipeline from emitted DXIL and dispatches or draws it. That includes the smallest, `tests::emitted_kernel_runs_on_the_gpu`, plus all `ops_tests::*` (integer, float, wave, atomics, typed/raw buffers, textures, doubles, int64, half), all four `fuzz_tests::fuzz_validate_and_gpu_*`, `graphics::tests::emitted_{vs_ps,ms_ps}_draw_a_triangle`, `emitted_ps_samples_a_texture_with_implicit_lod`, `emitted_ms_primitive_attribute_reaches_the_pixel_shader`, and `core_tests::direct_and_hlsl_graphics_stages_link`. - `cargo test --release -p xcl --lib -- gpu::dxil --test-threads=1` stops at the first of them (`direct_and_hlsl_graphics_stages_link`) with `STATUS_ACCESS_VIOLATION`. - Not counted: the rest of the workspace suite (not run on this tree). **2. Retail title**, tree `065aef3` + #751 + #1288 + one local patch that skips `InitializeApiImplEx2`, `XCL_NETWORK=0`: - `XCL_DIRECT_DXIL=1`: crashes **3 s** after start, 3 runs out of 3, always at `amdxc64.dll+0x1ab0cf7` (read at `0x40`), on three PSO threads at once. By then the direct path had translated only three compute programs, all tiny (128–368 B of console code, 12.5–35 KB of DXIL, wave64), with no HLSL fallbacks. - `XCL_SPLIT_WAVE64=1 XCL_DIRECT_DXIL=1`: same crash at the same address, so it is not the native-wave64 form. - Same build without `XCL_DIRECT_DXIL`: runs normally (410 compute PSOs in 60 s, no crash). On @⁠Kalmarv's open question (the in-tree digest on AMD): D3D12 accepts the containers here. There is no `E_INVALIDARG` at PSO creation; the fault comes later, inside the driver's compiler. For comparison, @⁠mastrr9's RTX 5080 run above fails only the four `fuzz_validate_and_gpu_*` seeds (`E_OUTOFMEMORY` from the driver), where this card crashes on all 25 GPU tests. So the digest matches DXC's, but something in the module or container that NVIDIA's compiler accepts makes AMD's crash, independent of the program and the wave size. I can run a build with more logging, or check a candidate fix on this card. **Not tested** - Other AMD driver versions (emirduran707's RX 9060 XT runs 32.0.32029.2010, newer than mine), RDNA2/3, the debug layer's validator on the emitted containers, `XCL_DIRECT_DXIL=all`. - I added a local log line to name the translated programs in the title run; the tests above ran without it. **AI use:** Claude Code (Claude Opus 5.5) built the trees, ran the tests and the title, classified the per-test results, and drafted this report.
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 16:10 UTC · original

@⁠HKEY-Funk-Machine @⁠bmjask a likely candidate for the AMD crash: #1426 never emits !llvm.ident (no occurrence in gpu/dxil/; Shader::finish writes dx.version, dx.valver, dx.shaderModel, dx.resources and dx.entryPoints only).

@⁠Sr-0w measured exactly this on an RX 7800 XT (Windows driver) while testing the text path (#1269, https://github.com/ivall/xcl/issues/1269#issuecomment-7136155748). A module without !llvm.ident validates and signs, but CreateComputePipelineState faults inside the AMD driver with an access violation instead of returning an error. Any value works, e.g. !llvm.ident = !{!0} / !0 = !{!"xcl"}. That fits what you see: it hits every container, whatever the program or wave size, and NVIDIA and WARP don't mind.

The fix to try is one named metadata node in Shader::finish, next to the others. With the builder's API, roughly:

let ident = m.md_str("xcl");
let node = m.md_node(&[Some(ident)]);
m.named_md("llvm.ident", &[node]);

I can't run it on AMD here (GTX 1650). @⁠HKEY-Funk-Machine, could you check tests::emitted_kernel_runs_on_the_gpu with that change on your RX 9070? If it isn't the cause, the shader flags are the next suspect: Sr-0w also found that they must match what the validator computes.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 16:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7137245930) @⁠HKEY-Funk-Machine @⁠bmjask a likely candidate for the AMD crash: **#1426 never emits `!llvm.ident`** (no occurrence in `gpu/dxil/`; `Shader::finish` writes `dx.version`, `dx.valver`, `dx.shaderModel`, `dx.resources` and `dx.entryPoints` only). @⁠Sr-0w measured exactly this on an RX 7800 XT (Windows driver) while testing the text path (#1269, https://github.com/ivall/xcl/issues/1269#issuecomment-7136155748). A module without `!llvm.ident` validates and signs, but `CreateComputePipelineState` faults inside the AMD driver with an access violation instead of returning an error. Any value works, e.g. `!llvm.ident = !{!0}` / `!0 = !{!"xcl"}`. That fits what you see: it hits every container, whatever the program or wave size, and NVIDIA and WARP don't mind. The fix to try is one named metadata node in `Shader::finish`, next to the others. With the builder's API, roughly: ```rust let ident = m.md_str("xcl"); let node = m.md_node(&[Some(ident)]); m.named_md("llvm.ident", &[node]); ``` I can't run it on AMD here (GTX 1650). @⁠HKEY-Funk-Machine, could you check `tests::emitted_kernel_runs_on_the_gpu` with that change on your RX 9070? If it isn't the cause, the shader flags are the next suspect: Sr-0w also found that they must match what the validator computes. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 16:11 UTC · original

@⁠Kalmarv thank you for the test report on 065aef3, and for asking the right question about the validator: the dx.valver 1.8 failures on DXC 1.7, the four fuzz seeds that the NVIDIA driver refuses, the clean smoke pair and the title run with XCL_DIRECT_DXIL=1 are all useful for what we build on top.

The size gap you measured (39.4 MB direct against 6.8 MB for the HLSL path in total, largest 14.7 MB) is what the per-lane mode on #1269 targets: it drops most of the per-instruction EXEC guards. On the retail pack the lane-mask analysis leaves 37.1 % of the vector instructions guarded.

AI use: Claude Code (Claude Opus 5.5) wrote this reply for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 16:11 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7137257118) @⁠Kalmarv thank you for the test report on `065aef3`, and for asking the right question about the validator: the `dx.valver` 1.8 failures on DXC 1.7, the four fuzz seeds that the NVIDIA driver refuses, the clean smoke pair and the title run with `XCL_DIRECT_DXIL=1` are all useful for what we build on top. The size gap you measured (39.4 MB direct against 6.8 MB for the HLSL path in total, largest 14.7 MB) is what the per-lane mode on #1269 targets: it drops most of the per-instruction EXEC guards. On the retail pack the lane-mask analysis leaves 37.1 % of the vector instructions guarded. AI use: Claude Code (Claude Opus 5.5) wrote this reply for @⁠gefydev.
Author
Owner

@⁠emirduran707 on GitHub · 2026-11-24 16:11 UTC · original

Root cause of the AMD crash above: the emitted module has no !llvm.ident. With it, the direct path runs on RDNA4.

@⁠bmjask @⁠gefydev, following @⁠HKEY-Funk-Machine's report: same crash here (amdxc64.dll 32.0.31044.16, 0xC0000005 at offset 0xf879d0, the same 25 gpu::dxil tests). I narrowed it down on tests::emitted_kernel_runs_on_the_gpu against DXC's output for the same program (testdata/dxc_cs_raw_uav.hlsl, compiled with cs_6_6, [WaveSize(64)]):

container result
DXC's runs
DXC's without HASH, or without STAT, signed with container::hash runs
emitted, plus a HASH part crashes
DXC's parts with the emitted DXIL part crashes
emitted parts with DXC's DXIL part runs
emitted IR (DXC disassembly) assembled by DXC's IDxcAssembler (#1373's assemble) crashes
same, function body replaced by DXC's crashes
DXC's IR, function body replaced by the emitted one runs
emitted IR plus !llvm.ident = !{!11}, !11 = !{!"xcl direct dxil"} runs

So the in-tree digest, the other parts and the bitcode writer are fine on AMD (SFI0/ISG1/OSG1/PSV0 are byte-identical to DXC's); only the missing named metadata llvm.ident crashes the driver's compiler, whatever string it holds. The difference between the two module headers is otherwise the declaration order (no effect) and dx.valver 1.8 / 1.9 (no effect).

With these three lines before m.named_md("dx.version", …) in both shader.rs and graphics.rs (local only, not pushed):

let ident = m.md_str("xcl direct dxil");
let ident = m.md_node(&[Some(ident)]);
m.named_md("llvm.ident", &[ident]);
  • nothing crashes any more
  • XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests: 118 passed, 0 failed; the same with XCL_DIRECT_DXIL=all: 118 passed, 0 failed
  • cargo test -p xcl --lib gpu::dxil (65 run, 2 ignored), the failing ones rerun alone: 59 pass; still failing on this card:
    • ops_tests::wave_ops_match_cpu: CreateComputePipelineState → 0x887A0005 (device removed); run together, the other GPU tests after it fail the same way
    • ops_tests::half_precision_overloads_run: got(0) (half max) 5.0, expected 10.5
    • fuzz_tests::fuzz_validate_and_gpu_0..3: GPU against CPU at seeds 328 (res[257] 0xe0000000 / 0x0), 662 (res[576] 0xf9999999 / 0xcccccccc), 1206 (res[320] 0xfffffffe / 0xfffffffc), 1599 (res[193] 0x1 / 0x0)

Tested

  • #1426 at 065aef35c30f364d2a9be2431a1466cddf05e761, clean except the three lines above for the second half
  • AMD Radeon RX 9060 XT (RDNA4), driver 32.0.31044.16, Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0, debug, DXC 1.9.2602.17 (as oracle)
  • without the change: default path cargo test --workspace -- --skip gpu::dxil: 750 passed, 0 failed, 41 ignored

Not tested

  • other AMD drivers, the title with XCL_DIRECT_DXIL=1 and the fix, NVIDIA with the fix (llvm.ident should be harmless there; DXC always writes it)

AI use: Claude Code (Claude Opus 5.5) ran the tests and the experiments and wrote this report.

**@⁠emirduran707** on GitHub · 2026-11-24 16:11 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7137253995) **Root cause of the AMD crash above: the emitted module has no `!llvm.ident`.** With it, the direct path runs on RDNA4. @⁠bmjask @⁠gefydev, following @⁠HKEY-Funk-Machine's report: same crash here (`amdxc64.dll` 32.0.31044.16, `0xC0000005` at offset `0xf879d0`, the same 25 `gpu::dxil` tests). I narrowed it down on `tests::emitted_kernel_runs_on_the_gpu` against DXC's output for the same program (`testdata/dxc_cs_raw_uav.hlsl`, compiled with `cs_6_6`, `[WaveSize(64)]`): | container | result | |---|---| | DXC's | runs | | DXC's without `HASH`, or without `STAT`, signed with `container::hash` | runs | | emitted, plus a `HASH` part | crashes | | DXC's parts with the emitted `DXIL` part | crashes | | emitted parts with DXC's `DXIL` part | runs | | emitted IR (DXC disassembly) assembled by DXC's `IDxcAssembler` (#1373's `assemble`) | crashes | | same, function body replaced by DXC's | crashes | | DXC's IR, function body replaced by the emitted one | runs | | emitted IR plus `!llvm.ident = !{!11}`, `!11 = !{!"xcl direct dxil"}` | **runs** | So the in-tree digest, the other parts and the bitcode writer are fine on AMD (`SFI0`/`ISG1`/`OSG1`/`PSV0` are byte-identical to DXC's); only the missing named metadata `llvm.ident` crashes the driver's compiler, whatever string it holds. The difference between the two module headers is otherwise the declaration order (no effect) and `dx.valver` 1.8 / 1.9 (no effect). **With these three lines before `m.named_md("dx.version", …)` in both `shader.rs` and `graphics.rs`** (local only, not pushed): ```rust let ident = m.md_str("xcl direct dxil"); let ident = m.md_node(&[Some(ident)]); m.named_md("llvm.ident", &[ident]); ``` - nothing crashes any more - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests`: **118 passed, 0 failed**; the same with `XCL_DIRECT_DXIL=all`: **118 passed, 0 failed** - `cargo test -p xcl --lib gpu::dxil` (65 run, 2 ignored), the failing ones rerun alone: 59 pass; still failing on this card: - `ops_tests::wave_ops_match_cpu`: `CreateComputePipelineState` → `0x887A0005` (device removed); run together, the other GPU tests after it fail the same way - `ops_tests::half_precision_overloads_run`: `got(0)` (half max) 5.0, expected 10.5 - `fuzz_tests::fuzz_validate_and_gpu_0..3`: GPU against CPU at seeds 328 (`res[257]` 0xe0000000 / 0x0), 662 (`res[576]` 0xf9999999 / 0xcccccccc), 1206 (`res[320]` 0xfffffffe / 0xfffffffc), 1599 (`res[193]` 0x1 / 0x0) **Tested** - #1426 at `065aef35c30f364d2a9be2431a1466cddf05e761`, clean except the three lines above for the second half - AMD Radeon RX 9060 XT (RDNA4), driver 32.0.31044.16, Ryzen 5 5600, Windows 11 Pro 26300, Rust 1.100.0, debug, DXC 1.9.2602.17 (as oracle) - without the change: default path `cargo test --workspace -- --skip gpu::dxil`: 750 passed, 0 failed, 41 ignored **Not tested** - other AMD drivers, the title with `XCL_DIRECT_DXIL=1` and the fix, NVIDIA with the fix (`llvm.ident` should be harmless there; DXC always writes it) AI use: Claude Code (Claude Opus 5.5) ran the tests and the experiments and wrote this report.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 16:13 UTC · original

Review notes on 065aef3, each shown with a local probe test (uncommitted, printing the validator's verdict and DXC's listing) under DXC 1.9.2609 and the SDK's 1.7.2308; no GPU needed.

  1. VS / PS with a branch or a memory load before their exports fall back to HLSL. kernel.rs:296 creates the exit block before the program's blocks, lower_gfx.rs:262-279 (finish_gfx) emits the bitcasts and storeOutput calls into it, and module.rs:884-888 asserts on a non-phi reference to a later value. With the VS and PS of core_tests::direct_and_hlsl_graphics_stages_link plus one forward S_CBRANCH_SCC1 or one GLOBAL_LOAD_DWORD before the exports: the direct DXIL translator panicked: forward reference to value 104 at instruction 70 (blocks must be in dominance order) (PS; VS: value 129 at 85). pso.rs:275-279 then takes the HLSL path, so under XCL_DIRECT_DXIL=all it is lost coverage, not a crash. Kernel mode translates the same branch.
  2. dx.valver is 1.8 (shader.rs:471-472, graphics.rs:918-919), which the Windows SDK's DXC 1.7.2308 refuses (Validator version in metadata (1.8) is not supported; maximum: (1.7)), even for an empty compute shader. kernel.rs:349-353 validates in test and debug builds, so with that DXC every direct translation returns Err there. The README still lists DXC 1.7 as usable.
  3. No !llvm.ident (shader.rs:503-509, graphics.rs:1008): DXC's output has !llvm.ident = !{!0}. Both validators accept it without; @⁠Sr-0w reports an RX 7800 XT faulting in CreateComputePipelineState without it (not tried here, no AMD card).
  4. dx.op.waveGetLaneIndex is readnone (shader.rs:335); DXC 1.9.2609 declares it readonly (1.7.2308 declared it readnone). dxil.dll 1.7 and 1.9 accept either. The other 71 dx.op declarations match DXC 1.9.2609's table in name and attribute.

Builder API only (the translator doesn't reach these at 065aef3):
5. Nine raw_uavs: DXC 1.9 says Flags must match usage. Flags declared=16, actual=32784; the "64 UAV slots" flag (bit 15) isn't in shader.rs:38-58.
6. Module::unreachable (module.rs:639-642): Instructions must be of an allowed type. at 'unreachable'.
7. shader.rs:15's data layout is used with Feature::NativeLowPrecision too; DXC with -enable-16bit-types writes …i16:16…f16:16…. DXC 1.9 accepts it anyway.

Not checked: AMD, mesh mode for point 1, DXC 1.8.

AI use: Claude Code (Claude Fable 5.2, Claude Opus 5.5)

**@⁠Kalmarv** on GitHub · 2026-11-24 16:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7137316935) Review notes on `065aef3`, each shown with a local probe test (uncommitted, printing the validator's verdict and DXC's listing) under DXC 1.9.2609 and the SDK's 1.7.2308; no GPU needed. 1. **VS / PS with a branch or a memory load before their exports fall back to HLSL.** `kernel.rs:296` creates the `exit` block before the program's blocks, `lower_gfx.rs:262-279` (`finish_gfx`) emits the bitcasts and `storeOutput` calls into it, and `module.rs:884-888` asserts on a non-phi reference to a later value. With the VS and PS of `core_tests::direct_and_hlsl_graphics_stages_link` plus one forward `S_CBRANCH_SCC1` or one `GLOBAL_LOAD_DWORD` before the exports: `the direct DXIL translator panicked: forward reference to value 104 at instruction 70 (blocks must be in dominance order)` (PS; VS: value 129 at 85). `pso.rs:275-279` then takes the HLSL path, so under `XCL_DIRECT_DXIL=all` it is lost coverage, not a crash. Kernel mode translates the same branch. 2. **`dx.valver` is 1.8** (`shader.rs:471-472`, `graphics.rs:918-919`), which the Windows SDK's DXC 1.7.2308 refuses (`Validator version in metadata (1.8) is not supported; maximum: (1.7)`), even for an empty compute shader. `kernel.rs:349-353` validates in test and debug builds, so with that DXC every direct translation returns `Err` there. The README still lists DXC 1.7 as usable. 3. **No `!llvm.ident`** (`shader.rs:503-509`, `graphics.rs:1008`): DXC's output has `!llvm.ident = !{!0}`. Both validators accept it without; @⁠Sr-0w reports an RX 7800 XT faulting in `CreateComputePipelineState` without it (not tried here, no AMD card). 4. **`dx.op.waveGetLaneIndex` is `readnone`** (`shader.rs:335`); DXC 1.9.2609 declares it `readonly` (1.7.2308 declared it `readnone`). `dxil.dll` 1.7 and 1.9 accept either. The other 71 `dx.op` declarations match DXC 1.9.2609's table in name and attribute. Builder API only (the translator doesn't reach these at `065aef3`): 5. Nine `raw_uav`s: DXC 1.9 says `Flags must match usage. Flags declared=16, actual=32784`; the "64 UAV slots" flag (bit 15) isn't in `shader.rs:38-58`. 6. `Module::unreachable` (`module.rs:639-642`): `Instructions must be of an allowed type. at 'unreachable'`. 7. `shader.rs:15`'s data layout is used with `Feature::NativeLowPrecision` too; DXC with `-enable-16bit-types` writes `…i16:16…f16:16…`. DXC 1.9 accepts it anyway. Not checked: AMD, mesh mode for point 1, DXC 1.8. AI use: Claude Code (Claude Fable 5.2, Claude Opus 5.5)
Author
Owner

@⁠thehollowedone on GitHub · 2026-11-24 16:14 UTC · original

One size opportunity on 065aef3. The current SSA builder can hand the bitcode writer phi nodes whose incoming values are identical once self-references are ignored.

In a scratch prototype I redirected those uses before assigning serialized value IDs and omitted the redundant phi records. The GPU loop fixture gpu_scalar_loop_and_scc dropped 65 phi nodes and still matched its expected results on an RTX 3080 Ti (621.35), Windows 11 build 26300, DXC 1.8.2502.11, Rust 1.99.1 MSVC. The prototype conservatively keeps cycles.

XCL_DIRECT_DXIL=1 cargo test --offline --locked -p xcl --lib gpu_scalar_loop_and_scc -- --nocapture --test-threads=1 passed 1/1. The broader DXIL test group did not pass on this setup. An isolated rerun of fuzz_validate_and_gpu_2 rejected seed 1495 with Flags must match usage on both the unchanged head and the prototype.

AI-assisted. Codex (GPT-6 family, exact variant unavailable) wrote the scratch prototype, ran the tests and drafted this report.

**@⁠thehollowedone** on GitHub · 2026-11-24 16:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7137337906) One size opportunity on [065aef3](https://github.com/ivall/xcl/commit/065aef35c30f364d2a9be2431a1466cddf05e761). The current SSA builder can hand the bitcode writer phi nodes whose incoming values are identical once self-references are ignored. In a scratch prototype I redirected those uses before assigning serialized value IDs and omitted the redundant phi records. The GPU loop fixture `gpu_scalar_loop_and_scc` dropped 65 phi nodes and still matched its expected results on an RTX 3080 Ti (621.35), Windows 11 build 26300, DXC 1.8.2502.11, Rust 1.99.1 MSVC. The prototype conservatively keeps cycles. `XCL_DIRECT_DXIL=1 cargo test --offline --locked -p xcl --lib gpu_scalar_loop_and_scc -- --nocapture --test-threads=1` passed 1/1. The broader DXIL test group did not pass on this setup. An isolated rerun of `fuzz_validate_and_gpu_2` rejected seed 1495 with `Flags must match usage` on both the unchanged head and the prototype. AI-assisted. Codex (GPT-6 family, exact variant unavailable) wrote the scratch prototype, ran the tests and drafted this report.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 16:10 UTC · original · edited 2026-11-24 16:15 UTC

Test report for 065aef3 on an RTX 5070 Ti (NVIDIA 610.74, 32-lane waves), AMD Ryzen 9 9950X, Windows 11 Pro 26200, as @⁠gefydev asked on #1269. I'll edit this comment as more runs finish.

Tests (debug, clean tree at 065aef3)

command Windows SDK DXC 1.7.2308 (XCL's default here) DXC 1.9.2609 (XCL_DXC_DIR)
cargo test -p xcl --lib gpu::dxil 14 passed, 51 failed, 2 ignored 61 passed, 4 failed, 2 ignored
XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests 40 passed, 78 failed, 17 ignored 118 passed, 0 failed, 17 ignored

SKIPPED in the second row, both DXCs: gpu_wave32_program_in_wave64_hardware, gpu_geometry_wave32_prefix_count_over_a_mask (no wave64).

  • With DXC 1.7, all 129 failures have one cause: the modules carry dx.valver 1.8 (gpu/dxil/shader.rs:471, gpu/dxil/graphics.rs:918), and the 1.7 validator refuses them: Validator version in metadata (1.8) is not supported; maximum: (1.7). None of them reaches the GPU.
  • With DXC 1.9, the 4 failures are fuzz_tests::fuzz_validate_and_gpu_0..3, each stopping at its first bad seed (62, 545, 1019, 1507): CreateComputePipelineState: Not enough memory resources are available to complete this operation. (0x8007000E) (fuzz_tests.rs:1158). The modules pass DXC 1.9's validator; the NVIDIA driver refuses them, the same seeds every run, also one test at a time with 38 GB of commit free.
    • Over all 2000 seeds, each run on its own: 1150 ran and matched the CPU, 768 are not run on the GPU by the fuzzer's own rule, and 82 fail this way. All 82 have an atomicrmw sub on group-shared memory, and none of the 1141 modules without one fails. It isn't the whole condition: 9 modules with atomicrmw sub ran and matched (5 of them subtract a constant 0).
    • The translator doesn't emit atomicrmw sub (lower_mem.rs:965-967 writes an add of the negated value; RmwOp::Sub is used only by fuzz_tests.rs:510), and DXC never does either. So this is a driver limit the fuzzer hits, not a path a title takes. Generating add of the negation in the fuzzer too would keep the test on the forms drivers see.
  • The emitted containers through dxil.dll: 303 containers dumped from these tests (gpu::dxil: 187 CS, 12 PS, 9 VS, 4 MS; the direct recompiler tests: 89 CS, 1 PS, 1 VS). dxil.dll 1.9's IDxcValidator accepts every one meant to be valid; the 11 it refuses are the ones double_unary_legality_matches_dxil_tables expects to be refused. dxil.dll 1.7 refuses all 303 for the validator version alone.
  • The same containers through dxil-spirv (2.79.0, the vkd3d-proton translator, run on Linux with --validate, with vkd3d-proton's compute options) and spirv-val (vulkan1.3): all 292 meant to be valid convert, and every SPIR-V passes spirv-val. VS / PS / MS (26 containers) pass everything. (One CS needs its typed RWBuffer at u3 left out of the root-descriptor option, and five with raw 64-bit loads need those options; neither is a container fault.) Not run inside vkd3d-proton or on a Vulkan driver.

Regression run (60 s each, scripts/smoke.ps1, release builds, no uncommitted changes; main at 930e8b4, this PR's base, then this PR's head; XCL_DIRECT_DXIL unset). 100 % of main's frames, 107 % of its peak commit.

main 930e8b4:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA VI
seconds: 60
exit: 0x0
frames shown: 1323 (PresentX 1323)
presents per 2 s (last 3): 14 18 47
device removals: 0
crashes: 0
peak commit: 26231 MB

this PR, 065aef3:

xcl-smoke v1
commit: 065aef35c30f364d2a9be2431a1466cddf05e761
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA VI
seconds: 60
exit: 0x0
frames shown: 1321 (PresentX 1321)
presents per 2 s (last 3): 47 54 13
device removals: 0
crashes: 0
peak commit: 28081 MB

Title run with XCL_DIRECT_DXIL=1 (the same head, title and 60 s; no main counterpart): 1269 frames, no crash or device removal, peak commit 26751 MB. The log has no direct DXIL … HLSL path line, and the DXIL sizes differ from the HLSL path's (the first two programs: 6600 and 6572 B without the switch, 12928 and 12900 B with it), so the 79 compute pipelines it built went through the direct path. Compared with the pair's run of the same head without the switch (102 compute pipelines, 13 of them from the driver's blobs of an earlier build):

DXIL size, median DXIL size, largest total DXIL pipeline creation, median / largest
HLSL path 23 KB 1.2 MB 6.8 MB 1 ms / 106 ms
direct path 73 KB 14.7 MB 39.4 MB 106 ms / 24.2 s

The sizes compare like for like. The times likely don't: the HLSL path's programs had been built by the driver in earlier runs on this machine (median 1 ms), while every direct one was new to it.

Not tested

  • AMD and Intel, native wave64, vkd3d-proton itself (only its dxil-spirv translator, above).
  • The whole suite (running now), and XCL_DIRECT_DXIL=all.
  • Driver times on a cold driver cache for both paths.

AI use: Claude Code (Claude Opus 5.5, Claude Fable 5.2)

**@⁠Kalmarv** on GitHub · 2026-11-24 16:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7137225721) · edited 2026-11-24 16:15 UTC Test report for `065aef3` on an RTX 5070 Ti (NVIDIA 610.74, 32-lane waves), AMD Ryzen 9 9950X, Windows 11 Pro 26200, as @⁠gefydev asked on #1269. I'll edit this comment as more runs finish. **Tests** (debug, clean tree at `065aef3`) | command | Windows SDK DXC 1.7.2308 (XCL's default here) | DXC 1.9.2609 (`XCL_DXC_DIR`) | |---|---|---| | `cargo test -p xcl --lib gpu::dxil` | 14 passed, 51 failed, 2 ignored | 61 passed, 4 failed, 2 ignored | | `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests` | 40 passed, 78 failed, 17 ignored | 118 passed, 0 failed, 17 ignored | SKIPPED in the second row, both DXCs: `gpu_wave32_program_in_wave64_hardware`, `gpu_geometry_wave32_prefix_count_over_a_mask` (no wave64). - **With DXC 1.7, all 129 failures have one cause:** the modules carry `dx.valver` 1.8 (`gpu/dxil/shader.rs:471`, `gpu/dxil/graphics.rs:918`), and the 1.7 validator refuses them: `Validator version in metadata (1.8) is not supported; maximum: (1.7)`. None of them reaches the GPU. - **With DXC 1.9, the 4 failures are `fuzz_tests::fuzz_validate_and_gpu_0..3`**, each stopping at its first bad seed (62, 545, 1019, 1507): `CreateComputePipelineState: Not enough memory resources are available to complete this operation. (0x8007000E)` (`fuzz_tests.rs:1158`). The modules pass DXC 1.9's validator; the NVIDIA driver refuses them, the same seeds every run, also one test at a time with 38 GB of commit free. - Over all 2000 seeds, each run on its own: 1150 ran and matched the CPU, 768 are not run on the GPU by the fuzzer's own rule, and **82 fail this way. All 82 have an `atomicrmw sub` on group-shared memory, and none of the 1141 modules without one fails.** It isn't the whole condition: 9 modules with `atomicrmw sub` ran and matched (5 of them subtract a constant 0). - The translator doesn't emit `atomicrmw sub` (`lower_mem.rs:965-967` writes an `add` of the negated value; `RmwOp::Sub` is used only by `fuzz_tests.rs:510`), and DXC never does either. So this is a driver limit the fuzzer hits, not a path a title takes. Generating `add` of the negation in the fuzzer too would keep the test on the forms drivers see. - **The emitted containers through `dxil.dll`:** 303 containers dumped from these tests (`gpu::dxil`: 187 CS, 12 PS, 9 VS, 4 MS; the direct recompiler tests: 89 CS, 1 PS, 1 VS). `dxil.dll` 1.9's `IDxcValidator` accepts every one meant to be valid; the 11 it refuses are the ones `double_unary_legality_matches_dxil_tables` expects to be refused. `dxil.dll` 1.7 refuses all 303 for the validator version alone. - **The same containers through dxil-spirv** (2.79.0, the vkd3d-proton translator, run on Linux with `--validate`, with vkd3d-proton's compute options) and spirv-val (vulkan1.3): all 292 meant to be valid convert, and every SPIR-V passes spirv-val. VS / PS / MS (26 containers) pass everything. (One CS needs its typed `RWBuffer` at u3 left out of the root-descriptor option, and five with raw 64-bit loads need those options; neither is a container fault.) Not run inside vkd3d-proton or on a Vulkan driver. **Regression run** (60 s each, `scripts/smoke.ps1`, release builds, no uncommitted changes; `main` at `930e8b4`, this PR's base, then this PR's head; `XCL_DIRECT_DXIL` unset). 100 % of `main`'s frames, 107 % of its peak commit. `main` `930e8b4`: ``` xcl-smoke v1 commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56 gpu: NVIDIA GeForce RTX 5070 Ti title: GTA VI seconds: 60 exit: 0x0 frames shown: 1323 (PresentX 1323) presents per 2 s (last 3): 14 18 47 device removals: 0 crashes: 0 peak commit: 26231 MB ``` this PR, `065aef3`: ``` xcl-smoke v1 commit: 065aef35c30f364d2a9be2431a1466cddf05e761 gpu: NVIDIA GeForce RTX 5070 Ti title: GTA VI seconds: 60 exit: 0x0 frames shown: 1321 (PresentX 1321) presents per 2 s (last 3): 47 54 13 device removals: 0 crashes: 0 peak commit: 28081 MB ``` **Title run with `XCL_DIRECT_DXIL=1`** (the same head, title and 60 s; no `main` counterpart): 1269 frames, no crash or device removal, peak commit 26751 MB. The log has no `direct DXIL … HLSL path` line, and the DXIL sizes differ from the HLSL path's (the first two programs: 6600 and 6572 B without the switch, 12928 and 12900 B with it), so the 79 compute pipelines it built went through the direct path. Compared with the pair's run of the same head without the switch (102 compute pipelines, 13 of them from the driver's blobs of an earlier build): | | DXIL size, median | DXIL size, largest | total DXIL | pipeline creation, median / largest | |---|---|---|---|---| | HLSL path | 23 KB | 1.2 MB | 6.8 MB | 1 ms / 106 ms | | direct path | 73 KB | 14.7 MB | 39.4 MB | 106 ms / 24.2 s | The sizes compare like for like. The times likely don't: the HLSL path's programs had been built by the driver in earlier runs on this machine (median 1 ms), while every direct one was new to it. **Not tested** - AMD and Intel, native wave64, vkd3d-proton itself (only its dxil-spirv translator, above). - The whole suite (running now), and `XCL_DIRECT_DXIL=all`. - Driver times on a cold driver cache for both paths. AI use: Claude Code (Claude Opus 5.5, Claude Fable 5.2)
Author
Owner

@⁠LucasHoepfner on GitHub · 2026-11-24 16:18 UTC · original

Test report for 065aef3 with DXC 1.8, the case @⁠Kalmarv's notes leave open: RTX 3060 Ti (Ampere, 32-lane waves), NVIDIA 621.01, Intel Core i7-14700KF, Windows 11 Pro 26200, rustc 1.99.1 MSVC, debug, clean tree. DXC is the Windows SDK 10.0.26100.0's dxcompiler / dxil 1.8.2502.11, XCL's default here.

gpu::dxil::validate::tests::malformed_containers_are_errors kills the whole lib test process with DXC 1.8 (0xc0000005, 3 of 3 runs alone). Every test after it in the binary then doesn't run. Running each of its five inputs alone (2 runs each): only b"DXBC" crashes, inside IDxcValidator::Validate. The other four pass, and Disassemble survives all of them. CI's DXC 1.9.2602.17 passes the test, so it looks like an out-of-bounds read in 1.8's validator on a buffer shorter than a container header. Dropping that input, or having validate() refuse anything shorter than the 32-byte header before it calls DXC, would keep 1.8 machines running the suite.

With that one test skipped (--skip malformed_containers_are_errors):

command result
cargo test -p xcl --lib gpu::dxil -- --test-threads=4 64 passed, 0 failed, 2 ignored
cargo test -p xcl --lib gpu::recomp::tests -- --test-threads=4 118 passed, 0 failed, 17 ignored
the same with XCL_DIRECT_DXIL=1 118 passed, 0 failed, 17 ignored
cargo test --workspace --no-fail-fast -- --test-threads=4 815 passed, 0 failed, 43 ignored

SKIPPED: gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware (no wave64).

  • DXC 1.8 accepts the modules' dx.valver 1.8, so none of 1.7's 129 failures happen here.
  • The fuzz seeds that @⁠Kalmarv's 5070 Ti refuses run on this card and match the CPU. 1 232 of the 2 000 seeds were run on the GPU here, all matching: the same 1 232 as the 1 150 + 82 of the 5070 Ti run (same generator, same rule for which seeds go to the GPU), so this includes all 82 with atomicrmw sub on group-shared memory. I checked the four first-failing seeds (62, 545, 1019, 1507) one by one with a local print in run_seeds. So the 0x8007000E refusal on the 5070 Ti and the 5080 looks specific to those Blackwell cards or their drivers, not to the modules.
  • XCL_DIRECT_DXIL=1 over all of gpu::recomp failed once in 26 runs, in gpu_sparse_vram_descriptors_buffers_and_xmem, with submit 1 lane 0 mismatch (0 vs 1077). That's the message of the order-dependent failure in #343, and it passes alone on both paths. The other 25 runs passed, as did 5 on the HLSL path, so I can't pin it on either path.

Not tested: a title or smoke run (I have no title), XCL_DIRECT_DXIL=all, release, AMD, native wave64.

AI use: Claude Code (Claude Opus 5.5) ran the tests and the probes and drafted this; I checked it before posting.

**@⁠LucasHoepfner** on GitHub · 2026-11-24 16:18 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7137466060) Test report for `065aef3` with **DXC 1.8**, the case @⁠Kalmarv's notes leave open: RTX 3060 Ti (Ampere, 32-lane waves), NVIDIA 621.01, Intel Core i7-14700KF, Windows 11 Pro 26200, rustc 1.99.1 MSVC, debug, clean tree. DXC is the Windows SDK 10.0.26100.0's `dxcompiler` / `dxil` 1.8.2502.11, XCL's default here. **`gpu::dxil::validate::tests::malformed_containers_are_errors` kills the whole lib test process with DXC 1.8** (`0xc0000005`, 3 of 3 runs alone). Every test after it in the binary then doesn't run. Running each of its five inputs alone (2 runs each): only `b"DXBC"` crashes, inside `IDxcValidator::Validate`. The other four pass, and `Disassemble` survives all of them. CI's DXC 1.9.2602.17 passes the test, so it looks like an out-of-bounds read in 1.8's validator on a buffer shorter than a container header. Dropping that input, or having `validate()` refuse anything shorter than the 32-byte header before it calls DXC, would keep 1.8 machines running the suite. With that one test skipped (`--skip malformed_containers_are_errors`): | command | result | |---|---| | `cargo test -p xcl --lib gpu::dxil -- --test-threads=4` | 64 passed, 0 failed, 2 ignored | | `cargo test -p xcl --lib gpu::recomp::tests -- --test-threads=4` | 118 passed, 0 failed, 17 ignored | | the same with `XCL_DIRECT_DXIL=1` | 118 passed, 0 failed, 17 ignored | | `cargo test --workspace --no-fail-fast -- --test-threads=4` | 815 passed, 0 failed, 43 ignored | SKIPPED: `gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu_wave32_program_in_wave64_hardware` (no wave64). - DXC 1.8 accepts the modules' `dx.valver` 1.8, so none of 1.7's 129 failures happen here. - **The fuzz seeds that @⁠Kalmarv's 5070 Ti refuses run on this card and match the CPU.** 1 232 of the 2 000 seeds were run on the GPU here, all matching: the same 1 232 as the 1 150 + 82 of the 5070 Ti run (same generator, same rule for which seeds go to the GPU), so this includes all 82 with `atomicrmw sub` on group-shared memory. I checked the four first-failing seeds (62, 545, 1019, 1507) one by one with a local print in `run_seeds`. So the `0x8007000E` refusal on the 5070 Ti and the 5080 looks specific to those Blackwell cards or their drivers, not to the modules. - `XCL_DIRECT_DXIL=1` over all of `gpu::recomp` failed once in 26 runs, in `gpu_sparse_vram_descriptors_buffers_and_xmem`, with `submit 1 lane 0 mismatch` (0 vs 1077). That's the message of the order-dependent failure in #343, and it passes alone on both paths. The other 25 runs passed, as did 5 on the HLSL path, so I can't pin it on either path. **Not tested:** a title or smoke run (I have no title), `XCL_DIRECT_DXIL=all`, release, AMD, native wave64. AI use: Claude Code (Claude Opus 5.5) ran the tests and the probes and drafted this; I checked it before posting.
Author
Owner

@⁠brainhay5 on GitHub · 2026-11-24 16:20 UTC · original

Adding the part @⁠Kalmarv's 60 s run could not reach: same card, same head (this PR merged onto 930e8b4, merge 53ae66b), XCL_DIRECT_DXIL=1, but 120 s with input (A every 3 s).

  • No [SHADER] direct DXIL: … – HLSL path line in the run, so no fallbacks.
  • The overlay's DXC counters read 0 running / 0 done throughout, so DXC was not invoked.
  • FPS 29.7 at 30 s → 7.9 at 60 s → 0.0 at 90 s, queue 57,793 → 58,712 → 57,889.

Then the usual end:

[100.649] unhandled exception 0xc0000005 in game_scarlett_master.exe+0x23cf683 (write at address 0x0)

Same fault, same point as the HLSL path on this title (100.6 s against ~98–103 s). So the switch is safe and does route compute away from DXC, but it does not move this title's stall.

@⁠Kalmarv's sizes explain why, and are the part of his report I would put first: the direct path's DXIL is 73 KB median / 14.7 MB largest / 39.4 MB total, against 23 KB / 1.2 MB / 6.8 MB on the HLSL path. The driver was already the bottleneck; being handed 3× the DXIL for the same work makes that side worse, which is exactly what the per-lane mode on recomp-lane-masks is meant to offset (37.1 % of vector instructions still guarded).

One request that would make live runs auditable: a success line per routed program, or an end-of-run count ("N compute programs direct, M fell back"). With zero fallbacks and no success line, "the switch reached the PSO path" and "the switch never applied" are indistinguishable in the log — Kalmarv and I both had to infer it from DXIL sizes.

Not tested: XCL_DIRECT_DXIL=all, AMD, wave64, cold driver cache.

AI use: OpenCode, DeepSeek V4.1 Flash 1017.

**@⁠brainhay5** on GitHub · 2026-11-24 16:20 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7137505292) Adding the part @⁠Kalmarv's 60 s run could not reach: same card, same head (this PR merged onto `930e8b4`, merge `53ae66b`), `XCL_DIRECT_DXIL=1`, but **120 s with input** (A every 3 s). - No `[SHADER] direct DXIL: … – HLSL path` line in the run, so no fallbacks. - The overlay's DXC counters read **0 running / 0 done** throughout, so DXC was not invoked. - FPS 29.7 at 30 s → 7.9 at 60 s → 0.0 at 90 s, queue 57,793 → 58,712 → 57,889. Then the usual end: ``` [100.649] unhandled exception 0xc0000005 in game_scarlett_master.exe+0x23cf683 (write at address 0x0) ``` Same fault, same point as the HLSL path on this title (100.6 s against ~98–103 s). So the switch is safe and does route compute away from DXC, but it does not move this title's stall. @⁠Kalmarv's sizes explain why, and are the part of his report I would put first: the direct path's DXIL is **73 KB median / 14.7 MB largest / 39.4 MB total**, against **23 KB / 1.2 MB / 6.8 MB** on the HLSL path. The driver was already the bottleneck; being handed 3× the DXIL for the same work makes that side worse, which is exactly what the per-lane mode on `recomp-lane-masks` is meant to offset (37.1 % of vector instructions still guarded). **One request that would make live runs auditable:** a success line per routed program, or an end-of-run count ("N compute programs direct, M fell back"). With zero fallbacks and no success line, "the switch reached the PSO path" and "the switch never applied" are indistinguishable in the log — Kalmarv and I both had to infer it from DXIL sizes. **Not tested:** `XCL_DIRECT_DXIL=all`, AMD, wave64, cold driver cache. AI use: OpenCode, DeepSeek V4.1 Flash 1017.
Author
Owner

@⁠Sr-0w on GitHub · 2026-11-24 16:22 UTC · original

AMD Windows results for this PR: native wave64 tests and a retail title run. Tested on an RX 7800 XT (RDNA3, native wave64) with the AMD Windows driver, Windows 11 26300 and DXC 1.9.2602.17, at the PR head 065aef3. Counts and timings only.

1. On AMD, every container without !llvm.ident crashes CreateComputePipelineState.
XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu:: exits with STATUS_ACCESS_VIOLATION in the first test that builds a pipeline (direct_and_hlsl_graphics_stages_link). The fault is inside the AMD driver, not an error code. The validator accepts these modules; DXC always writes the metadata, the writer here never does. I hit the same thing with modules assembled from IR text (#1373). Adding it fixes the crash:

--- a/crates/xcl/src/gpu/dxil/shader.rs   (and the same in graphics.rs)
@@ impl Shader {
         let entry = m.md_node(&[Some(fmd), Some(name), None, resources, Some(props_node)]);
 
+        // The AMD Windows driver faults in pipeline creation on a module without one (DXC always writes it)
+        let ident = m.md_str("xcl");
+        let ident = m.md_node(&[Some(ident)]);
+        m.named_md("llvm.ident", &[ident]);
         m.named_md("dx.version", &[dx_version]);

2. With that change, native wave64 and the in-tree digest work on AMD.

  • XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests: 118 passed, 0 failed, 17 ignored. Every kernel, compute, mesh, VS and PS test goes through the direct path on native 64-lane waves, the path the description lists as not run.
  • The AMD driver accepts containers carrying the in-tree digest (@⁠Kalmarv's question in #1269). digest_matches_dxc_signed_container passes, and so does every test above.

3. gpu::dxil tests that fail on AMD, with the !llvm.ident change and --test-threads=1:

  • fuzz_validate_and_gpu_0 to _3: the GPU differs from the CPU interpreter at seeds 328 (res[257] 0xe0000000 vs 0x0), 662 (res[576] 0xf9999999 vs 0xcccccccc), 1206 (res[320] 0xfffffffe vs 0xfffffffc) and 1599 (res[193] 0x1 vs 0x0). All of them use i64 / f64 / f16 constants and phis.
  • ops_tests::half_precision_overloads_run: the f16 WaveActiveMax gives 5.0 where 10.5 (the max over the 32 lanes) is expected.
  • ops_tests::wave_ops_match_cpu: on its own, it removes the device (0x887A0005 at the next CreateComputePipelineState).

4. The translated-shader disk cache serves the HLSL path's DXIL under XCL_DIRECT_DXIL=1.
The cache identity (identity_for(XCL_TRANSLATOR_SOURCE_ID, toolchain)) does not include the mode. My first title run with XCL_DIRECT_DXIL=1 wrote 2 new entries and read the other compute programs from entries of earlier HLSL runs. The reverse happens too: turning the variable off keeps serving direct DXIL. Fix: put the mode in the identity. Workaround: XCL_TRANSLATED_CACHE=0.

5. Retail title, world load.
Both runs use the same binary (this PR + item 1), XCL_NETWORK=0, XCL_TRANSLATED_CACHE=0, and the same scripted input (A every 15 s, 300 s).

HLSL path XCL_DIRECT_DXIL=1
compute programs that fell back to HLSL – 0
fps to ~70 s 24 → 30 25 → 30
outcome title watchdog (+0x23cf683) at 143 s title watchdog at 145 s
largest compute DXIL 1.09 MB 11.32 MB
slowest driver build 98.1 s (1.09 MB, after DXC) 65.0 s (11.32 MB, no DXC)
total DXIL of fresh driver builds 2.7 MB 22.3 MB
fresh driver builds over 5 s 2 5

The direct path removes DXC (about 24 s on this size of program at -O1, not counted in the driver column). It also builds the largest program faster in the AMD driver than the HLSL path does, despite 10× the DXIL: 65 s against 98 s. But with per-instruction EXEC masking and no optimisation, the giant programs are 10× larger, and the run still stops at the same point: frames fall to ~9 fps, then the title's watchdog fires at about 145 s with a title thread waiting on a compute pipeline. That is the case for the per-lane lowering in #1269 (gefydev's recomp-lane-masks), which drops about 63 % of the guards on the pack. I'll rerun this table when that lowering produces DXIL through this writer.

AI use: Claude Code (Claude Opus 5.5) ran the tests and the title runs, and wrote this.

**@⁠Sr-0w** on GitHub · 2026-11-24 16:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7137569773) AMD Windows results for this PR: native wave64 tests and a retail title run. Tested on an RX 7800 XT (RDNA3, native wave64) with the AMD Windows driver, Windows 11 26300 and DXC 1.9.2602.17, at the PR head `065aef3`. Counts and timings only. **1. On AMD, every container without `!llvm.ident` crashes `CreateComputePipelineState`.** `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::` exits with `STATUS_ACCESS_VIOLATION` in the first test that builds a pipeline (`direct_and_hlsl_graphics_stages_link`). The fault is inside the AMD driver, not an error code. The validator accepts these modules; DXC always writes the metadata, the writer here never does. I hit the same thing with modules assembled from IR text (#1373). Adding it fixes the crash: ```diff --- a/crates/xcl/src/gpu/dxil/shader.rs (and the same in graphics.rs) @@ impl Shader { let entry = m.md_node(&[Some(fmd), Some(name), None, resources, Some(props_node)]); + // The AMD Windows driver faults in pipeline creation on a module without one (DXC always writes it) + let ident = m.md_str("xcl"); + let ident = m.md_node(&[Some(ident)]); + m.named_md("llvm.ident", &[ident]); m.named_md("dx.version", &[dx_version]); ``` **2. With that change, native wave64 and the in-tree digest work on AMD.** - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests`: 118 passed, 0 failed, 17 ignored. Every kernel, compute, mesh, VS and PS test goes through the direct path on native 64-lane waves, the path the description lists as not run. - The AMD driver accepts containers carrying the in-tree digest (@⁠Kalmarv's question in #1269). `digest_matches_dxc_signed_container` passes, and so does every test above. **3. `gpu::dxil` tests that fail on AMD**, with the `!llvm.ident` change and `--test-threads=1`: - `fuzz_validate_and_gpu_0` to `_3`: the GPU differs from the CPU interpreter at seeds 328 (`res[257]` 0xe0000000 vs 0x0), 662 (`res[576]` 0xf9999999 vs 0xcccccccc), 1206 (`res[320]` 0xfffffffe vs 0xfffffffc) and 1599 (`res[193]` 0x1 vs 0x0). All of them use i64 / f64 / f16 constants and phis. - `ops_tests::half_precision_overloads_run`: the f16 `WaveActiveMax` gives 5.0 where 10.5 (the max over the 32 lanes) is expected. - `ops_tests::wave_ops_match_cpu`: on its own, it removes the device (`0x887A0005` at the next `CreateComputePipelineState`). **4. The translated-shader disk cache serves the HLSL path's DXIL under `XCL_DIRECT_DXIL=1`.** The cache identity (`identity_for(XCL_TRANSLATOR_SOURCE_ID, toolchain)`) does not include the mode. My first title run with `XCL_DIRECT_DXIL=1` wrote 2 new entries and read the other compute programs from entries of earlier HLSL runs. The reverse happens too: turning the variable off keeps serving direct DXIL. Fix: put the mode in the identity. Workaround: `XCL_TRANSLATED_CACHE=0`. **5. Retail title, world load.** Both runs use the same binary (this PR + item 1), `XCL_NETWORK=0`, `XCL_TRANSLATED_CACHE=0`, and the same scripted input (A every 15 s, 300 s). | | HLSL path | `XCL_DIRECT_DXIL=1` | |---|---|---| | compute programs that fell back to HLSL | – | **0** | | fps to ~70 s | 24 → 30 | 25 → 30 | | outcome | title watchdog (`+0x23cf683`) at 143 s | title watchdog at 145 s | | largest compute DXIL | 1.09 MB | **11.32 MB** | | slowest driver build | 98.1 s (1.09 MB, after DXC) | 65.0 s (11.32 MB, no DXC) | | total DXIL of fresh driver builds | 2.7 MB | 22.3 MB | | fresh driver builds over 5 s | 2 | 5 | The direct path removes DXC (about 24 s on this size of program at `-O1`, not counted in the driver column). It also builds the largest program faster in the AMD driver than the HLSL path does, despite 10× the DXIL: 65 s against 98 s. But with per-instruction EXEC masking and no optimisation, the giant programs are 10× larger, and the run still stops at the same point: frames fall to ~9 fps, then the title's watchdog fires at about 145 s with a title thread waiting on a compute pipeline. That is the case for the per-lane lowering in #1269 (gefydev's `recomp-lane-masks`), which drops about 63 % of the guards on the pack. I'll rerun this table when that lowering produces DXIL through this writer. AI use: Claude Code (Claude Opus 5.5) ran the tests and the title runs, and wrote this.
Author
Owner

@⁠bmjask on GitHub · 2026-11-24 16:37 UTC · original

Thanks for the reports, all of them were actionable. Head is now bc93a3a6f1d5:

  • AMD crash: !llvm.ident = !{!"xcl"} is now emitted by every finish path (thanks @⁠gefydev for the pointer). @⁠HKEY-Funk-Machine, could you re-run tests::emitted_kernel_runs_on_the_gpu and the gpu::dxil GPU tests on the RX 9070, and the title with XCL_DIRECT_DXIL=1 if those pass?
  • DXC 1.7 (@⁠Kalmarv): we keep dx.valver 1.8, because PSV0's entry-name record needs validator 1.8+. With an older validator, tests now skip only the validation step and print SKIPPED … validator X.Y < 1.8 (checked with SDK DXC 1.6). The runtime never uses the validator.
  • Fuzz E_OUTOFMEMORY (@⁠mastrr9, @⁠Kalmarv): thanks for isolating atomicrmw sub across all 2000 seeds. The fuzzer now emits add-of-negation, as DXC and the translator do. Seed numbering is unchanged.
  • Size and PSO time: acknowledged in the description. The faithful model without DXC's optimiser makes large modules. Cleanup passes are in progress, and the per-lane mode is the structural fix, so the switch stays opt-in.
  • Regression run: @⁠Kalmarv, if you can, a fresh smoke.ps1 block on bc93a3a6f1d5 (and main) would let the check pass. Otherwise I'll post one.

@⁠gefydev, on your two questions:

  1. Yes. module.rs / shader.rs are meant as a target for a second lowering, and the signatures you listed stay stable (phi/phi_at/add_incoming, blocks/br/cond_br, int ops/cmp/select, ids, wave_ballot, raw_uav/raw_load/raw_store, finish…). Anything that would change them gets a ping first. Trivial phi replacement isn't in the builder yet; tell me the shape you want and I'll add it additively.
  2. Yes, please send the per-lane mode as a stacked follow-up once this lands. To reuse the instruction semantics, Lw::inst_guarded(d, guard, mask) (commit 86ab4cd) lowers one non-branch instruction under an i1 guard you choose: it decides VGPR write selects and guarded memory, and a constant true folds away. The optional mask is the wave-wide mask cross-lane ops see (DPP, readfirstlane, ds_swizzle, bpermute); if omitted they read the SSA EXEC. EXEC-writing instructions still update the SSA EXEC (s126/s127). Lw is currently built inside kernel.rs per entry. If you want to own the block walk, I can split out a constructor/epilogue here or you can do it in your PR, whichever you prefer.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠bmjask.

**@⁠bmjask** on GitHub · 2026-11-24 16:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7137965648) Thanks for the reports, all of them were actionable. Head is now `bc93a3a6f1d5`: - **AMD crash:** `!llvm.ident = !{!"xcl"}` is now emitted by every finish path (thanks @⁠gefydev for the pointer). @⁠HKEY-Funk-Machine, could you re-run `tests::emitted_kernel_runs_on_the_gpu` and the `gpu::dxil` GPU tests on the RX 9070, and the title with `XCL_DIRECT_DXIL=1` if those pass? - **DXC 1.7 (@⁠Kalmarv):** we keep `dx.valver` 1.8, because PSV0's entry-name record needs validator 1.8+. With an older validator, tests now skip only the validation step and print `SKIPPED … validator X.Y < 1.8` (checked with SDK DXC 1.6). The runtime never uses the validator. - **Fuzz `E_OUTOFMEMORY` (@⁠mastrr9, @⁠Kalmarv):** thanks for isolating `atomicrmw sub` across all 2000 seeds. The fuzzer now emits add-of-negation, as DXC and the translator do. Seed numbering is unchanged. - **Size and PSO time:** acknowledged in the description. The faithful model without DXC's optimiser makes large modules. Cleanup passes are in progress, and the per-lane mode is the structural fix, so the switch stays opt-in. - **Regression run:** @⁠Kalmarv, if you can, a fresh `smoke.ps1` block on `bc93a3a6f1d5` (and main) would let the check pass. Otherwise I'll post one. @⁠gefydev, on your two questions: 1. Yes. `module.rs` / `shader.rs` are meant as a target for a second lowering, and the signatures you listed stay stable (`phi`/`phi_at`/`add_incoming`, blocks/`br`/`cond_br`, int ops/`cmp`/`select`, ids, `wave_ballot`, `raw_uav`/`raw_load`/`raw_store`, `finish`…). Anything that would change them gets a ping first. Trivial phi replacement isn't in the builder yet; tell me the shape you want and I'll add it additively. 2. Yes, please send the per-lane mode as a stacked follow-up once this lands. To reuse the instruction semantics, `Lw::inst_guarded(d, guard, mask)` (commit 86ab4cd) lowers one non-branch instruction under an i1 guard you choose: it decides VGPR write selects and guarded memory, and a constant `true` folds away. The optional `mask` is the wave-wide mask cross-lane ops see (DPP, readfirstlane, ds_swizzle, bpermute); if omitted they read the SSA EXEC. EXEC-writing instructions still update the SSA EXEC (s126/s127). `Lw` is currently built inside `kernel.rs` per entry. If you want to own the block walk, I can split out a constructor/epilogue here or you can do it in your PR, whichever you prefer. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠bmjask.
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 16:39 UTC · original

@⁠bmjask thanks for the answers and for the fixes. inst_guarded(d, guard, mask) is exactly the reuse we wanted: the per-lane mode keeps the console CFG with per-lane branches and the lane-mask analysis, and lowers every non-branch instruction through inst_guarded with the analysis's guard (true where EXEC is proven, which folds away), instead of reimplementing the instruction semantics.

Answers:

  • (a) Trivial-phi replacement: Module::replace_all_uses(old: Value, new: Value), rewriting every operand and every phi incoming that is old, and removing old from its block when it is a phi. Our SSA construction calls it with old a phi it found trivial, and new dominates every use. Additive is perfect.
  • (b) Constructor / epilogue split: yes please, on your side, so #1426 stays coherent. Our DxilIr will then hold an Lw built by it.
  • (c) We rebase direct-on-1426 onto bc93a3a6f1d5 and drop our own !llvm.ident commit now that yours is in. The per-lane mode comes as a stacked follow-up once #1426 lands, as you said.

AI use: Claude Code (Claude Opus 5.5) wrote this reply for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 16:39 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138003616) @⁠bmjask thanks for the answers and for the fixes. `inst_guarded(d, guard, mask)` is exactly the reuse we wanted: the per-lane mode keeps the console CFG with per-lane branches and the lane-mask analysis, and lowers every non-branch instruction through `inst_guarded` with the analysis's guard (`true` where EXEC is proven, which folds away), instead of reimplementing the instruction semantics. Answers: - **(a) Trivial-phi replacement:** `Module::replace_all_uses(old: Value, new: Value)`, rewriting every operand and every phi incoming that is `old`, and removing `old` from its block when it is a phi. Our SSA construction calls it with `old` a phi it found trivial, and `new` dominates every use. Additive is perfect. - **(b) Constructor / epilogue split:** yes please, on your side, so #1426 stays coherent. Our `DxilIr` will then hold an `Lw` built by it. - **(c)** We rebase `direct-on-1426` onto `bc93a3a6f1d5` and drop our own `!llvm.ident` commit now that yours is in. The per-lane mode comes as a stacked follow-up once #1426 lands, as you said. AI use: Claude Code (Claude Opus 5.5) wrote this reply for @⁠gefydev.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 16:42 UTC · original

@⁠bmjask a pair on bc93a3a6f1d5 and its main base is queued here (RTX 5070 Ti) behind one run now in progress. I'll post both blocks in this thread when it's done.

**@⁠Kalmarv** on GitHub · 2026-11-24 16:42 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138081320) @⁠bmjask a pair on `bc93a3a6f1d5` and its `main` base is queued here (RTX 5070 Ti) behind one run now in progress. I'll post both blocks in this thread when it's done.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-24 16:43 UTC · original

Ran the XCL_DIRECT_DXIL backend on Linux/Wine with a native wave64 card. The backend itself lands well: the whole gpu::dxil::graphics family and nearly all gpu::dxil::ops_tests pass here. Two failures, one of which is not this PR's fault.

1. Hard kill in gpu::dxil::ops_tests::integer_ops_match_cpu - the old vendored dxil-spirv, not the backend. The lib test binary dies with no panic (wine exit 3); Wine SEH shows err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix call, i.e. the access violation lands inside the Vulkan driver call while the pipeline is being created. Deterministic: 5/5 across runs, reproduces single-threaded, and still crashes under RADV_DEBUG=llvm, so it is not an ACO bug. A/B against the vendored pin: vkd3d-proton v3.1's dxil-spirv pin 8b48f0e0 crashes 5/5, master's pin 7c048638 passes 2/2 cold. This is the same crash family as #1246 on this rig; the fix commit named there (71967a38 "Rewrite the structurizer from scratch.") sits between those pins, so the same vendored bump should clear it here too.

2. Fuzz seeds disagree with the CPU interpreter on wave64. gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_2 and fuzz_validate_and_gpu_3 fail at crates/xcl/src/gpu/dxil/fuzz_tests.rs:1162: seed 1003 gives res[713] = 0x1, interpreter expects 0x0; seed 1698 gives res[0] = 0x1, expects 0x0. These fail identically with both the v3.1 and master vkd3d builds, so the dxil-spirv pin is not involved - it is a GPU-vs-CPU semantic mismatch of the emitted DXIL on this card (RDNA3, native wave64). Counts only, no game data; the seeds and disassembly are in the panic output. Worth a check on an NVIDIA row to see whether wave32 sees the same seeds.

Method note: vkd3d-proton's pipeline cache vkd3d-proton.cache is written relative to the test cwd and silently skips compilation on later runs; every A/B above deleted it before each trial (see my cache note in #1246).

Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, XCL_NETWORK=0, release profile. See my Linux rows in #42 / #718.

AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-24 16:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138112990) Ran the XCL_DIRECT_DXIL backend on Linux/Wine with a native wave64 card. The backend itself lands well: the whole `gpu::dxil::graphics` family and nearly all `gpu::dxil::ops_tests` pass here. Two failures, one of which is not this PR's fault. **1. Hard kill in `gpu::dxil::ops_tests::integer_ops_match_cpu` - the old vendored dxil-spirv, not the backend.** The lib test binary dies with no panic (wine exit 3); Wine SEH shows `err:vulkan:vkCreateComputePipelines Exception 0xc0000005 in Unix call`, i.e. the access violation lands inside the Vulkan driver call while the pipeline is being created. Deterministic: 5/5 across runs, reproduces single-threaded, and still crashes under `RADV_DEBUG=llvm`, so it is not an ACO bug. A/B against the vendored pin: vkd3d-proton v3.1's dxil-spirv pin `8b48f0e0` crashes 5/5, master's pin `7c048638` passes 2/2 cold. This is the same crash family as #1246 on this rig; the fix commit named there (`71967a38` "Rewrite the structurizer from scratch.") sits between those pins, so the same vendored bump should clear it here too. **2. Fuzz seeds disagree with the CPU interpreter on wave64.** `gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_2` and `fuzz_validate_and_gpu_3` fail at `crates/xcl/src/gpu/dxil/fuzz_tests.rs:1162`: seed 1003 gives `res[713] = 0x1`, interpreter expects `0x0`; seed 1698 gives `res[0] = 0x1`, expects `0x0`. These fail identically with both the v3.1 and master vkd3d builds, so the dxil-spirv pin is not involved - it is a GPU-vs-CPU semantic mismatch of the emitted DXIL on this card (RDNA3, native wave64). Counts only, no game data; the seeds and disassembly are in the panic output. Worth a check on an NVIDIA row to see whether wave32 sees the same seeds. Method note: vkd3d-proton's pipeline cache `vkd3d-proton.cache` is written relative to the test cwd and silently skips compilation on later runs; every A/B above deleted it before each trial (see my cache note in #1246). Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, `XCL_NETWORK=0`, release profile. See my Linux rows in #42 / #718. AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
Author
Owner

@⁠Icey-Glitch on GitHub · 2026-11-24 16:43 UTC · original

AI disclaimer: this was written with Claude Code (Claude Opus 5.5), which compared this PR against another codebase of mine that optimises DXIL, to look for ideas that could carry over here. It's based on reading the code only; nothing here was built or measured.

Some suggestions on output size (the ~3x / 13.6x vs DXC noted in the description), from reading the code. I haven't built this or measured where the size goes, so the order is a guess.

Cheap passes that would probably pay off

  1. Trivial phi removal. ssa.rs follows Braun et al., but I don't see the paper's tryRemoveTrivialPhi step. Every read in an unsealed block (loop headers etc.) creates a phi, and seal only fills in operands, so with ~400 tracked register dwords a lot of phis end up with a single distinct incoming value. Removing them (and re-checking the phi's users) is small and is likely a big share of the size. Counting phis on one large retail shader would confirm or rule this out.
  2. DCE of pure values. dx.op calls already carry FnAttrs::ReadNone, and the module is in memory, so dropping unused side-effect-free instructions and calls before writing should be straightforward.
  3. CSE of ReadNone dx.op calls. Each access emits its own createHandleFromBinding / createHandleFromHeap + annotateHandle. Caching those per (binding, props), or doing a general value-number pass over ReadNone calls, removes repeats (cbuffer loads benefit too).
  4. Guard merging (already in the spec): joining neighbouring blocks guarded by the same EXEC value. Integer constant folding (fold_bin) already covers part of what SCCP would do.

Things to keep out of any optimisation passes

  • Float exactness: no reassociation or contraction of float ops; the emitter currently sets no fast-math flags and passes should keep it that way.
  • No unswitching across divergent control flow: moving barriers or wave ops (ballots, readlane, DPP) into or out of divergent ifs changes results.
  • No hoisting out of loops (LICM-style): it mostly raises register pressure in shaders.
  • No memcpy/memset-style rewrites: DXIL doesn't allow those intrinsics.
  • Loop budget: loop rotation or unrolling can shift where the VAR_BUDGET check sits relative to the first iteration, allowing one iteration more than the cap. If loop passes are added, a test that the budget stays exact would catch this.
  • Per-pass disable switch: an env var that turns off individual passes makes bisecting a miscompile much easier.
**@⁠Icey-Glitch** on GitHub · 2026-11-24 16:43 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138118063) > **AI disclaimer:** this was written with Claude Code (Claude Opus 5.5), which compared this PR against another codebase of mine that optimises DXIL, to look for ideas that could carry over here. It's based on reading the code only; nothing here was built or measured. Some suggestions on output size (the ~3x / 13.6x vs DXC noted in the description), from reading the code. I haven't built this or measured where the size goes, so the order is a guess. **Cheap passes that would probably pay off** 1. **Trivial phi removal.** `ssa.rs` follows Braun et al., but I don't see the paper's `tryRemoveTrivialPhi` step. Every read in an unsealed block (loop headers etc.) creates a phi, and `seal` only fills in operands, so with ~400 tracked register dwords a lot of phis end up with a single distinct incoming value. Removing them (and re-checking the phi's users) is small and is likely a big share of the size. Counting phis on one large retail shader would confirm or rule this out. 2. **DCE of pure values.** dx.op calls already carry `FnAttrs::ReadNone`, and the module is in memory, so dropping unused side-effect-free instructions and calls before writing should be straightforward. 3. **CSE of `ReadNone` dx.op calls.** Each access emits its own `createHandleFromBinding` / `createHandleFromHeap` + `annotateHandle`. Caching those per (binding, props), or doing a general value-number pass over `ReadNone` calls, removes repeats (cbuffer loads benefit too). 4. **Guard merging** (already in the spec): joining neighbouring blocks guarded by the same EXEC value. Integer constant folding (`fold_bin`) already covers part of what SCCP would do. **Things to keep out of any optimisation passes** - **Float exactness:** no reassociation or contraction of float ops; the emitter currently sets no fast-math flags and passes should keep it that way. - **No unswitching across divergent control flow:** moving barriers or wave ops (ballots, readlane, DPP) into or out of divergent `if`s changes results. - **No hoisting out of loops (LICM-style):** it mostly raises register pressure in shaders. - **No memcpy/memset-style rewrites:** DXIL doesn't allow those intrinsics. - **Loop budget:** loop rotation or unrolling can shift where the `VAR_BUDGET` check sits relative to the first iteration, allowing one iteration more than the cap. If loop passes are added, a test that the budget stays exact would catch this. - **Per-pass disable switch:** an env var that turns off individual passes makes bisecting a miscompile much easier.
Author
Owner

@⁠emirduran707 on GitHub · 2026-11-24 16:46 UTC · original

Rechecked on the same RX 9060 XT (RDNA4, driver 32.0.31044.16) at bc93a3a, which has ac9328f (!llvm.ident): no crashes any more.

  • XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests: 118 passed, 0 failed; XCL_DIRECT_DXIL=all: 118 passed, 0 failed
  • cargo test --workspace -- --test-threads=4 --skip wave_ops_match_cpu: lib 776 passed, 5 failed, 23 ignored. The five are the ones from my report above: fuzz_validate_and_gpu_0..3 (GPU against CPU) and half_precision_overloads_run (half max 5.0, expected 10.5)
  • ops_tests::wave_ops_match_cpu still removes the device here (CreateComputePipelineState → 0x887A0005), alone as well. In a full run every GPU test after it fails (93 failures, several print SKIPPED … no GPU), so the counts above skip it.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.

**@⁠emirduran707** on GitHub · 2026-11-24 16:46 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138193117) Rechecked on the same RX 9060 XT (RDNA4, driver 32.0.31044.16) at [`bc93a3a`](https://github.com/ivall/xcl/commit/bc93a3a6f1d5ce2f5836135b231bd5e09e8d1658), which has `ac9328f` (`!llvm.ident`): **no crashes any more.** - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests`: 118 passed, 0 failed; `XCL_DIRECT_DXIL=all`: 118 passed, 0 failed - `cargo test --workspace -- --test-threads=4 --skip wave_ops_match_cpu`: lib 776 passed, 5 failed, 23 ignored. The five are the ones from my report above: `fuzz_validate_and_gpu_0..3` (GPU against CPU) and `half_precision_overloads_run` (half max 5.0, expected 10.5) - `ops_tests::wave_ops_match_cpu` still removes the device here (`CreateComputePipelineState` → `0x887A0005`), alone as well. In a full run every GPU test after it fails (93 failures, several print `SKIPPED … no GPU`), so the counts above skip it. AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 16:47 UTC · original

@⁠bmjask here is the pair on bc93a3a6 against main 930e8b4 (this PR's base), for the Regression run section. Both runs pass: no device removal, no crash, 101 % of main's frames, 96 % of its peak commit.

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74), AMD Ryzen 9 9950X, Windows 11 Pro 26200.
  • scripts/smoke.ps1, the same retail title for 60 s each: main first, then this PR's head, one after the other on the same machine. XCL_DIRECT_DXIL unset on both, so this covers the default path.

main 930e8b4:

xcl-smoke v1
commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA VI
seconds: 60
exit: 0x0
frames shown: 1302 (PresentX 1302)
presents per 2 s (last 3): 24 49 27
device removals: 0
crashes: 0
peak commit: 27812 MB

this PR, bc93a3a6:

xcl-smoke v1
commit: bc93a3a6f1d5ce2f5836135b231bd5e09e8d1658
gpu: NVIDIA GeForce RTX 5070 Ti
title: GTA VI
seconds: 60
exit: 0x0
frames shown: 1314 (PresentX 1314)
presents per 2 s (last 3): 22 47 53
device removals: 0
crashes: 0
peak commit: 26641 MB

Not tested

  • XCL_DIRECT_DXIL=1 on this head (the direct-path title run in my earlier comment was on 065aef35).
  • The test suite on this head, AMD, Linux.

AI use: Claude Code (Claude Opus 5.5)

**@⁠Kalmarv** on GitHub · 2026-11-24 16:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138222499) @⁠bmjask here is the pair on `bc93a3a6` against `main` `930e8b4` (this PR's base), for the **Regression run** section. Both runs pass: no device removal, no crash, 101 % of `main`'s frames, 96 % of its peak commit. **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74), AMD Ryzen 9 9950X, Windows 11 Pro 26200. - `scripts/smoke.ps1`, the same retail title for 60 s each: `main` first, then this PR's head, one after the other on the same machine. `XCL_DIRECT_DXIL` unset on both, so this covers the default path. `main` `930e8b4`: ``` xcl-smoke v1 commit: 930e8b49c1c2ec683d22c724a398b39111cd0e56 gpu: NVIDIA GeForce RTX 5070 Ti title: GTA VI seconds: 60 exit: 0x0 frames shown: 1302 (PresentX 1302) presents per 2 s (last 3): 24 49 27 device removals: 0 crashes: 0 peak commit: 27812 MB ``` this PR, `bc93a3a6`: ``` xcl-smoke v1 commit: bc93a3a6f1d5ce2f5836135b231bd5e09e8d1658 gpu: NVIDIA GeForce RTX 5070 Ti title: GTA VI seconds: 60 exit: 0x0 frames shown: 1314 (PresentX 1314) presents per 2 s (last 3): 22 47 53 device removals: 0 crashes: 0 peak commit: 26641 MB ``` **Not tested** - `XCL_DIRECT_DXIL=1` on this head (the direct-path title run in my earlier comment was on `065aef35`). - The test suite on this head, AMD, Linux. **AI use:** Claude Code (Claude Opus 5.5)
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 16:49 UTC · original

@⁠bmjask one more builder request, found by @⁠upipibi while trying a second lowering (https://github.com/ivall/xcl/issues/1269#issuecomment-7138223440), and it affects the per-lane path generally. The writer emits blocks in creation order and needs that order to be a dominance order (forward references only through phis). The per-lane lowering creates every block up front (the SSA construction needs each block's predecessors before lowering) and then adds blocks in the middle: a guarded store's then/join blocks, exchange_spin's loop. Creating blocks lazily does not fix it either: a loop's exit block is referenced from the head's branch before the body that dominates its uses exists.

Request: at finish / to_bitcode, emit the entry function's blocks in reverse post-order of its CFG (entry first), and number values in that order, so that a lowering may create blocks in any order. That also covers Lw::guarded called from a driver that pre-creates blocks. It is additive for #1426's own path, which already creates blocks in an order that reverse post-order preserves. Together with replace_all_uses, that is all the per-lane mode needs from the builder.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 16:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138267309) @⁠bmjask one more builder request, found by @⁠upipibi while trying a second lowering (https://github.com/ivall/xcl/issues/1269#issuecomment-7138223440), and it affects the per-lane path generally. The writer emits blocks in creation order and needs that order to be a dominance order (forward references only through phis). The per-lane lowering creates every block up front (the SSA construction needs each block's predecessors before lowering) and then adds blocks in the middle: a guarded store's then/join blocks, `exchange_spin`'s loop. Creating blocks lazily does not fix it either: a loop's exit block is referenced from the head's branch before the body that dominates its uses exists. Request: at `finish` / `to_bitcode`, emit the entry function's blocks in reverse post-order of its CFG (entry first), and number values in that order, so that a lowering may create blocks in any order. That also covers `Lw::guarded` called from a driver that pre-creates blocks. It is additive for #1426's own path, which already creates blocks in an order that reverse post-order preserves. Together with `replace_all_uses`, that is all the per-lane mode needs from the builder. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 16:52 UTC · original

@⁠bmjask a second case for the block-order change @⁠gefydev asked for, at bc93a3a6: a VS or PS whose program branches before its exports is refused, VS: direct DXIL builder error: forward reference to value 128 at instruction 90 (blocks must be in dominance order), and the stage goes to HLSL. kernel.rs:303 creates exit before the program's blocks, and the epilogue placed in exit reads their values.

We have a local fix (5 lines: the epilogue goes into a block created after the program's blocks) with a test, graphics_stages_with_a_branch_before_their_exports (a VS and a PS with an s_cbranch_scc1 over one v_mov before exp). It fails on bc93a3a6; the run with the fix is going now. If the writer lays blocks out in reverse post-order at finish, that covers this too and the fix isn't needed, but the test may still be useful. Say which you'd like.

Separately, still at bc93a3a6: shader.rs:338 declares waveGetLaneIndex ReadNone; DXC declares dx.op.waveGetLaneIndex readonly. We have that as a one-line commit with a listing test too.

AI use: Claude Code (Claude Opus 5.5)

**@⁠Kalmarv** on GitHub · 2026-11-24 16:52 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138346716) @⁠bmjask a second case for the block-order change @⁠gefydev asked for, at `bc93a3a6`: a VS or PS whose program branches before its exports is refused, `VS: direct DXIL builder error: forward reference to value 128 at instruction 90 (blocks must be in dominance order)`, and the stage goes to HLSL. `kernel.rs:303` creates `exit` before the program's blocks, and the epilogue placed in `exit` reads their values. We have a local fix (5 lines: the epilogue goes into a block created after the program's blocks) with a test, `graphics_stages_with_a_branch_before_their_exports` (a VS and a PS with an `s_cbranch_scc1` over one `v_mov` before `exp`). It fails on `bc93a3a6`; the run with the fix is going now. If the writer lays blocks out in reverse post-order at `finish`, that covers this too and the fix isn't needed, but the test may still be useful. Say which you'd like. Separately, still at `bc93a3a6`: `shader.rs:338` declares `waveGetLaneIndex` `ReadNone`; DXC declares `dx.op.waveGetLaneIndex` `readonly`. We have that as a one-line commit with a listing test too. **AI use:** Claude Code (Claude Opus 5.5)
Author
Owner

@⁠ArturoWolff on GitHub · 2026-11-24 16:10 UTC · original · edited 2026-11-24 16:55 UTC

RTX 4060 / Proton: direct compute dispatch passed on 065aef35c30f364d2a9be2431a1466cddf05e761, with fallback excluded. One synthetic wave32 group, 32 lanes, one memory window. Different EXEC masks controlled a register update (0xa5a5a5a5) and a global store (0xcccccccc). Each backend matched an independent CPU oracle on all 64 output words: 16 stores (eight updated values, eight preserved) and 48 untouched sentinels, including all 16 masked-off destinations.

Tested: Windows-target release build on Linux, Ryzen 5 5600, RTX 4060, NVIDIA 620.73.04, GE-Proton11-14, vkd3d-proton 4522cc1a8b1347f+. Separate Wine processes ran the exact direct and hlsl tests with --exact --nocapture --test-threads=1; each had 1 passed, 0 failed, 0 ignored, 0 skipped, 1 filtered. The direct probe calls gpu::dxil::kernel::translate_compute, fails on refusal and submits its returned bytes directly to CreateComputePipelineState. DXC was disabled in that process; dxcompiler.dll was not loaded before or after translation. The control used recomp::translate then dxc::compile. Both dispatched and read back the same buffer layout.

One observation per backend, not a speed benchmark: direct conversion 1,297 µs, first PSO 5,446 µs; control 97 µs to HLSL + 15,676 µs in DXC, first PSO 5,584 µs. No supplied cached PSO; not proof of a fully cold driver. Not tested: live hook/fallback selection, native Windows or AMD, wave64, the separate per-lane lowering, full suite, retail loading. AI use: Hermes Agent (gpt-6.2-astra), probe, execution, output verification and report.

Paired timing follow-up on the same head and RTX 4060

Skipping DXC saved time even after the first CreateComputePipelineState on two synthetic, all-active wave32 arithmetic shaders. Each size had four direct/HLSL pairs (two direct-first, two HLSL-first), one fresh Wine process per arm. Median within-pair differences in milliseconds; the last column is the median of the paired sums, not a sum of column medians:

Mixing rounds Conversion saved by direct Extra first-PSO time for direct Net saved, conversion + first PSO
32 31.70 0.18 31.51
256 153.43 5.96 149.165

Direct won the sum in all eight pairs. At 256 rounds its PSO was slower in every pair; its executable bitcode was 16,516 bytes vs 11,984 from DXC. The arithmetic survived both compilers (1,288 vs 1,287 LLVM binary-op records). All 16 dispatches matched a separate integer CPU oracle: 32 lane results and 32 untouched guard words per run; no refusal or skip. Both paths got identical ISA and runtime user data. The direct probe failed on refusal, with DXC disabled. Stock used recomp::translate + dxc::compile (cs_6_6, no extra flags).

Commands: private Windows-target release probe, probe.exe direct --exact --nocapture --test-threads=1 / probe.exe hlsl --exact --nocapture --test-threads=1, at each size. No supplied PSO blob; fresh per-arm cache directories and disk shader caches disabled, not a guarantee of a cold driver. These are conversion and PSO API timings, not GPU execution or retail startup timings. This compares this PR's per-instruction emitter to HLSL/DXC, not the coordinated per-lane emitter to this PR. AI use: Hermes Agent (gpt-6.2-astra), fixtures, measurements, verification and report.

CPU-only regression fixture for the writer-order request. At bc93a3a6f1d5ce2f5836135b231bd5e09e8d1658 (the same module.rs and bitstream.rs as a7cf0784c0eeb2e372b9cce48b1cf7f03f083e4a), I compiled those two unmodified modules with rustc --edition=2021 order.rs -o probe on Linux x86-64. The graph, values, phi incoming edges and order of all instruction-building calls are fixed. Only new_block() order changes. abc (head, body, exit) serializes; acb, bac, bca, cab, cba all report a non-phi forward reference. LLVM opt -passes=verify -disable-output accepted the independently reordered textual IR for all six, and rejected a negative control adding an entry→exit edge bypassing the definition. Reproducer function below; call once per order using a fresh module, and require all six to return Ok after the writer fix. No adapter workaround proposed. Writer test only, not shader validation, dispatch or timing. Hermes Agent (gpt-6.2-astra) wrote and ran the fixture.

Writer fixture (uses the existing module types)
fn loop_case(order: &str) -> Result<Vec<u8>, String> {
    let mut m=Module::new();m.define_entry("main"); let entry=m.entry_block();
    let mut ids=[Block(0);3];for c in order.bytes(){ids[(c-b'a') as usize]=m.new_block();}
    let [head,body,exit]=ids;let ty=m.i32();let zero=m.i32c(0);let one=m.i32c(1);let three=m.i32c(3);
    m.br(head);m.set_block(head);let i=m.phi(ty);m.add_incoming(i,zero,entry);m.br(body);
    m.set_block(body);let next=m.bin(BinOp::Add,i,one);let more=m.cmp(Pred::Ne,next,three);m.cond_br(more,head,exit);m.add_incoming(i,next,body);
    m.set_block(exit);let _=m.bin(BinOp::Xor,next,one);m.ret();
    m.try_to_bitcode("x86_64-unknown-linux-gnu","")
}
**@⁠ArturoWolff** on GitHub · 2026-11-24 16:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7137239682) · edited 2026-11-24 16:55 UTC **RTX 4060 / Proton: direct compute dispatch passed on `065aef35c30f364d2a9be2431a1466cddf05e761`, with fallback excluded.** One synthetic wave32 group, 32 lanes, one memory window. Different EXEC masks controlled a register update (`0xa5a5a5a5`) and a global store (`0xcccccccc`). Each backend matched an independent CPU oracle on all 64 output words: 16 stores (eight updated values, eight preserved) and 48 untouched sentinels, including all 16 masked-off destinations. **Tested:** Windows-target release build on Linux, Ryzen 5 5600, RTX 4060, NVIDIA 620.73.04, GE-Proton11-14, vkd3d-proton `4522cc1a8b1347f+`. Separate Wine processes ran the exact `direct` and `hlsl` tests with `--exact --nocapture --test-threads=1`; each had 1 passed, 0 failed, 0 ignored, 0 skipped, 1 filtered. The direct probe calls `gpu::dxil::kernel::translate_compute`, fails on refusal and submits its returned bytes directly to `CreateComputePipelineState`. DXC was disabled in that process; `dxcompiler.dll` was not loaded before or after translation. The control used `recomp::translate` then `dxc::compile`. Both dispatched and read back the same buffer layout. One observation per backend, not a speed benchmark: direct conversion 1,297 µs, first PSO 5,446 µs; control 97 µs to HLSL + 15,676 µs in DXC, first PSO 5,584 µs. No supplied cached PSO; not proof of a fully cold driver. **Not tested:** live hook/fallback selection, native Windows or AMD, wave64, the separate per-lane lowering, full suite, retail loading. AI use: Hermes Agent (gpt-6.2-astra), probe, execution, output verification and report. ### Paired timing follow-up on the same head and RTX 4060 Skipping DXC saved time even after the first `CreateComputePipelineState` on two synthetic, all-active wave32 arithmetic shaders. Each size had four direct/HLSL pairs (two direct-first, two HLSL-first), one fresh Wine process per arm. Median within-pair differences in milliseconds; the last column is the median of the paired sums, not a sum of column medians: | Mixing rounds | Conversion saved by direct | Extra first-PSO time for direct | Net saved, conversion + first PSO | |---:|---:|---:|---:| | 32 | 31.70 | 0.18 | 31.51 | | 256 | 153.43 | 5.96 | 149.165 | Direct won the sum in all eight pairs. At 256 rounds its PSO was slower in every pair; its executable bitcode was 16,516 bytes vs 11,984 from DXC. The arithmetic survived both compilers (1,288 vs 1,287 LLVM binary-op records). All 16 dispatches matched a separate integer CPU oracle: 32 lane results and 32 untouched guard words per run; no refusal or skip. Both paths got identical ISA and runtime user data. The direct probe failed on refusal, with DXC disabled. Stock used `recomp::translate` + `dxc::compile` (`cs_6_6`, no extra flags). Commands: private Windows-target release probe, `probe.exe direct --exact --nocapture --test-threads=1` / `probe.exe hlsl --exact --nocapture --test-threads=1`, at each size. No supplied PSO blob; fresh per-arm cache directories and disk shader caches disabled, not a guarantee of a cold driver. These are conversion and PSO API timings, not GPU execution or retail startup timings. This compares this PR's **per-instruction emitter** to HLSL/DXC, not the coordinated per-lane emitter to this PR. AI use: Hermes Agent (gpt-6.2-astra), fixtures, measurements, verification and report. **CPU-only regression fixture for the [writer-order request](https://github.com/ivall/xcl/pull/1426#issuecomment-7138267309).** At `bc93a3a6f1d5ce2f5836135b231bd5e09e8d1658` (the same `module.rs` and `bitstream.rs` as `a7cf0784c0eeb2e372b9cce48b1cf7f03f083e4a`), I compiled those two unmodified modules with `rustc --edition=2021 order.rs -o probe` on Linux x86-64. The graph, values, phi incoming edges and order of all instruction-building calls are fixed. Only `new_block()` order changes. `abc` (head, body, exit) serializes; `acb`, `bac`, `bca`, `cab`, `cba` all report a non-phi forward reference. LLVM `opt -passes=verify -disable-output` accepted the independently reordered textual IR for all six, and rejected a negative control adding an entry→exit edge bypassing the definition. Reproducer function below; call once per order using a fresh module, and require all six to return `Ok` after the writer fix. No adapter workaround proposed. Writer test only, not shader validation, dispatch or timing. Hermes Agent (gpt-6.2-astra) wrote and ran the fixture. <details><summary>Writer fixture (uses the existing module types)</summary> ```rust fn loop_case(order: &str) -> Result<Vec<u8>, String> { let mut m=Module::new();m.define_entry("main"); let entry=m.entry_block(); let mut ids=[Block(0);3];for c in order.bytes(){ids[(c-b'a') as usize]=m.new_block();} let [head,body,exit]=ids;let ty=m.i32();let zero=m.i32c(0);let one=m.i32c(1);let three=m.i32c(3); m.br(head);m.set_block(head);let i=m.phi(ty);m.add_incoming(i,zero,entry);m.br(body); m.set_block(body);let next=m.bin(BinOp::Add,i,one);let more=m.cmp(Pred::Ne,next,three);m.cond_br(more,head,exit);m.add_incoming(i,next,body); m.set_block(exit);let _=m.bin(BinOp::Xor,next,one);m.ret(); m.try_to_bitcode("x86_64-unknown-linux-gnu","") } ``` </details>
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 16:59 UTC · original

@⁠bmjask the two fixes from my comment above, tested, on bc93a3a6: Kalmarv/xcl dxil-fixes-1426, three commits you can cherry-pick one at a time:

  • 1b537d45 the epilogue goes into a block created after the program's blocks (kernel.rs +5), with graphics_stages_with_a_branch_before_their_exports: a VS and a PS that branch on s0 before their exports, drawn through the direct path and the HLSL path for s0 = 0 and 1, with the same picture.
  • 43674985 waveGetLaneIndex ReadOnly (shader.rs:338), with wave_lane_index_is_declared_readonly (listing).
  • 40866943 TRANSLATOR_VERSION 1 → 2, on its own so you can bump once.

If you make the writer lay blocks out in reverse post-order instead, skip 1b537d45; its test should still pass and may be worth keeping.

Tested (RTX 5070 Ti, driver 610.74, Windows 11 Pro 26200, debug, DXC 1.9.2609.5)

  • bc93a3a6 with only the two tests: gpu::dxil 73 passed, 2 failed (the two new tests), 2 ignored.
  • Tip 40866943: gpu::dxil 75 passed, 0 failed, 2 ignored; gpu::recomp::tests with XCL_DIRECT_DXIL=1 and with =all: 118 passed, 0 failed, 17 ignored each (2 SKIPPED, no wave64), the same as on bc93a3a6.

Not tested

  • The whole workspace suite and a title run with these commits; the SDK's DXC 1.7; AMD.

AI use: Claude Code (Claude Fable 5.2, Claude Opus 5.5)

**@⁠Kalmarv** on GitHub · 2026-11-24 16:59 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138519412) @⁠bmjask the two fixes from my comment above, tested, on `bc93a3a6`: [Kalmarv/xcl `dxil-fixes-1426`](https://github.com/Kalmarv/xcl/commits/dxil-fixes-1426), three commits you can cherry-pick one at a time: - `1b537d45` the epilogue goes into a block created after the program's blocks (`kernel.rs` +5), with `graphics_stages_with_a_branch_before_their_exports`: a VS and a PS that branch on `s0` before their exports, drawn through the direct path and the HLSL path for `s0` = 0 and 1, with the same picture. - `43674985` `waveGetLaneIndex` `ReadOnly` (`shader.rs:338`), with `wave_lane_index_is_declared_readonly` (listing). - `40866943` `TRANSLATOR_VERSION` 1 → 2, on its own so you can bump once. If you make the writer lay blocks out in reverse post-order instead, skip `1b537d45`; its test should still pass and may be worth keeping. **Tested** (RTX 5070 Ti, driver 610.74, Windows 11 Pro 26200, debug, DXC 1.9.2609.5) - `bc93a3a6` with only the two tests: `gpu::dxil` 73 passed, 2 failed (the two new tests), 2 ignored. - Tip `40866943`: `gpu::dxil` 75 passed, 0 failed, 2 ignored; `gpu::recomp::tests` with `XCL_DIRECT_DXIL=1` and with `=all`: 118 passed, 0 failed, 17 ignored each (2 SKIPPED, no wave64), the same as on `bc93a3a6`. **Not tested** - The whole workspace suite and a title run with these commits; the SDK's DXC 1.7; AMD. **AI use:** Claude Code (Claude Fable 5.2, Claude Opus 5.5)
Author
Owner

@⁠Tjabooo on GitHub · 2026-11-24 17:06 UTC · original

On the fuzz seeds 1003 and 1698 that give wrong values on RADV (@⁠SlopTart above on RDNA2/3, @⁠Sipentech on #1269 on RDNA4): the DXIL is right. RADV miscompiles it.

Reproduced on an RX 9070 XT (RDNA4), RADV / Mesa 26.2.6, Wine 11.21, vkd3d-proton v3.1 with dxil-spirv 7c048638, direct-on-1426 at a7cf078 (the current head). I shrank both seeds locally with a throwaway pass: keep one output and drop every instruction it doesn't depend on, then run on the GPU. The GPU still disagrees with the interpreter after shrinking:

Seed 1698, 3 instructions, all constants, 32 of 32 lanes wrong:

%6 = shl i32 -1854474753, 26
%7 = ashr i32 %6, 26          ; sign-extends the low 6 bits: -1 (0xFFFFFFFF)
%8 = icmp uge i32 -4, %7      ; 0xFFFFFFFC >= 0xFFFFFFFF -> false

GPU writes 1, interpreter 0.

Seed 1003, 9 values. A shared-memory atomic and a lane exchange feed the same shape: ashr(shl(x, 26), 26), then icmp ule %7, -2. Lanes where the sign-extended value is -1 get 1 (expected 0). Every intermediate value is right when output on its own; only the compare is wrong.

Where it goes wrong, for seed 1003's reduced program:

  • DXIL from the backend: %29 = ashr i32 %28, 26, %30 = icmp ule i32 %29, -2. Correct.
  • SPIR-V from dxil-spirv (VKD3D_SHADER_DUMP_PATH): OpShiftRightArithmetic %63 %uint_26, OpULessThanEqual %65 %uint_4294967294. Correct.
  • RADV's final NIR / ACO (RADV_DEBUG=shaders): the shared-memory reads, the shifts and the compare are gone, and the output is a stored constant 1 (v_dual_mov_b32 v5, 1 → global_store_b32).

So the common pattern is a 6-bit sign extension (shl 26 + ashr 26) compared unsigned against a constant near UINT_MAX, and RADV folds the compare to true as if the value could not be that large. It looks like a NIR optimization or range-analysis bug in Mesa. I have not tested Mesa main yet and will before reporting it to Mesa. On the backend side nothing needs to change for these two seeds; on RADV they will keep failing until Mesa is fixed.

No game data. AI-assisted (Claude Code, Claude Opus 5.5); everything above is from runs on this machine.

**@⁠Tjabooo** on GitHub · 2026-11-24 17:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138689876) On the fuzz seeds 1003 and 1698 that give wrong values on RADV (@⁠SlopTart above on RDNA2/3, @⁠Sipentech on #1269 on RDNA4): the DXIL is right. RADV miscompiles it. Reproduced on an RX 9070 XT (RDNA4), RADV / Mesa 26.2.6, Wine 11.21, vkd3d-proton v3.1 with dxil-spirv `7c048638`, `direct-on-1426` at `a7cf078` (the current head). I shrank both seeds locally with a throwaway pass: keep one output and drop every instruction it doesn't depend on, then run on the GPU. The GPU still disagrees with the interpreter after shrinking: **Seed 1698**, 3 instructions, all constants, 32 of 32 lanes wrong: ``` %6 = shl i32 -1854474753, 26 %7 = ashr i32 %6, 26 ; sign-extends the low 6 bits: -1 (0xFFFFFFFF) %8 = icmp uge i32 -4, %7 ; 0xFFFFFFFC >= 0xFFFFFFFF -> false ``` GPU writes 1, interpreter 0. **Seed 1003**, 9 values. A shared-memory atomic and a lane exchange feed the same shape: `ashr(shl(x, 26), 26)`, then `icmp ule %7, -2`. Lanes where the sign-extended value is -1 get 1 (expected 0). Every intermediate value is right when output on its own; only the compare is wrong. **Where it goes wrong**, for seed 1003's reduced program: - DXIL from the backend: `%29 = ashr i32 %28, 26`, `%30 = icmp ule i32 %29, -2`. Correct. - SPIR-V from dxil-spirv (`VKD3D_SHADER_DUMP_PATH`): `OpShiftRightArithmetic %63 %uint_26`, `OpULessThanEqual %65 %uint_4294967294`. Correct. - RADV's final NIR / ACO (`RADV_DEBUG=shaders`): the shared-memory reads, the shifts and the compare are gone, and the output is a stored constant `1` (`v_dual_mov_b32 v5, 1` → `global_store_b32`). So the common pattern is a 6-bit sign extension (`shl 26` + `ashr 26`) compared unsigned against a constant near `UINT_MAX`, and RADV folds the compare to true as if the value could not be that large. It looks like a NIR optimization or range-analysis bug in Mesa. I have not tested Mesa main yet and will before reporting it to Mesa. On the backend side nothing needs to change for these two seeds; on RADV they will keep failing until Mesa is fixed. No game data. AI-assisted (Claude Code, Claude Opus 5.5); everything above is from runs on this machine.
Author
Owner

@⁠mynzjerko on GitHub · 2026-11-24 17:06 UTC · original

@⁠bmjask @⁠gefydev Windows RDNA4 test report + root causes for the three AMD RDNA4 failures on bc93a3a6f1d5ce2f5836135b231bd5e09e8d1658, plus a Windows RDNA4 check of gefydev/xcl:direct-on-1426 (a7cf078).

Hardware / build

  • AMD Radeon RX 9070 (RDNA4, native wave64), driver 32.0.32029.2010; AMD Ryzen 5 7500F; Windows 11 Pro 10.0.26300; rustc 1.100.0 (stable-x86_64-pc-windows-msvc); DXC 1.9.2602.17; debug build; clean worktree.

Results on #1426 head bc93a3a6

  • XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu::recomp::tests --test-threads=4: 118 passed, 0 failed, 17 ignored (0 SKIPPED)
  • XCL_DIRECT_DXIL=all cargo test -p xcl --lib -- gpu::recomp::tests --test-threads=4: 118 passed, 0 failed, 17 ignored (0 SKIPPED)
  • cargo test -p xcl --lib -- gpu::dxil --skip wave_ops_match_cpu --test-threads=1: 67 passed, 5 failed, 2 ignored (0 SKIPPED) — same 5 as @⁠emirduran707's RX 9060 XT report (half_precision_overloads_run and fuzz_validate_and_gpu_0..3).
  • cargo test -p xcl --lib -- gpu::dxil::ops_tests::wave_ops_match_cpu --nocapture --test-threads=1: CreateComputePipelineState → 0x887A0005 (device removed).

Root causes found (local isolated checks, reverted after)

  1. wave_ops_match_cpu (0x887A0005) — sop on WaveMultiPrefixBitXor: bisecting all wave ops in the test isolated the single failing call to ops_tests.rs:768, wave_multi_prefix_op(u, mask, multi_prefix::XOR, true), which emits dx.op.waveMultiPrefixOp.i32(..., i8 3, i8 1) (sop = Unsigned). DXC emits i8 0 (sop = Signed) for WaveMultiPrefixBitXor. Changing true → false at ops_tests.rs:768 makes the full wave_ops_match_cpu test pass on RX 9070 (1 passed, 0 failed in 0.10 s, no device removal). Shader::wave_multi_prefix_op could force sop = 0 for bitwise AND/OR/XOR.
  2. half_precision_overloads_run (got(4) = 5.0, expected 10.5) — AMD driver bug, not #1426: a minimal HLSL shader with [WaveSize(32)] and WaveActiveMax(abs((float16_t)b)) compiled directly with DXC 1.9.2602.17 (-enable-16bit-types) produces the exact same 5.0 across all 32 lanes on RX 9070 (32.0.32029.2010), matching #1426's emitted DXIL.
  3. fuzz_validate_and_gpu_0..3 (seeds 328, 662, 1206, 1599) — constant Bfrev.i64 in amdxc64.dll:
    • On RX 9070, dx.op.unary.i64(30, dynamic_i64) alone gives the right result (Bfrev(7) → hi=0xe0000000, lo=0x00000000, matching DXC), whereas dx.op.unary.i64(30, i64 7) gives hi=0xe0000000, lo=0xe0000000 (duplicating bfrev32(lo) into both halves). DXC always constant-folds reversebits((uint64_t)7) even with -Od, so amdxc64.dll only hits this on unfolded direct DXIL.
    • That directly explains seeds 328 (Bfrev(7) → 0xe0000000 instead of 0x0), 662 (0xe0000000e0000000 / 5 → low 32 bits 0xf9999999 instead of 0xcccccccc), and 1206 (Bfrev(0x7fffffffffffffff) → 0xffffffffffffffff, doubled → 0xfffffffe instead of 0xfffffffc).
    • Also checked the two RDNA3/RDNA4 Linux seeds (FUZZ_SEED=1003 and FUZZ_SEED=1698 via debug_seed): both pass with 0 mismatching results on Windows amdxc64.dll, so those two appear specific to the vkd3d-proton/RADV path.

Bonus: gefydev/xcl:direct-on-1426 at a7cf078 (Windows RDNA4)

  • cargo test -p xcl --lib -- gpu::recomp::lower --test-threads=1: 21 passed, 0 failed, 0 ignored (0 SKIPPED)
  • cargo test -p xcl --lib -- lane_masks --test-threads=1: 7 passed, 0 failed, 0 ignored (0 SKIPPED)

Not tested: retail title (scripts/smoke.ps1), release build, NVIDIA/Intel, Linux.

AI use: Google Antigravity (Gemini 4 Neon) ran the test suites and isolated diagnostics and drafted this report; results were checked against local logs.

**@⁠mynzjerko** on GitHub · 2026-11-24 17:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138692067) @⁠bmjask @⁠gefydev Windows RDNA4 test report + root causes for the three AMD RDNA4 failures on `bc93a3a6f1d5ce2f5836135b231bd5e09e8d1658`, plus a Windows RDNA4 check of `gefydev/xcl:direct-on-1426` (`a7cf078`). **Hardware / build** - AMD Radeon RX 9070 (RDNA4, native wave64), driver `32.0.32029.2010`; AMD Ryzen 5 7500F; Windows 11 Pro `10.0.26300`; `rustc 1.100.0` (`stable-x86_64-pc-windows-msvc`); DXC `1.9.2602.17`; debug build; clean worktree. **Results on `#1426` head `bc93a3a6`** - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib -- gpu::recomp::tests --test-threads=4`: **118 passed, 0 failed, 17 ignored** (`0 SKIPPED`) - `XCL_DIRECT_DXIL=all cargo test -p xcl --lib -- gpu::recomp::tests --test-threads=4`: **118 passed, 0 failed, 17 ignored** (`0 SKIPPED`) - `cargo test -p xcl --lib -- gpu::dxil --skip wave_ops_match_cpu --test-threads=1`: **67 passed, 5 failed, 2 ignored** (`0 SKIPPED`) — same 5 as @⁠emirduran707's RX 9060 XT report (`half_precision_overloads_run` and `fuzz_validate_and_gpu_0..3`). - `cargo test -p xcl --lib -- gpu::dxil::ops_tests::wave_ops_match_cpu --nocapture --test-threads=1`: `CreateComputePipelineState` → `0x887A0005` (device removed). **Root causes found (local isolated checks, reverted after)** 1. **`wave_ops_match_cpu` (`0x887A0005`) — `sop` on `WaveMultiPrefixBitXor`:** bisecting all wave ops in the test isolated the single failing call to `ops_tests.rs:768`, `wave_multi_prefix_op(u, mask, multi_prefix::XOR, true)`, which emits `dx.op.waveMultiPrefixOp.i32(..., i8 3, i8 1)` (`sop = Unsigned`). DXC emits `i8 0` (`sop = Signed`) for `WaveMultiPrefixBitXor`. Changing `true` → `false` at `ops_tests.rs:768` makes the full `wave_ops_match_cpu` test pass on RX 9070 (`1 passed, 0 failed` in 0.10 s, no device removal). `Shader::wave_multi_prefix_op` could force `sop = 0` for bitwise `AND`/`OR`/`XOR`. 2. **`half_precision_overloads_run` (`got(4) = 5.0`, expected `10.5`) — AMD driver bug, not `#1426`:** a minimal HLSL shader with `[WaveSize(32)]` and `WaveActiveMax(abs((float16_t)b))` compiled directly with DXC `1.9.2602.17` (`-enable-16bit-types`) produces the exact same `5.0` across all 32 lanes on RX 9070 (`32.0.32029.2010`), matching `#1426`'s emitted DXIL. 3. **`fuzz_validate_and_gpu_0..3` (seeds `328`, `662`, `1206`, `1599`) — constant `Bfrev.i64` in `amdxc64.dll`:** - On RX 9070, `dx.op.unary.i64(30, dynamic_i64)` alone gives the right result (`Bfrev(7)` → `hi=0xe0000000, lo=0x00000000`, matching DXC), whereas `dx.op.unary.i64(30, i64 7)` gives `hi=0xe0000000, lo=0xe0000000` (duplicating `bfrev32(lo)` into both halves). DXC always constant-folds `reversebits((uint64_t)7)` even with `-Od`, so `amdxc64.dll` only hits this on unfolded direct DXIL. - That directly explains seeds `328` (`Bfrev(7)` → `0xe0000000` instead of `0x0`), `662` (`0xe0000000e0000000 / 5` → low 32 bits `0xf9999999` instead of `0xcccccccc`), and `1206` (`Bfrev(0x7fffffffffffffff)` → `0xffffffffffffffff`, doubled → `0xfffffffe` instead of `0xfffffffc`). - Also checked the two RDNA3/RDNA4 Linux seeds (`FUZZ_SEED=1003` and `FUZZ_SEED=1698` via `debug_seed`): both pass with **0 mismatching results** on Windows `amdxc64.dll`, so those two appear specific to the vkd3d-proton/RADV path. **Bonus: `gefydev/xcl:direct-on-1426` at `a7cf078` (Windows RDNA4)** - `cargo test -p xcl --lib -- gpu::recomp::lower --test-threads=1`: **21 passed, 0 failed, 0 ignored** (`0 SKIPPED`) - `cargo test -p xcl --lib -- lane_masks --test-threads=1`: **7 passed, 0 failed, 0 ignored** (`0 SKIPPED`) **Not tested:** retail title (`scripts/smoke.ps1`), release build, NVIDIA/Intel, Linux. **AI use:** Google Antigravity (Gemini 4 Neon) ran the test suites and isolated diagnostics and drafted this report; results were checked against local logs.
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 17:07 UTC · original

@⁠bmjask a small addition to the Lw constructor / epilogue split, found while planning the next pieces on #1269. Please make the per-entry setup reachable from outside kernel.rs too: setup_lanes_compute for compute, and mesh_init for the mesh pass. The per-lane form drives those entries with its own CFG, and two pieces depend on it: @⁠Sr-0w's 2-D / 3-D groups (Ir::compute_ids, whose adapter half calls setup_lanes_compute) and @⁠Kalmarv's mesh stage in the per-lane form. We will not change kernel.rs in our branch.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 17:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138726144) @⁠bmjask a small addition to the `Lw` constructor / epilogue split, found while planning the next pieces on #1269. Please make the per-entry setup reachable from outside `kernel.rs` too: `setup_lanes_compute` for compute, and `mesh_init` for the mesh pass. The per-lane form drives those entries with its own CFG, and two pieces depend on it: @⁠Sr-0w's 2-D / 3-D groups (`Ir::compute_ids`, whose adapter half calls `setup_lanes_compute`) and @⁠Kalmarv's mesh stage in the per-lane form. We will not change `kernel.rs` in our branch. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 16:57 UTC · original · edited 2026-11-24 17:07 UTC

Test report for bc93a3a (bc93a3a6f1d5): the PR's own tests and the whole suite pass on an RTX 5070 Ti with both the Windows SDK's DXC 1.7 and DXC 1.9. The failures seen at 065aef3 are gone: the four fuzz_validate_and_gpu_N failures (NVIDIA refusing atomicrmw sub, with DXC 1.9) and the 129 failures with the SDK's DXC (dx.valver 1.8 refused by the 1.7 validator).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74), AMD Ryzen 9 9950X, Windows 11 Pro 26200, rustc 1.99.0, debug build, clean tree at bc93a3a6f1d5.

  • With the Windows SDK's DXC (10.0.26100, dxcompiler 1.7.2308.16):

    • cargo test -p xcl --lib gpu::dxil: 73 passed, 0 failed, 2 ignored. 46 tests print SKIPPED <test>: validator 1.7 < 1.8 (validation step only); their GPU parts ran.
    • XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests: 118 passed, 0 failed, 17 ignored.
    • cargo build --workspace && cargo test --workspace -- --test-threads=4 (XCL_DIRECT_DXIL unset): 826 passed, 0 failed, 43 ignored. The same 46 validation-step SKIPPED lines.
  • With DXC 1.9.2609.5 (XCL_DXC_DIR):

    • cargo test -p xcl --lib gpu::dxil: 73 passed, 0 failed, 2 ignored, nothing skipped.
    • XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests: 118 passed, 0 failed, 17 ignored.
    • cargo build --workspace && cargo test --workspace -- --test-threads=4 (XCL_DIRECT_DXIL unset): 826 passed, 0 failed, 43 ignored.
  • SKIPPED on this adapter in every run that includes them (no wave64): gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware, gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask.

  • At 065aef3 the same two filtered commands gave, with DXC 1.9: 61 passed, 4 failed, 2 ignored and 118 passed, 0 failed, 17 ignored; with the SDK's DXC: 14 passed, 51 failed, 2 ignored and 40 passed, 78 failed, 17 ignored.

  • A 60 s title run with XCL_DIRECT_DXIL=1 (scripts/smoke.ps1, same machine): exit 0, 1251 frames, no device removal or crash. 80 compute pipelines went direct, 0 fell back to HLSL; DXIL mean 488 KB, largest 14.7 MB; PSO time 66 s in total, median 100 ms, largest 26.8 s. As at 065aef3, so the size and PSO-time numbers in my earlier comment still hold.

Not tested

  • AMD and Intel GPUs, native wave64 hardware (no such hardware here).
  • XCL_DIRECT_DXIL=all, and the whole suite with XCL_DIRECT_DXIL set.
  • A release build.
  • With the SDK's DXC the validator step is skipped, so validation of the emitted containers is covered by the DXC 1.9 runs only.

AI use: Claude Code (Claude Fable 5.2, Claude Opus 5.5) ran the tests and wrote this report.

**@⁠Kalmarv** on GitHub · 2026-11-24 16:57 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138466590) · edited 2026-11-24 17:07 UTC Test report for `bc93a3a` (`bc93a3a6f1d5`): the PR's own tests and the whole suite pass on an RTX 5070 Ti with both the Windows SDK's DXC 1.7 and DXC 1.9. The failures seen at `065aef3` are gone: the four `fuzz_validate_and_gpu_N` failures (NVIDIA refusing `atomicrmw sub`, with DXC 1.9) and the 129 failures with the SDK's DXC (`dx.valver` 1.8 refused by the 1.7 validator). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (driver 610.74), AMD Ryzen 9 9950X, Windows 11 Pro 26200, rustc 1.99.0, debug build, clean tree at `bc93a3a6f1d5`. - With the Windows SDK's DXC (10.0.26100, dxcompiler 1.7.2308.16): - `cargo test -p xcl --lib gpu::dxil`: 73 passed, 0 failed, 2 ignored. 46 tests print `SKIPPED <test>: validator 1.7 < 1.8 (validation step only)`; their GPU parts ran. - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests`: 118 passed, 0 failed, 17 ignored. - `cargo build --workspace && cargo test --workspace -- --test-threads=4` (`XCL_DIRECT_DXIL` unset): 826 passed, 0 failed, 43 ignored. The same 46 validation-step SKIPPED lines. - With DXC 1.9.2609.5 (`XCL_DXC_DIR`): - `cargo test -p xcl --lib gpu::dxil`: 73 passed, 0 failed, 2 ignored, nothing skipped. - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests`: 118 passed, 0 failed, 17 ignored. - `cargo build --workspace && cargo test --workspace -- --test-threads=4` (`XCL_DIRECT_DXIL` unset): 826 passed, 0 failed, 43 ignored. - `SKIPPED` on this adapter in every run that includes them (no wave64): `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware`, `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask`. - At `065aef3` the same two filtered commands gave, with DXC 1.9: 61 passed, 4 failed, 2 ignored and 118 passed, 0 failed, 17 ignored; with the SDK's DXC: 14 passed, 51 failed, 2 ignored and 40 passed, 78 failed, 17 ignored. - A 60 s title run with `XCL_DIRECT_DXIL=1` (`scripts/smoke.ps1`, same machine): exit 0, 1251 frames, no device removal or crash. 80 compute pipelines went direct, 0 fell back to HLSL; DXIL mean 488 KB, largest 14.7 MB; PSO time 66 s in total, median 100 ms, largest 26.8 s. As at `065aef3`, so the size and PSO-time numbers in my earlier comment still hold. **Not tested** - AMD and Intel GPUs, native wave64 hardware (no such hardware here). - `XCL_DIRECT_DXIL=all`, and the whole suite with `XCL_DIRECT_DXIL` set. - A release build. - With the SDK's DXC the validator step is skipped, so validation of the emitted containers is covered by the DXC 1.9 runs only. **AI use:** Claude Code (Claude Fable 5.2, Claude Opus 5.5) ran the tests and wrote this report.
Author
Owner

@⁠HKEY-Funk-Machine on GitHub · 2026-11-24 17:07 UTC · original

@⁠bmjask a second AMD driver fault in the direct path, isolated to one program (moved here from #1269 at @⁠gefydev's request). Counts, hashes and timings only; no DXIL or console container attached.

The fault: 0xC0000005 in amdxc64.dll+0x6800a4 (read at 0x0), during CreateComputePipelineState of the direct path's DXIL for one compute program. It is not the !llvm.ident fault (+0x1ab0cf7), which is fixed.

  • Stack: amdxc64.dll+0xb2dcb5, +0x67f0e1, +0x68b755, +0x6cf141, +0x1b189f, +0xa1a3b2

The program: console CS [SHADER] cs 62b584e061c05fc5 (8 540 B console container, retail 1.0.2.1; [SHADER]'s FNV-64 of the container, findable in your own copy).

path DXIL CreateComputePipelineState on the RX 9070
direct (XCL_DIRECT_DXIL=1) 1 873 324 B, byte-identical on both heads below faults; never returns
HLSL (XCL_DIRECT_DXIL unset, XCL_TRANSLATED_CACHE=0, XCL_PSO_DISK_CACHE=0) 197 280 B builds, S_OK

The HLSL build reported 1 ms, which is almost certainly the AMD driver's own shader cache (it isn't covered by XCL's switches), so I don't have a cold driver time for the HLSL form.

Tested on: direct-on-1426 6e6796a and a7cf078 (the latter on #1426 bc93a3a), each + #751 + #1288 (so the title's stall check doesn't end the run first) + a local patch that skips InitializeApiImplEx2; XCL_NETWORK=0. RX 9070 (RDNA4), AMD driver 32.0.32015.7029, Ryzen 9 7945HX3D, Windows 11 Pro 26300, release.

How it was isolated (local, uncommitted debug code):

  1. A log line before and after each compute CreateComputePipelineState, with a hash of the DXIL and the console [SHADER] hash. A PSO with a "begin" and no "end" was in flight at the fault.
  2. Faults in 5 of 5 runs (2m24s to 6m55s in), also with XCL_PSO_PRELOAD=0. Three PSOs were in flight in both of the first two faults.
  3. A local switch that fails chosen PSOs before the driver call: failing two of the three → no fault in 5 minutes (the third, 1.7 MB of DXIL, built in 65 s); failing only the other one → the fault returns, with cs 62b584e061c05fc5's build begun and never finished.

Not tested: other AMD drivers or RDNA generations; a cold driver time for the HLSL form; a repro outside the title; direct-on-1426 66980c0 (pushed since; I expect the same per-instruction output). I can run a candidate fix or a debug build on this card.

AI use: Claude Code (Claude Opus 5.5) wrote the local debug logging, ran the isolation runs, and drafted this report.

**@⁠HKEY-Funk-Machine** on GitHub · 2026-11-24 17:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138733247) @⁠bmjask a second AMD driver fault in the direct path, isolated to one program (moved here from #1269 at @⁠gefydev's request). Counts, hashes and timings only; no DXIL or console container attached. **The fault:** `0xC0000005` in `amdxc64.dll+0x6800a4` (read at `0x0`), during `CreateComputePipelineState` of the direct path's DXIL for one compute program. It is not the `!llvm.ident` fault (`+0x1ab0cf7`), which is fixed. - Stack: `amdxc64.dll+0xb2dcb5, +0x67f0e1, +0x68b755, +0x6cf141, +0x1b189f, +0xa1a3b2` **The program:** console CS `[SHADER] cs 62b584e061c05fc5` (8 540 B console container, retail 1.0.2.1; `[SHADER]`'s FNV-64 of the container, findable in your own copy). | path | DXIL | `CreateComputePipelineState` on the RX 9070 | |---|---|---| | direct (`XCL_DIRECT_DXIL=1`) | **1 873 324 B**, byte-identical on both heads below | faults; never returns | | HLSL (`XCL_DIRECT_DXIL` unset, `XCL_TRANSLATED_CACHE=0`, `XCL_PSO_DISK_CACHE=0`) | **197 280 B** | builds, `S_OK` | The HLSL build reported 1 ms, which is almost certainly the AMD driver's own shader cache (it isn't covered by XCL's switches), so I don't have a cold driver time for the HLSL form. **Tested on:** `direct-on-1426` `6e6796a` and `a7cf078` (the latter on #1426 `bc93a3a`), each + #751 + #1288 (so the title's stall check doesn't end the run first) + a local patch that skips `InitializeApiImplEx2`; `XCL_NETWORK=0`. RX 9070 (RDNA4), AMD driver 32.0.32015.7029, Ryzen 9 7945HX3D, Windows 11 Pro 26300, release. **How it was isolated** (local, uncommitted debug code): 1. A log line before and after each compute `CreateComputePipelineState`, with a hash of the DXIL and the console `[SHADER]` hash. A PSO with a "begin" and no "end" was in flight at the fault. 2. Faults in 5 of 5 runs (2m24s to 6m55s in), also with `XCL_PSO_PRELOAD=0`. Three PSOs were in flight in both of the first two faults. 3. A local switch that fails chosen PSOs before the driver call: failing two of the three → no fault in 5 minutes (the third, 1.7 MB of DXIL, built in 65 s); failing only the other one → the fault returns, with `cs 62b584e061c05fc5`'s build begun and never finished. **Not tested:** other AMD drivers or RDNA generations; a cold driver time for the HLSL form; a repro outside the title; `direct-on-1426` `66980c0` (pushed since; I expect the same per-instruction output). I can run a candidate fix or a debug build on this card. **AI use:** Claude Code (Claude Opus 5.5) wrote the local debug logging, ran the isolation runs, and drafted this report.
Author
Owner

@⁠Sr-0w on GitHub · 2026-11-24 17:09 UTC · original

@⁠bmjask two things on bc93a3a.

1. The Lw constructor: I'll take it, as you offered ("or you can do it in your PR"). It goes on gefydev/xcl direct-on-1426, the stacked per-lane branch, as its own commit. translate_on_this_thread's setup becomes a pub fn Lw::new(...): the Shader and UAVs, the Lw literal, the SSA entry, the LDS / exchange-slot scan, setup_storage and the split partner. A matching finish / epilogue entry goes with it. translate_on_this_thread calls both, so #1426's own path does not change. I'll check that by running the whole gpu::dxil suite, with identical DXIL for the kernel tests. Ping me if you already started, and I'll drop mine. I won't touch the block-order change (writer emitting in reverse post-order); that one stays yours.

2. Why the fuzz seeds still fail on AMD (RX 7800 XT) after 55e9c3b: the driver gets 64-bit bfrev wrong. This is not the atomicrmw sub that NVIDIA refused. Seed 328, isolated value by value against the CPU interpreter:

  • v37: i64 = 7 on every lane, GPU and CPU agree;
  • v40 = DxUn(Rev, v37) (dx.op.bfrev.i64): CPU 0xe0000000_00000000, GPU 0xe0000000_e0000000.

The AMD driver reverses the low 32 bits and writes that into both halves. The translator emits bfrev.i64 for s_brev_b64, so retail programs hit it too, not only the fuzzer. The fix is a workaround for every vendor: bfrev(lo) and bfrev(hi) in i32, then swap the halves. Do you want it in #1426 or as a commit from me? I'll check the other three seeds (662, 1206, 1599) and half_precision_overloads_run the same way and post what they are.

AI use: Claude Code (Claude Opus 5.5) found the value and wrote this comment.

**@⁠Sr-0w** on GitHub · 2026-11-24 17:09 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138783966) @⁠bmjask two things on `bc93a3a`. **1. The `Lw` constructor: I'll take it, as you offered ("or you can do it in your PR").** It goes on `gefydev/xcl` `direct-on-1426`, the stacked per-lane branch, as its own commit. `translate_on_this_thread`'s setup becomes a `pub fn Lw::new(...)`: the `Shader` and UAVs, the `Lw` literal, the SSA entry, the LDS / exchange-slot scan, `setup_storage` and the split partner. A matching `finish` / epilogue entry goes with it. `translate_on_this_thread` calls both, so #1426's own path does not change. I'll check that by running the whole `gpu::dxil` suite, with identical DXIL for the kernel tests. Ping me if you already started, and I'll drop mine. I won't touch the block-order change (writer emitting in reverse post-order); that one stays yours. **2. Why the fuzz seeds still fail on AMD (RX 7800 XT) after `55e9c3b`: the driver gets 64-bit `bfrev` wrong.** This is not the `atomicrmw sub` that NVIDIA refused. Seed 328, isolated value by value against the CPU interpreter: - `v37: i64` = 7 on every lane, GPU and CPU agree; - `v40 = DxUn(Rev, v37)` (`dx.op.bfrev.i64`): CPU `0xe0000000_00000000`, **GPU `0xe0000000_e0000000`**. The AMD driver reverses the low 32 bits and writes that into both halves. The translator emits `bfrev.i64` for `s_brev_b64`, so retail programs hit it too, not only the fuzzer. The fix is a workaround for every vendor: `bfrev(lo)` and `bfrev(hi)` in i32, then swap the halves. Do you want it in #1426 or as a commit from me? I'll check the other three seeds (662, 1206, 1599) and `half_precision_overloads_run` the same way and post what they are. AI use: Claude Code (Claude Opus 5.5) found the value and wrote this comment.
Author
Owner

@⁠bmjask on GitHub · 2026-11-24 17:11 UTC · original

Pushed 7d24e97b4157:

  • Block layout (@⁠gefydev, @⁠Kalmarv): to_bitcode / finish now write the entry's blocks in reverse post-order of its CFG (entry first) and number values in that order, so a lowering may create blocks in any order. Unreachable blocks are dropped, along with their phi edges. Module::replace_all_uses(old, new) is added; it rewrites instruction and metadata operands. Test: blocks_are_written_in_reverse_post_order (a block targeted before its dominator exists, an unreachable block feeding a phi, and a trivial phi replaced). It validates and runs on the GPU.
  • Kalmarv's three commits are cherry-picked as is: the epilogue block after the program's blocks, with your VS/PS branch-before-export test; waveGetLaneIndex readonly; and TRANSLATOR_VERSION 2. That one bump also covers the layout change. Thanks!
  • AMD: thanks @⁠emirduran707, glad the crash is gone with !llvm.ident. The remaining wave64/RDNA failures (fuzz_validate_and_gpu_* vs the CPU interpreter, also seen by @⁠SlopTart on RADV; half_precision_overloads_run; wave_ops_match_cpu removing the device) are being looked at now. An audit of every dx.op declaration's attributes against DXC is part of that. @⁠SlopTart, the integer_ops_match_cpu crash with the old dxil-spirv pin is noted as outside this PR.
  • Size (@⁠Icey-Glitch): thanks, all four suggestions and the constraints list went into the cleanup work in progress (trivial phi removal via replace_all_uses, DCE/CSE of pure dx.op calls, a per-pass disable switch, and the loop budget kept exact).

The regression pair will be redone on the final head of this round; @⁠Kalmarv, thanks for the pair on bc93a3a6.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠bmjask.

**@⁠bmjask** on GitHub · 2026-11-24 17:11 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138810877) Pushed `7d24e97b4157`: - **Block layout (@⁠gefydev, @⁠Kalmarv):** `to_bitcode` / `finish` now write the entry's blocks in reverse post-order of its CFG (entry first) and number values in that order, so a lowering may create blocks in any order. Unreachable blocks are dropped, along with their phi edges. **`Module::replace_all_uses(old, new)`** is added; it rewrites instruction and metadata operands. Test: `blocks_are_written_in_reverse_post_order` (a block targeted before its dominator exists, an unreachable block feeding a phi, and a trivial phi replaced). It validates and runs on the GPU. - **Kalmarv's three commits** are cherry-picked as is: the epilogue block after the program's blocks, with your VS/PS branch-before-export test; `waveGetLaneIndex` readonly; and `TRANSLATOR_VERSION` 2. That one bump also covers the layout change. Thanks! - **AMD:** thanks @⁠emirduran707, glad the crash is gone with `!llvm.ident`. The remaining wave64/RDNA failures (`fuzz_validate_and_gpu_*` vs the CPU interpreter, also seen by @⁠SlopTart on RADV; `half_precision_overloads_run`; `wave_ops_match_cpu` removing the device) are being looked at now. An audit of every dx.op declaration's attributes against DXC is part of that. @⁠SlopTart, the `integer_ops_match_cpu` crash with the old dxil-spirv pin is noted as outside this PR. - **Size (@⁠Icey-Glitch):** thanks, all four suggestions and the constraints list went into the cleanup work in progress (trivial phi removal via `replace_all_uses`, DCE/CSE of pure dx.op calls, a per-pass disable switch, and the loop budget kept exact). The regression pair will be redone on the final head of this round; @⁠Kalmarv, thanks for the pair on `bc93a3a6`. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠bmjask.
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 17:13 UTC · original

@⁠bmjask thank you for the reverse-post-order block layout and Module::replace_all_uses (7d24e97). Our adapter now uses both, on direct-on-1426 rebased onto it. On the Lw constructor / epilogue split: @⁠Sr-0w does it in the per-lane branch, as you offered, so you do not need to split it out on #1426. His bfrev finding is for you here.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 17:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138877324) @⁠bmjask thank you for the reverse-post-order block layout and `Module::replace_all_uses` (`7d24e97`). Our adapter now uses both, on `direct-on-1426` rebased onto it. On the `Lw` constructor / epilogue split: @⁠Sr-0w does it in the per-lane branch, as you offered, so you do not need to split it out on #1426. His `bfrev` finding is for you here. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.
Author
Owner

@⁠Frtuchinno on GitHub · 2026-11-24 17:16 UTC · original

@⁠bmjask on half_precision_overloads_run, adding to @⁠mynzjerko's finding (an AMD driver bug, reproduced with DXC on RDNA4): the same on RDNA3, with a wider pattern and a test change you can take.

Pattern. The AMD Windows driver drops an fabs or fneg that feeds a wave reduction: the reduction runs on the unmodified value. It happens in f32 as well as f16, in wave32 and wave64, and with DXC's own HLSL. RX 7800 XT, driver 32.0.32029.2010, b = 5 - 0.5 * lane, value read from the last lane:

HLSL (DXC 1.9.2602.17) wave32 wave64
WaveActiveMax(abs(b)) 5 (want 10.5) 5 (want 26.5)
WaveActiveMax(-b) 5 (want 10.5) 5 (want 26.5)
WavePrefixSum(abs(b)) −98.5 (want 132.5) −714.5 (want 716.5)
WaveActiveMax(max(b, -b)) 5 (want 10.5) 5 (want 26.5)
WaveReadLaneAt(abs(b), last) 10.5 ✓ 26.5 ✓
WaveActiveMax(asfloat(asuint(b) & 0x7fffffff)) 10.5 ✓ 26.5 ✓

Through this PR's writer it is the same: the f16 WaveActiveMin(abs(hb)) gives −10.5 and the f16 WaveActiveSum(abs(hb)) gives −88 (the sum of hb). With an fpext between the fabs and the f32 reduction, the result is right.

Runtime impact: none found. Nothing outside the tests calls wave_active_op / wave_prefix_op. The HLSL path's only wave reductions are WaveActiveSum / WavePrefixSum of uints (emit.rs:4537, 4615).

Test change, one commit on 7d24e97: Frtuchinno/xcl amd-wave-reduction-modifier-test aa5992b (ops_tests.rs, +5 / −3). The f16 WaveActiveMax reduces fmax(ha, hb) instead of abs(hb), so it still covers the f16 overload, with a comment about the driver. Skip it if you'd rather keep the test failing on AMD as a marker.

Tested (RX 7800 XT, Ryzen 5 7600, Windows 11 Pro 26300, rustc 1.100.0 MSVC, DXC 1.9.2602.17, debug):

  • half_precision_overloads_run: 5.0 vs 10.5 without the change, passes with it, on both bc93a3a and 7d24e97.
  • cargo test -p xcl --lib -- gpu::dxil --skip wave_ops_match_cpu --test-threads=1 on bc93a3a: 67 passed, 5 failed before; 68 passed, 4 failed after. The 4 are fuzz_validate_and_gpu_0..3 (@⁠mynzjerko's Bfrev.i64 finding); the fuzzer emits no wave ops.

Not tested: RDNA2 and RDNA4 with the change, other driver versions, the whole gpu::dxil group on 7d24e97.

AI use: Claude Code (Claude Opus 5.5) wrote the probes and the test change, ran the commands above and wrote this.

**@⁠Frtuchinno** on GitHub · 2026-11-24 17:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138939411) @⁠bmjask on `half_precision_overloads_run`, adding to @⁠mynzjerko's finding (an AMD driver bug, reproduced with DXC on RDNA4): the same on RDNA3, with a wider pattern and a test change you can take. **Pattern.** The AMD Windows driver drops an `fabs` or `fneg` that feeds a wave reduction: the reduction runs on the unmodified value. It happens in f32 as well as f16, in wave32 and wave64, and with DXC's own HLSL. RX 7800 XT, driver 32.0.32029.2010, `b = 5 - 0.5 * lane`, value read from the last lane: | HLSL (DXC 1.9.2602.17) | wave32 | wave64 | |---|---|---| | `WaveActiveMax(abs(b))` | 5 (want 10.5) | 5 (want 26.5) | | `WaveActiveMax(-b)` | 5 (want 10.5) | 5 (want 26.5) | | `WavePrefixSum(abs(b))` | −98.5 (want 132.5) | −714.5 (want 716.5) | | `WaveActiveMax(max(b, -b))` | 5 (want 10.5) | 5 (want 26.5) | | `WaveReadLaneAt(abs(b), last)` | 10.5 ✓ | 26.5 ✓ | | `WaveActiveMax(asfloat(asuint(b) & 0x7fffffff))` | 10.5 ✓ | 26.5 ✓ | Through this PR's writer it is the same: the f16 `WaveActiveMin(abs(hb))` gives −10.5 and the f16 `WaveActiveSum(abs(hb))` gives −88 (the sum of `hb`). With an `fpext` between the `fabs` and the f32 reduction, the result is right. **Runtime impact: none found.** Nothing outside the tests calls `wave_active_op` / `wave_prefix_op`. The HLSL path's only wave reductions are `WaveActiveSum` / `WavePrefixSum` of uints (`emit.rs:4537`, `4615`). **Test change**, one commit on `7d24e97`: [`Frtuchinno/xcl` `amd-wave-reduction-modifier-test` `aa5992b`](https://github.com/Frtuchinno/xcl/commit/aa5992b) (`ops_tests.rs`, +5 / −3). The f16 `WaveActiveMax` reduces `fmax(ha, hb)` instead of `abs(hb)`, so it still covers the f16 overload, with a comment about the driver. Skip it if you'd rather keep the test failing on AMD as a marker. **Tested** (RX 7800 XT, Ryzen 5 7600, Windows 11 Pro 26300, rustc 1.100.0 MSVC, DXC 1.9.2602.17, debug): - `half_precision_overloads_run`: 5.0 vs 10.5 without the change, passes with it, on both `bc93a3a` and `7d24e97`. - `cargo test -p xcl --lib -- gpu::dxil --skip wave_ops_match_cpu --test-threads=1` on `bc93a3a`: 67 passed, 5 failed before; 68 passed, 4 failed after. The 4 are `fuzz_validate_and_gpu_0..3` (@⁠mynzjerko's `Bfrev.i64` finding); the fuzzer emits no wave ops. **Not tested:** RDNA2 and RDNA4 with the change, other driver versions, the whole `gpu::dxil` group on `7d24e97`. AI use: Claude Code (Claude Opus 5.5) wrote the probes and the test change, ran the commands above and wrote this.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 17:21 UTC · original

Test report — RTX 3060 Ti (Windows 11), DXC dxcompiler 1.8.2502.11, branch merged with current main (b7aa9f3):

cargo test -p xcl --lib crashes the test process — deterministic, both parallel and --test-threads=1:

test gpu::dxil::validate::tests::malformed_containers_are_errors ... error: Invalid bitcode signature
error: test failed ... (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

The crash happens inside malformed_containers_are_errors itself — it never prints ok. The test's whole point is that malformed DXBC comes back as Err "never as a panic or UB in the FFI glue", but the process dies with an access violation while iterating the malformed inputs (after validate prints the bitcode-signature error — the crash is likely in the following disassemble(c) FFI call or a later validate on the truncated container). So the FFI boundary still has an unguarded path for malformed input.

All gpu::dxil tests that run before it pass, including emitted_kernel_runs_on_the_gpu.

**@⁠DavidM1911** on GitHub · 2026-11-24 17:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7139069538) Test report — RTX 3060 Ti (Windows 11), DXC dxcompiler 1.8.2502.11, branch merged with current `main` (`b7aa9f3`): `cargo test -p xcl --lib` **crashes the test process** — deterministic, both parallel and `--test-threads=1`: ``` test gpu::dxil::validate::tests::malformed_containers_are_errors ... error: Invalid bitcode signature error: test failed ... (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION) ``` The crash happens *inside* `malformed_containers_are_errors` itself — it never prints `ok`. The test's whole point is that malformed DXBC comes back as `Err` "never as a panic or UB in the FFI glue", but the process dies with an access violation while iterating the malformed inputs (after `validate` prints the bitcode-signature error — the crash is likely in the following `disassemble(c)` FFI call or a later `validate` on the truncated container). So the FFI boundary still has an unguarded path for malformed input. All `gpu::dxil` tests that run before it pass, including `emitted_kernel_runs_on_the_gpu`.
Author
Owner

@⁠vitor127wt on GitHub · 2026-11-24 17:05 UTC · original · edited 2026-11-24 17:28 UTC

Targeted Blackwell fuzz results on Linux / Wine

I tested clean direct-on-1426 head a7cf0784c0eeb2e372b9cce48b1cf7f03f083e4a, which includes #1426's bc93a3a6f1d5 fuzzer change. I selected the four previously reported seeds (62, 545, 1019, 1507) and added 70 after seeing the Windows report on the same head. All 5 passed DXIL validation, created a compute pipeline, and matched the CPU interpreter with zero mismatches. Windows report on a7cf078

I cross-built the unmodified release test binary with cargo xwin test --offline --locked --target x86_64-pc-windows-msvc --release -p xcl --lib --no-run. For each seed I started a fresh Wine process with FUZZ_SEED=<seed> and ran --ignored --exact gpu::dxil::fuzz_tests::debug_seed --nocapture --test-threads=1. Each run printed validator Ok(()), gpu_safe true, and GPU run: 0 mismatching results. This covers isolated seeds through DXIL-to-SPIR-V under Wine.

RTX 5070 Ti (16 GB), NVIDIA Linux driver 620.73.04, Ryzen 7 9700X, CachyOS x86-64 kernel 7.3.5-2-cachyos, Wine 11.22, vkd3d-proton ec20719452e916b, DXC/validator 1.9.2609.5.

Follow-up with the Windows SDK’s DXC 1.8.2502.11

I reran the five seeds on the same test binary at a7cf078, with the same GPU, Wine and vkd3d-proton. I changed only XCL_DXC_DIR between 1.8.2502.11 and 1.9.2609.5. Both versions passed 5/5 validator checks and GPU/CPU comparisons, with zero pipeline refusals or result mismatches. The loader printed the expected dxcompiler.dll and dxil.dll versions for every seed. Microsoft SDK package 10.0.26100.7175

The standalone DXC release 1.8.2502.8 also passed the same five isolated cases. This comparison covers individual debug_seed runs under Wine. Windows results with DXC 1.8.2502.11

AI use — Codex (GPT-6 family, exact variant unavailable) built the binary, ran the tests, and drafted this report. Codex also ran the matched DXC version comparison.

**@⁠vitor127wt** on GitHub · 2026-11-24 17:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7138665349) · edited 2026-11-24 17:28 UTC **Targeted Blackwell fuzz results on Linux / Wine** I tested clean `direct-on-1426` head `a7cf0784c0eeb2e372b9cce48b1cf7f03f083e4a`, which includes #1426's `bc93a3a6f1d5` fuzzer change. I selected the four previously reported seeds (`62`, `545`, `1019`, `1507`) and added `70` after seeing the Windows report on the same head. All **5 passed DXIL validation, created a compute pipeline, and matched the CPU interpreter with zero mismatches**. [Windows report on `a7cf078`](https://github.com/ivall/xcl/issues/1269#issuecomment-7138562803) I cross-built the unmodified release test binary with `cargo xwin test --offline --locked --target x86_64-pc-windows-msvc --release -p xcl --lib --no-run`. For each seed I started a fresh Wine process with `FUZZ_SEED=<seed>` and ran `--ignored --exact gpu::dxil::fuzz_tests::debug_seed --nocapture --test-threads=1`. Each run printed validator `Ok(())`, `gpu_safe true`, and `GPU run: 0 mismatching results`. This covers isolated seeds through DXIL-to-SPIR-V under Wine. RTX 5070 Ti (16 GB), NVIDIA Linux driver 620.73.04, Ryzen 7 9700X, CachyOS x86-64 kernel `7.3.5-2-cachyos`, Wine 11.22, vkd3d-proton `ec20719452e916b`, DXC/validator `1.9.2609.5`. **Follow-up with the Windows SDK’s DXC 1.8.2502.11** I reran the five seeds on the same test binary at `a7cf078`, with the same GPU, Wine and vkd3d-proton. I changed only `XCL_DXC_DIR` between **1.8.2502.11** and **1.9.2609.5**. Both versions passed **5/5** validator checks and GPU/CPU comparisons, with zero pipeline refusals or result mismatches. The loader printed the expected `dxcompiler.dll` and `dxil.dll` versions for every seed. [Microsoft SDK package `10.0.26100.7175`](https://www.nuget.org/packages/Microsoft.Windows.SDK.CPP/10.0.26100.7175) The standalone DXC release `1.8.2502.8` also passed the same five isolated cases. This comparison covers individual `debug_seed` runs under Wine. [Windows results with DXC 1.8.2502.11](https://git.gtahub.st/github/xcl-dev--xcl/issues/1269) **AI use** — Codex (GPT-6 family, exact variant unavailable) built the binary, ran the tests, and drafted this report. Codex also ran the matched DXC version comparison.
Author
Owner

@⁠upipibi on GitHub · 2026-11-24 17:30 UTC · original

@⁠bmjask on the malformed_containers_are_errors crash DavidM1911 reported above (#1426): I see the same on an RTX 3070. It happens on every run, with dxcompiler 1.8.2502.11 (the Windows SDK's). It is one input, b"DXBC", in validate.

I printed each step: &[] goes through validate and disassemble. The process then dies inside validate(b"DXBC") (0xc0000005), before disassemble is called. The other inputs (64 zero bytes, half and all-but-4 of the good container) come back as Err from DXC itself. So DXC 1.8's validator reads the whole 32-byte container header of anything that starts with DXBC, past the end of the 4-byte blob.

Refusing input shorter than a header before DXC sees it fixes it here (gpu::dxil::validate 1 passed, 0 failed, on direct-on-1426 c391dbf). The patch, if you want it:

@@ -81,6 +81,7 @@ pub fn validator_supported() -> bool {
 /// `SKIPPED <test>: validator <ver> < 1.8` line once per test): emitted shaders do not need
 /// the validator at run time, and the GPU tests still run. Malformed containers still fail.
 pub fn validate(container: &[u8]) -> Result<(), String> {
+    header_fits(container)?;
     let v: IDxcValidator = instance(compiler_create()?, &CLSID_DxcValidator)?;
     let b = blob(container)?;
     unsafe {
@@ -117,8 +118,19 @@ pub fn skip_validation() {
     let _ = writeln!(std::io::stderr(), "SKIPPED {}: validator {major}.{minor} < {}.{} (validation step only)", thread.name().unwrap_or("?"), VALVER.0, VALVER.1);
 }
 
+/// Refuses input shorter than a container header (32 bytes) before DXC sees it: DXC 1.8's
+/// validator (dxcompiler 1.8.2502.11, the Windows SDK's) reads the whole header of a blob
+/// that starts with `DXBC`, past the end of a shorter one (`b"DXBC"` faults in it).
+fn header_fits(container: &[u8]) -> Result<(), String> {
+    if container.len() < 32 {
+        return Err(format!("not a DXIL container: {} bytes, shorter than its 32-byte header", container.len()));
+    }
+    Ok(())
+}
+
 /// DXC's textual disassembly of a container (for diagnostics and tests).
 pub fn disassemble(container: &[u8]) -> Result<String, String> {
+    header_fits(container)?;
     let c: IDxcCompiler3 = instance(compiler_create()?, &CLSID_DxcCompiler)?;
     let buf = DxcBuffer { Ptr: container.as_ptr() as *const c_void, Size: container.len(), Encoding: 0 };
     unsafe {

Not tested: DXC 1.9, where the test doesn't crash; AMD.

AI use: Claude Code (Claude Opus 5.5) found the input and wrote the patch and this comment.

**@⁠upipibi** on GitHub · 2026-11-24 17:30 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7139304491) @⁠bmjask on the `malformed_containers_are_errors` crash DavidM1911 reported above (https://git.gtahub.st/github/xcl-dev--xcl/pulls/1426): I see the same on an RTX 3070. It happens on every run, with `dxcompiler` 1.8.2502.11 (the Windows SDK's). It is one input, `b"DXBC"`, in `validate`. I printed each step: `&[]` goes through `validate` and `disassemble`. The process then dies inside `validate(b"DXBC")` (`0xc0000005`), before `disassemble` is called. The other inputs (64 zero bytes, half and all-but-4 of the good container) come back as `Err` from DXC itself. So DXC 1.8's validator reads the whole 32-byte container header of anything that starts with `DXBC`, past the end of the 4-byte blob. Refusing input shorter than a header before DXC sees it fixes it here (`gpu::dxil::validate` 1 passed, 0 failed, on `direct-on-1426` `c391dbf`). The patch, if you want it: ```diff @@ -81,6 +81,7 @@ pub fn validator_supported() -> bool { /// `SKIPPED <test>: validator <ver> < 1.8` line once per test): emitted shaders do not need /// the validator at run time, and the GPU tests still run. Malformed containers still fail. pub fn validate(container: &[u8]) -> Result<(), String> { + header_fits(container)?; let v: IDxcValidator = instance(compiler_create()?, &CLSID_DxcValidator)?; let b = blob(container)?; unsafe { @@ -117,8 +118,19 @@ pub fn skip_validation() { let _ = writeln!(std::io::stderr(), "SKIPPED {}: validator {major}.{minor} < {}.{} (validation step only)", thread.name().unwrap_or("?"), VALVER.0, VALVER.1); } +/// Refuses input shorter than a container header (32 bytes) before DXC sees it: DXC 1.8's +/// validator (dxcompiler 1.8.2502.11, the Windows SDK's) reads the whole header of a blob +/// that starts with `DXBC`, past the end of a shorter one (`b"DXBC"` faults in it). +fn header_fits(container: &[u8]) -> Result<(), String> { + if container.len() < 32 { + return Err(format!("not a DXIL container: {} bytes, shorter than its 32-byte header", container.len())); + } + Ok(()) +} + /// DXC's textual disassembly of a container (for diagnostics and tests). pub fn disassemble(container: &[u8]) -> Result<String, String> { + header_fits(container)?; let c: IDxcCompiler3 = instance(compiler_create()?, &CLSID_DxcCompiler)?; let buf = DxcBuffer { Ptr: container.as_ptr() as *const c_void, Size: container.len(), Encoding: 0 }; unsafe { ``` Not tested: DXC 1.9, where the test doesn't crash; AMD. AI use: Claude Code (Claude Opus 5.5) found the input and wrote the patch and this comment.
Author
Owner

@⁠HKEY-Funk-Machine on GitHub · 2026-11-24 17:51 UTC · original

@⁠bmjask 424d315 on the RX 9070 (RDNA4): the AMD workarounds and the size fix work here, but the amdxc64.dll+0x6800a4 fault from my report above still hits the same program.

Setup: RX 9070, AMD driver 32.0.32015.7029 · Ryzen 9 7945HX3D · 32 GB · Windows 11 Pro 26300 · Rust 1.100.0 · release · DXC 1.9.2602.17 (oracle only).

1. gpu::dxil, each of the 86 tests run alone (--exact), clean 424d315: 84 passed, 2 failed, 0 crashes (on 065aef3 + !llvm.ident: 61 passed, 6 failed).

  • Now passing here: ops_tests::wave_ops_match_cpu (no device removal), ops_tests::half_precision_overloads_run, fuzz_validate_and_gpu_0 and _2.
  • Still failing:
    • fuzz_validate_and_gpu_3, seed 1599: res[193] = 0x1, CPU 0x0, the same value as before dc2d8f1, although its message lists 1599 among the Bfrev.i64 seeds.
    • fuzz_validate_and_gpu_1, now seed 722: res[30] = 0x1, CPU 0x7fffffff (its old seed 662 passes).

2. Retail title, 424d315 + #751 + #1288 + a local patch that skips InitializeApiImplEx2, XCL_DIRECT_DXIL=1, XCL_PSO_PRELOAD=0, XCL_NETWORK=0, with my local begin/end log around each compute CreateComputePipelineState:

  • The size fix shows: 36 compute PSOs built, mean 50 KB of DXIL and 0.64 s of driver time, longest 8.7 s, 0 fallbacks to HLSL. On 6e6796a it was 398 KB and 6.9 s per PSO, and the HLSL path in my #1288 run was 1.99 s per PSO (different programs, so a rough comparison).
  • cs 62b584e061c05fc5: its DXIL went from 1 848 428 B (7d24e97; 1 873 324 B before that) to 207 120 B, about the HLSL path's 197 280 B.
  • The fault still hits: same amdxc64.dll+0x6800a4 (read at 0x0) after 2m17s, with this program's build begun and never finished, as on 6e6796a, a7cf078 and 7d24e97. So it isn't the module's size. Five PSOs were in flight in this run; the program was isolated by failing the others in the earlier runs.

Not tested: 2851585 (pushed while this ran; it merges main and, for the direct path, only refuses heap windows, which these runs don't use); the full workspace suite on this head; isolating the fault again at 424d315 by failing the other in-flight PSOs (it's the one program common to every fault so far); other AMD drivers. I can test a candidate change to this program's lowering, or a debug build that logs more, on this card.

AI use: Claude Code (Claude Opus 5.5) ran the tests and the title runs, extracted the numbers from the logs, and drafted this report.

**@⁠HKEY-Funk-Machine** on GitHub · 2026-11-24 17:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7139805807) @⁠bmjask `424d315` on the RX 9070 (RDNA4): the AMD workarounds and the size fix work here, but the `amdxc64.dll+0x6800a4` fault from my report above still hits the same program. **Setup:** RX 9070, AMD driver 32.0.32015.7029 · Ryzen 9 7945HX3D · 32 GB · Windows 11 Pro 26300 · Rust 1.100.0 · release · DXC 1.9.2602.17 (oracle only). **1. `gpu::dxil`, each of the 86 tests run alone** (`--exact`), clean `424d315`: **84 passed, 2 failed, 0 crashes** (on `065aef3` + `!llvm.ident`: 61 passed, 6 failed). - Now passing here: `ops_tests::wave_ops_match_cpu` (no device removal), `ops_tests::half_precision_overloads_run`, `fuzz_validate_and_gpu_0` and `_2`. - Still failing: - `fuzz_validate_and_gpu_3`, **seed 1599**: `res[193] = 0x1, CPU 0x0`, the same value as before `dc2d8f1`, although its message lists 1599 among the `Bfrev.i64` seeds. - `fuzz_validate_and_gpu_1`, now **seed 722**: `res[30] = 0x1, CPU 0x7fffffff` (its old seed 662 passes). **2. Retail title**, `424d315` + #751 + #1288 + a local patch that skips `InitializeApiImplEx2`, `XCL_DIRECT_DXIL=1`, `XCL_PSO_PRELOAD=0`, `XCL_NETWORK=0`, with my local begin/end log around each compute `CreateComputePipelineState`: - **The size fix shows:** 36 compute PSOs built, mean 50 KB of DXIL and **0.64 s** of driver time, longest 8.7 s, 0 fallbacks to HLSL. On `6e6796a` it was 398 KB and 6.9 s per PSO, and the HLSL path in my #1288 run was 1.99 s per PSO (different programs, so a rough comparison). - **`cs 62b584e061c05fc5`**: its DXIL went from 1 848 428 B (`7d24e97`; 1 873 324 B before that) to **207 120 B**, about the HLSL path's 197 280 B. - **The fault still hits**: same `amdxc64.dll+0x6800a4` (read at `0x0`) after 2m17s, with this program's build begun and never finished, as on `6e6796a`, `a7cf078` and `7d24e97`. So it isn't the module's size. Five PSOs were in flight in this run; the program was isolated by failing the others in the earlier runs. **Not tested:** `2851585` (pushed while this ran; it merges `main` and, for the direct path, only refuses heap windows, which these runs don't use); the full workspace suite on this head; isolating the fault again at `424d315` by failing the other in-flight PSOs (it's the one program common to every fault so far); other AMD drivers. I can test a candidate change to this program's lowering, or a debug build that logs more, on this card. **AI use:** Claude Code (Claude Opus 5.5) ran the tests and the title runs, extracted the numbers from the logs, and drafted this report.
Author
Owner

@⁠LocranKing on GitHub · 2026-11-24 17:54 UTC · original

Independent Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB Ampere, wave32, DXC 1.9.2602.17) test and 3-mode retail smoke report on 424d315372d60948b79422b1976ef8d486632b49 (following an earlier run on bc93a3a6f1d5ce2f5836135b231bd5e09e8d1658):

  • Suite (default): 837 passed, 0 failed, 43 ignored (gpu::dxil: 84 passed, 0 failed).
  • Suite (XCL_DIRECT_DXIL=1, gpu::): 370 passed, 0 failed, 20 ignored (gpu::dxil: 84 passed, 0 failed).
  • Reverse post-order / graphics branch fix confirmed on retail (XCL_DIRECT_DXIL=all):
    • On bc93a3a, 60 s of XCL_DIRECT_DXIL=all logged 8 [SHADER] direct DXIL fallbacks to the HLSL path across Vertex and Pixel stages (direct DXIL builder error: forward reference to value ... (blocks must be in dominance order)).
    • On 424d315, 60 s of XCL_DIRECT_DXIL=all logged 0 [SHADER] direct DXIL fallbacks (1614 frames, 60 61 60 presents/2 s, 16384 draws, 1386 dispatches, 0 skipped, 0 device removals / crashes, 14714 MB peak commit).
    • XCL_DIRECT_DXIL=1 also ran cleanly with 0 [SHADER] direct DXIL fallbacks (1567 frames, 14716 MB peak commit).

Tested

  • Commit: 424d315372d60948b79422b1976ef8d486632b49 (clean tree, merge-base 930e8b4)
  • Hardware / software: Windows 11 Home Build 26200, AMD Ryzen 5 5500, 31.8 GB RAM, NVIDIA GeForce RTX 3060 Ti (8024 MiB VRAM, driver 32.0.16.2101), rustc 1.100.0 (x86_64-pc-windows-msvc, MSVC 14.44.35207), DXC 1.9.2602.17 (SDK 10.0.26100.0), --release
  • cargo build --release --workspace: ok (exit 0)
  • cargo test --workspace --release --no-fail-fast -- --test-threads=4: 837 passed, 0 failed, 43 ignored, exit 0
  • XCL_DIRECT_DXIL=1 cargo test -p xcl --release --lib gpu:: --no-fail-fast -- --test-threads=4: 370 passed, 0 failed, 20 ignored, exit 0
  • SKIPPED (no wave64): gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask, gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware

Regression run (main vs 424d315 default / =1 / =all)
main baseline (b7aa9f3bd212088e0d927439284dc5ed325ce3c7):

xcl-smoke v1
commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1508 (PresentX 1508)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14730 MB

PR 424d315 (XCL_DIRECT_DXIL unset):

xcl-smoke v1
commit: 424d315372d60948b79422b1976ef8d486632b49
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1572 (PresentX 1572)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14715 MB

PR 424d315 (XCL_DIRECT_DXIL=1):

xcl-smoke v1
commit: 424d315372d60948b79422b1976ef8d486632b49
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1567 (PresentX 1567)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14716 MB

PR 424d315 (XCL_DIRECT_DXIL=all):

xcl-smoke v1
commit: 424d315372d60948b79422b1976ef8d486632b49
gpu: NVIDIA GeForce RTX 3060 Ti
title: retail-1.0.2.1
seconds: 60
exit: 0x0
frames shown: 1614 (PresentX 1614)
presents per 2 s (last 3): 60 61 60
device removals: 0
crashes: 0
peak commit: 14714 MB

Not tested: debug build, DXC 1.8, AMD / Intel / native wave64 hardware, extended past-menu world load beyond 60 s.

AI use: Antigravity (Gemini 4 Neon) ran the builds, tests, and smoke runs and drafted this report from the command outputs.

**@⁠LocranKing** on GitHub · 2026-11-24 17:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7139876887) Independent Windows 11 + NVIDIA GeForce RTX 3060 Ti (8 GB Ampere, wave32, DXC 1.9.2602.17) test and 3-mode retail smoke report on `424d315372d60948b79422b1976ef8d486632b49` (following an earlier run on `bc93a3a6f1d5ce2f5836135b231bd5e09e8d1658`): - **Suite (default):** **837 passed, 0 failed, 43 ignored** (`gpu::dxil`: **84 passed, 0 failed**). - **Suite (`XCL_DIRECT_DXIL=1`, `gpu::`):** **370 passed, 0 failed, 20 ignored** (`gpu::dxil`: **84 passed, 0 failed**). - **Reverse post-order / graphics branch fix confirmed on retail (`XCL_DIRECT_DXIL=all`):** - On `bc93a3a`, 60 s of `XCL_DIRECT_DXIL=all` logged **8** `[SHADER] direct DXIL` fallbacks to the HLSL path across `Vertex` and `Pixel` stages (`direct DXIL builder error: forward reference to value ... (blocks must be in dominance order)`). - On `424d315`, 60 s of `XCL_DIRECT_DXIL=all` logged **0** `[SHADER] direct DXIL` fallbacks (`1614` frames, `60 61 60` presents/2 s, `16384` draws, `1386` dispatches, `0` skipped, `0` device removals / crashes, `14714 MB` peak commit). - `XCL_DIRECT_DXIL=1` also ran cleanly with **0** `[SHADER] direct DXIL` fallbacks (`1567` frames, `14716 MB` peak commit). **Tested** - Commit: `424d315372d60948b79422b1976ef8d486632b49` (clean tree, merge-base `930e8b4`) - Hardware / software: Windows 11 Home Build 26200, AMD Ryzen 5 5500, 31.8 GB RAM, NVIDIA GeForce RTX 3060 Ti (`8024 MiB VRAM`, driver `32.0.16.2101`), `rustc 1.100.0` (`x86_64-pc-windows-msvc`, MSVC `14.44.35207`), DXC `1.9.2602.17` (SDK `10.0.26100.0`), `--release` - `cargo build --release --workspace`: ok (`exit 0`) - `cargo test --workspace --release --no-fail-fast -- --test-threads=4`: **837 passed, 0 failed, 43 ignored**, exit `0` - `XCL_DIRECT_DXIL=1 cargo test -p xcl --release --lib gpu:: --no-fail-fast -- --test-threads=4`: **370 passed, 0 failed, 20 ignored**, exit `0` - `SKIPPED` (`no wave64`): `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask`, `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware` **Regression run (`main` vs `424d315` default / `=1` / `=all`)** `main` baseline (`b7aa9f3bd212088e0d927439284dc5ed325ce3c7`): ``` xcl-smoke v1 commit: b7aa9f3bd212088e0d927439284dc5ed325ce3c7 gpu: NVIDIA GeForce RTX 3060 Ti title: retail-1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1508 (PresentX 1508) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14730 MB ``` PR `424d315` (`XCL_DIRECT_DXIL` unset): ``` xcl-smoke v1 commit: 424d315372d60948b79422b1976ef8d486632b49 gpu: NVIDIA GeForce RTX 3060 Ti title: retail-1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1572 (PresentX 1572) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14715 MB ``` PR `424d315` (`XCL_DIRECT_DXIL=1`): ``` xcl-smoke v1 commit: 424d315372d60948b79422b1976ef8d486632b49 gpu: NVIDIA GeForce RTX 3060 Ti title: retail-1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1567 (PresentX 1567) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14716 MB ``` PR `424d315` (`XCL_DIRECT_DXIL=all`): ``` xcl-smoke v1 commit: 424d315372d60948b79422b1976ef8d486632b49 gpu: NVIDIA GeForce RTX 3060 Ti title: retail-1.0.2.1 seconds: 60 exit: 0x0 frames shown: 1614 (PresentX 1614) presents per 2 s (last 3): 60 61 60 device removals: 0 crashes: 0 peak commit: 14714 MB ``` **Not tested:** debug build, DXC 1.8, AMD / Intel / native wave64 hardware, extended past-menu world load beyond 60 s. **AI use:** Antigravity (`Gemini 4 Neon`) ran the builds, tests, and smoke runs and drafted this report from the command outputs.
Author
Owner

@⁠bmjask on GitHub · 2026-11-24 17:59 UTC · original

Status at def2134c32f4 (both checks should go green with the new regression pair in the description):

  • @⁠DavidM1911, @⁠upipibi: the DXC 1.8 crash in malformed_containers_are_errors is fixed with upipibi's patch as posted. validate and disassemble now refuse input shorter than the 32-byte header before DXC sees it. Thanks for pinning it to b"DXBC".
  • @⁠LocranKing: thanks for the three-mode retail run. Good to see 0 fallbacks with =all after the reverse post-order change, against 8 on bc93a3a.
  • @⁠HKEY-Funk-Machine: thanks, this is very useful. The fixes that now pass on RDNA4 (wave_ops_match_cpu, half precision, fuzz 0/2) and the size drop (1.85 MB → 207 KB for cs 62b584e061c05fc5, 0.64 s mean driver time) are good news. For the amdxc64.dll+0x6800a4 fault on that one program, and fuzz seeds 1599 / 722: I'm diffing that program's direct DXIL against the HLSL path's for constructs only we emit, and reducing the two seeds. I'll post a build with env knobs to bisect it on your card in one go. Since this happens only with the opt-in XCL_DIRECT_DXIL=1 and on one program, I'd suggest it doesn't block this base PR; the default path is unchanged.
  • Main: merged up to 9e3831e. The new heap memory windows (XCL_HEAP_WINDOWS) are refused by the direct path, so those shaders take HLSL.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠bmjask.

**@⁠bmjask** on GitHub · 2026-11-24 17:59 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7139999302) Status at `def2134c32f4` (both checks should go green with the new regression pair in the description): - **@⁠DavidM1911, @⁠upipibi:** the DXC 1.8 crash in `malformed_containers_are_errors` is fixed with upipibi's patch as posted. `validate` and `disassemble` now refuse input shorter than the 32-byte header before DXC sees it. Thanks for pinning it to `b"DXBC"`. - **@⁠LocranKing:** thanks for the three-mode retail run. Good to see 0 fallbacks with `=all` after the reverse post-order change, against 8 on `bc93a3a`. - **@⁠HKEY-Funk-Machine:** thanks, this is very useful. The fixes that now pass on RDNA4 (`wave_ops_match_cpu`, half precision, fuzz 0/2) and the size drop (1.85 MB → 207 KB for `cs 62b584e061c05fc5`, 0.64 s mean driver time) are good news. For the `amdxc64.dll+0x6800a4` fault on that one program, and fuzz seeds 1599 / 722: I'm diffing that program's direct DXIL against the HLSL path's for constructs only we emit, and reducing the two seeds. I'll post a build with env knobs to bisect it on your card in one go. Since this happens only with the opt-in `XCL_DIRECT_DXIL=1` and on one program, I'd suggest it doesn't block this base PR; the default path is unchanged. - **Main:** merged up to `9e3831e`. The new heap memory windows (`XCL_HEAP_WINDOWS`) are refused by the direct path, so those shaders take HLSL. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠bmjask.
Author
Owner

@⁠Fisers on GitHub · 2026-11-24 18:02 UTC · original

RX 6800 retest of two AMD failures

Both previously failing tests now pass on clean PR revisions 424d315372d60948b79422b1976ef8d486632b49 and def2134c32f4e17fa834c4e7fcd39468e19388cc.

Test 424d315 def2134
half_precision_overloads_run Pass Pass
wave_ops_match_cpu Pass Pass

Each revision: 2 passed, 0 failed, 0 ignored, 0 skipped. Each test ran in a separate process.

Setup: Radeon RX 6800 16 GB (RDNA2), driver 32.0.21030.2001, Ryzen 5 7600X, 32 GB RAM, Windows 11 Pro build 26300.9457, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug build. XCL_ADAPTER="RX 6800", XCL_REQUIRE_GPU=1.

cargo +stable test --offline --locked -p xcl --lib half_precision_overloads_run -- --test-threads=1 --nocapture
cargo +stable test --offline --locked -p xcl --lib wave_ops_match_cpu -- --test-threads=1 --nocapture

Not tested: Full suite, fuzz failures, and the retail title.

AI use: Codex (gpt-6.2-sol) ran the tests and wrote this report.

**@⁠Fisers** on GitHub · 2026-11-24 18:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140074762) ### RX 6800 retest of two AMD failures Both previously failing tests now pass on clean PR revisions `424d315372d60948b79422b1976ef8d486632b49` and `def2134c32f4e17fa834c4e7fcd39468e19388cc`. | Test | `424d315` | `def2134` | |---|---|---| | `half_precision_overloads_run` | Pass | Pass | | `wave_ops_match_cpu` | Pass | Pass | Each revision: **2 passed, 0 failed, 0 ignored, 0 skipped**. Each test ran in a separate process. **Setup:** Radeon RX 6800 16 GB (RDNA2), driver `32.0.21030.2001`, Ryzen 5 7600X, 32 GB RAM, Windows 11 Pro build `26300.9457`, Rust 1.100.0 MSVC, DXC 1.9.2602.17, debug build. `XCL_ADAPTER="RX 6800"`, `XCL_REQUIRE_GPU=1`. ```powershell cargo +stable test --offline --locked -p xcl --lib half_precision_overloads_run -- --test-threads=1 --nocapture cargo +stable test --offline --locked -p xcl --lib wave_ops_match_cpu -- --test-threads=1 --nocapture ``` **Not tested:** Full suite, fuzz failures, and the retail title. **AI use:** Codex (`gpt-6.2-sol`) ran the tests and wrote this report.
Author
Owner

@⁠RockFellerX on GitHub · 2026-11-24 18:06 UTC · original · edited 2026-11-24 18:11 UTC

RDNA 2 (RX 6750 XT) verification on 424d315 / def2134 plus 4 clean workaround commits clearing the remaining gpu::dxil fuzz failures on RDNA 2 (and seed 1599 also reported on RDNA 4).

What dc2d8f1 (424d315) already fixed on RDNA 2

  • wave_ops_match_cpu (no longer removes the device), half_precision_overloads_run (credit @⁠mynzjerko / @⁠Frtuchinno), dx_op_attrs_match_dxc, fuzz_validate_and_gpu_0, and fuzz_validate_and_gpu_2 all pass on clean 424d315.
  • On clean 424d315, cargo test -p xcl --lib gpu::dxil -- --test-threads=4 drops to 82 passed, 2 failed, 2 ignored:
    • fuzz_validate_and_gpu_1: fails at seed 540: res[833] = 0x7, CPU 0x6
    • fuzz_validate_and_gpu_3: fails at seed 1599: res[193] = 0x1, CPU 0x0 (same failure @⁠HKEY-Funk-Machine saw on RX 9070 / RDNA 4)

Remaining AMD / RDNA 2 driver bugs isolated & fixed (4 patches on def2134)

Hardware probes on RX 6750 XT (amdxc64.dll 32.0.21045.16010) isolated four distinct miscompilations:

  1. sext i1 to i64 zero-extends the upper 32 bits on RDNA 2 (seed 540)
    • On RX 6750 XT, sext i1 true to i64 evaluates to 0x00000000_ffffffff instead of 0xffffffff_ffffffff (whereas sext i1 to i32 is 0xffffffff, and select i1 %c, i64 -1, i64 0 is 0xffffffff_ffffffff). That caused ashr in seed 540 to shift out zeros and return 0x7 instead of 0x6. DXC 1.9 itself avoids emitting sext i1 ... to i64.
    • Fix (module.rs Module::cast + ops_tests::sext_i1_to_i64_matches_cpu): fold const_u64 or emit select(v, -1, 0) for SExt i1 -> i64.
  2. Countbits(i64 const) feeding Bfrev.i32 corrupts bit 0 (seed 1599)
    • Even after dc2d8f1 split Bfrev.i64, seed 1599 fails because %21 = call i32 @dx.op.unaryBits.i64(i32 31, i64 2) (Countbits) fed into dx.op.unary.i32(30, %21) (Bfrev) returns 0x80000001 instead of 0x80000000 (seen on literal i64 2 and folded or i64 2, 0, while dynamic Countbits(i64) -> Bfrev.i32 and literal Bfrev.i32(1) return 0x80000000).
    • Fix (ops.rs Shader::bit_count + ops_tests::int64_countbits_into_bfrev_matches_cpu): sum two i32 Countbits calls on i64 (matching lower.rs).
  3. dx.op.binary.i64(IMax) corrupts the high 32-bit word on constant-folded operands (seed 783)
    • Clearing seed 540 (and 662) uncovered seed 783: dx.op.binary.i64(IMax, -5, 0x7fff_ffff_ffff_fffb) computed from or/udiv/xor/and returns 0xc in the upper 32 bits instead of 0x7fffffff (res[64] = 0xc, CPU 0x7fffffff).
    • Fix (ops.rs Shader::binary + ops_tests::int64_min_max_const_and_dynamic_match_cpu): lower i64 IMax/IMin/UMax/UMin via icmp + select.
  4. Bfrev.i32 on i64-derived constant expressions miscompiles (seed 817)
    • Clearing seed 783 uncovered seed 817: trunc(shl(mul i64 -7, -7842455603539182169, 21)) and its upper half produce exact 0x0de00000 and 0xd7bfc252 on the GPU, and literal Bfrev.i32 on those values returns 0x000007b0 and 0x4a43fdeb, yet feeding the i64-derived expressions into Bfrev.i32 returns 0xfe1297ff and 0xfe53ffff.
    • Fix (module.rs Module::eval_const_int + ops.rs + ops_tests::bfrev_i32_of_i64_const_expr_matches_cpu): evaluate bounded pure integer constant-expression trees and fold bfrev, bit_count, and integer min/max before requiring Feature::Int64Ops.

Diffstat vs def2134 across the 4 commits: crates/xcl/src/gpu/dxil/{module.rs, ops.rs, ops_tests.rs} (424 insertions(+), 1 deletion(-)).

Tested

  • Hardware / software: AMD Radeon RX 6750 XT 12 GB (RDNA 2, driver 32.0.21045.16010), AMD Ryzen 5 5600X, 32 GB RAM, Windows 11 Pro 24H2 (26100), rustc 1.98.1, DXC 1.9.2602.17 (SDK 10.0.26100.0), debug build.
  • Baseline on 424d315 (cargo test -p xcl --lib gpu::dxil -- --test-threads=4): 82 passed, 2 failed, 2 ignored (fuzz_validate_and_gpu_1 seed 540, fuzz_validate_and_gpu_3 seed 1599).
  • With the 4 commits rebased onto def2134:
    • cargo build --workspace: exit 0
    • cargo test -p xcl --lib gpu::dxil -- --test-threads=4: 88 passed, 0 failed, 2 ignored (includes fuzz_validate_and_gpu_0..3, wave_ops_match_cpu, half_precision_overloads_run, dx_op_attrs_match_dxc, and the 4 new regression tests)
    • XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests -- --test-threads=4: 120 passed, 0 failed, 17 ignored
    • cargo test --workspace --no-fail-fast -- --test-threads=4 (XCL_DIRECT_DXIL unset, XCL_HEAP_WINDOWS unset): 866 passed, 0 failed, 43 ignored (817 in xcl --lib, 49 across integration tests; gpu_compute_e2e::heap_window_out_of_memory_falls_back_to_the_switch_form printed SKIPPED ...: no heap windows)
  • On 2851585 + the 4 commits (FUZZ_SEED=722): GPU run: 0 mismatching results.

Not tested

  • Release build, NVIDIA / Intel / RDNA 3 / RDNA 4 hardware, DXC 1.7 / 1.8, XCL_DIRECT_DXIL=all, retail title smoke run, and XCL_HEAP_WINDOWS=1.

AI use: Antigravity (Gemini 4 Neon XHigh) wrote the hardware probes, the 4 fixes and regression tests, ran the test commands above, and drafted this comment from tool outputs.

0001-dxil-lower-sext-i1-to-i64-via-select-for-AMD-RDNA2.patch
0002-dxil-lower-i64-Countbits-via-i32-halves.patch
0003-dxil-lower-i64-integer-min-max-via-icmp-and-select.patch
0004-dxil-constant-fold-integer-bit-ops-on-constant-expre.patch

**@⁠RockFellerX** on GitHub · 2026-11-24 18:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140157663) · edited 2026-11-24 18:11 UTC RDNA 2 (`RX 6750 XT`) verification on `424d315` / `def2134` plus 4 clean workaround commits clearing the remaining `gpu::dxil` fuzz failures on RDNA 2 (and `seed 1599` also reported on RDNA 4). ### What `dc2d8f1` (`424d315`) already fixed on RDNA 2 - `wave_ops_match_cpu` (no longer removes the device), `half_precision_overloads_run` (credit @⁠mynzjerko / @⁠Frtuchinno), `dx_op_attrs_match_dxc`, `fuzz_validate_and_gpu_0`, and `fuzz_validate_and_gpu_2` all pass on clean `424d315`. - On clean `424d315`, `cargo test -p xcl --lib gpu::dxil -- --test-threads=4` drops to **82 passed, 2 failed, 2 ignored**: - `fuzz_validate_and_gpu_1`: fails at `seed 540: res[833] = 0x7, CPU 0x6` - `fuzz_validate_and_gpu_3`: fails at `seed 1599: res[193] = 0x1, CPU 0x0` (same failure @⁠HKEY-Funk-Machine saw on RX 9070 / RDNA 4) ### Remaining AMD / RDNA 2 driver bugs isolated & fixed (4 patches on `def2134`) Hardware probes on RX 6750 XT (`amdxc64.dll` `32.0.21045.16010`) isolated four distinct miscompilations: 1. **`sext i1` to `i64` zero-extends the upper 32 bits on RDNA 2 (`seed 540`)** - On `RX 6750 XT`, `sext i1 true to i64` evaluates to `0x00000000_ffffffff` instead of `0xffffffff_ffffffff` (whereas `sext i1` to `i32` is `0xffffffff`, and `select i1 %c, i64 -1, i64 0` is `0xffffffff_ffffffff`). That caused `ashr` in `seed 540` to shift out zeros and return `0x7` instead of `0x6`. DXC 1.9 itself avoids emitting `sext i1 ... to i64`. - Fix (`module.rs` `Module::cast` + `ops_tests::sext_i1_to_i64_matches_cpu`): fold `const_u64` or emit `select(v, -1, 0)` for `SExt` `i1 -> i64`. 2. **`Countbits(i64 const)` feeding `Bfrev.i32` corrupts bit 0 (`seed 1599`)** - Even after `dc2d8f1` split `Bfrev.i64`, `seed 1599` fails because `%21 = call i32 @dx.op.unaryBits.i64(i32 31, i64 2)` (`Countbits`) fed into `dx.op.unary.i32(30, %21)` (`Bfrev`) returns `0x80000001` instead of `0x80000000` (seen on literal `i64 2` and folded `or i64 2, 0`, while dynamic `Countbits(i64)` -> `Bfrev.i32` and literal `Bfrev.i32(1)` return `0x80000000`). - Fix (`ops.rs` `Shader::bit_count` + `ops_tests::int64_countbits_into_bfrev_matches_cpu`): sum two `i32` `Countbits` calls on `i64` (matching `lower.rs`). 3. **`dx.op.binary.i64(IMax)` corrupts the high 32-bit word on constant-folded operands (`seed 783`)** - Clearing `seed 540` (and `662`) uncovered `seed 783`: `dx.op.binary.i64(IMax, -5, 0x7fff_ffff_ffff_fffb)` computed from `or`/`udiv`/`xor`/`and` returns `0xc` in the upper 32 bits instead of `0x7fffffff` (`res[64] = 0xc, CPU 0x7fffffff`). - Fix (`ops.rs` `Shader::binary` + `ops_tests::int64_min_max_const_and_dynamic_match_cpu`): lower `i64` `IMax`/`IMin`/`UMax`/`UMin` via `icmp` + `select`. 4. **`Bfrev.i32` on `i64`-derived constant expressions miscompiles (`seed 817`)** - Clearing `seed 783` uncovered `seed 817`: `trunc(shl(mul i64 -7, -7842455603539182169, 21))` and its upper half produce exact `0x0de00000` and `0xd7bfc252` on the GPU, and literal `Bfrev.i32` on those values returns `0x000007b0` and `0x4a43fdeb`, yet feeding the `i64`-derived expressions into `Bfrev.i32` returns `0xfe1297ff` and `0xfe53ffff`. - Fix (`module.rs` `Module::eval_const_int` + `ops.rs` + `ops_tests::bfrev_i32_of_i64_const_expr_matches_cpu`): evaluate bounded pure integer constant-expression trees and fold `bfrev`, `bit_count`, and integer min/max before requiring `Feature::Int64Ops`. Diffstat vs `def2134` across the 4 commits: `crates/xcl/src/gpu/dxil/{module.rs, ops.rs, ops_tests.rs}` (`424 insertions(+), 1 deletion(-)`). **Tested** - Hardware / software: AMD Radeon RX 6750 XT 12 GB (RDNA 2, driver `32.0.21045.16010`), AMD Ryzen 5 5600X, 32 GB RAM, Windows 11 Pro 24H2 (`26100`), `rustc 1.98.1`, DXC `1.9.2602.17` (SDK `10.0.26100.0`), debug build. - Baseline on `424d315` (`cargo test -p xcl --lib gpu::dxil -- --test-threads=4`): **82 passed, 2 failed, 2 ignored** (`fuzz_validate_and_gpu_1` `seed 540`, `fuzz_validate_and_gpu_3` `seed 1599`). - With the 4 commits rebased onto `def2134`: - `cargo build --workspace`: exit 0 - `cargo test -p xcl --lib gpu::dxil -- --test-threads=4`: **88 passed, 0 failed, 2 ignored** (includes `fuzz_validate_and_gpu_0..3`, `wave_ops_match_cpu`, `half_precision_overloads_run`, `dx_op_attrs_match_dxc`, and the 4 new regression tests) - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp::tests -- --test-threads=4`: **120 passed, 0 failed, 17 ignored** - `cargo test --workspace --no-fail-fast -- --test-threads=4` (`XCL_DIRECT_DXIL` unset, `XCL_HEAP_WINDOWS` unset): **866 passed, 0 failed, 43 ignored** (`817` in `xcl --lib`, `49` across integration tests; `gpu_compute_e2e::heap_window_out_of_memory_falls_back_to_the_switch_form` printed `SKIPPED ...: no heap windows`) - On `2851585` + the 4 commits (`FUZZ_SEED=722`): `GPU run: 0 mismatching results`. **Not tested** - Release build, NVIDIA / Intel / RDNA 3 / RDNA 4 hardware, DXC 1.7 / 1.8, `XCL_DIRECT_DXIL=all`, retail title smoke run, and `XCL_HEAP_WINDOWS=1`. **AI use:** Antigravity (`Gemini 4 Neon XHigh`) wrote the hardware probes, the 4 fixes and regression tests, ran the test commands above, and drafted this comment from tool outputs. [0001-dxil-lower-sext-i1-to-i64-via-select-for-AMD-RDNA2.patch](https://github.com/user-attachments/files/35361583/0001-dxil-lower-sext-i1-to-i64-via-select-for-AMD-RDNA2.patch) [0002-dxil-lower-i64-Countbits-via-i32-halves.patch](https://github.com/user-attachments/files/35361584/0002-dxil-lower-i64-Countbits-via-i32-halves.patch) [0003-dxil-lower-i64-integer-min-max-via-icmp-and-select.patch](https://github.com/user-attachments/files/35361585/0003-dxil-lower-i64-integer-min-max-via-icmp-and-select.patch) [0004-dxil-constant-fold-integer-bit-ops-on-constant-expre.patch](https://github.com/user-attachments/files/35361586/0004-dxil-constant-fold-integer-bit-ops-on-constant-expre.patch)
Author
Owner

@⁠1FoXus on GitHub · 2026-11-24 18:13 UTC · original

@⁠bmjask @⁠gefydev Completed the controlled DXC 1.8 vs 1.9 comparison on my RTX 5060 as requested.

Tested

  • GPU: NVIDIA GeForce RTX 5060 8GB
  • Driver: 621.14
  • CPU: Intel Core i5-14600KF
  • RAM: 16GB
  • OS: Windows 11
  • Rust: 1.100.0
  • Build: Debug
  • Commit: a7cf0784c0eeb2e372b9cce48b1cf7f03f083e4a

The commit, GPU and driver remained unchanged. No tracked source files were modified. DXC 1.9 was loaded separately using XCL_DXC_DIR.

Fuzz test comparison

Seed DXC 1.8.2502.11 DXC 1.9.2602.17 DXIL bytes Instructions
70 FAILED FAILED 3096 166
545 FAILED FAILED 3212 184
1019 FAILED FAILED 3248 152
1507 FAILED FAILED 3088 136

All four failures persist with DXC 1.9, with identical reported DXIL sizes, instruction counts and error codes.

CreateComputePipelineState: Not enough memory resources are available to complete this operation. (0x8007000E)

Source: crates/xcl/src/gpu/dxil/fuzz_tests.rs:1167:110

Command:

cargo test -p xcl --lib gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_ -- --test-threads=4 --nocapture

DXC 1.9 result: 0 passed, 4 failed, 836 filtered out, finished in 1.68s.

The runtime confirmed that dxcompiler and dxil 1.9.2602.17 (21d28f72) were loaded.

Malformed-container test

I also ran:

cargo test -p xcl --lib gpu::dxil::validate::tests::malformed_containers_are_errors -- --exact --test-threads=1 --nocapture

With DXC 1.9, the test printed three Invalid bitcode signature messages but completed successfully.

Result: 1 passed, 0 failed, 839 filtered out, finished in 0.01s. No access violation.

Conclusion

Upgrading DXC alone does not resolve the four fuzz failures on my RTX 5060 with driver 621.14. However, the previously crashing malformed-container test passes in isolation with DXC 1.9.

Not tested

  • Other NVIDIA driver versions
  • Byte-for-byte comparison of generated DXIL
  • Complete workspace suite with DXC 1.9
  • Release builds
  • Isolated malformed-container test with DXC 1.8

Happy to run specific diagnostic tests or patches if needed.

AI use

ChatGPT (GPT-6.2) assisted with test commands, log analysis and report formatting. All tests were performed on my own hardware.

**@⁠1FoXus** on GitHub · 2026-11-24 18:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140339134) @⁠bmjask @⁠gefydev Completed the controlled DXC 1.8 vs 1.9 comparison on my RTX 5060 as requested. ### Tested - GPU: NVIDIA GeForce RTX 5060 8GB - Driver: 621.14 - CPU: Intel Core i5-14600KF - RAM: 16GB - OS: Windows 11 - Rust: 1.100.0 - Build: Debug - Commit: `a7cf0784c0eeb2e372b9cce48b1cf7f03f083e4a` The commit, GPU and driver remained unchanged. No tracked source files were modified. DXC 1.9 was loaded separately using `XCL_DXC_DIR`. ### Fuzz test comparison | Seed | DXC 1.8.2502.11 | DXC 1.9.2602.17 | DXIL bytes | Instructions | | --- | --- | --- | ---: | ---: | | 70 | FAILED | FAILED | 3096 | 166 | | 545 | FAILED | FAILED | 3212 | 184 | | 1019 | FAILED | FAILED | 3248 | 152 | | 1507 | FAILED | FAILED | 3088 | 136 | All four failures persist with DXC 1.9, with identical reported DXIL sizes, instruction counts and error codes. `CreateComputePipelineState: Not enough memory resources are available to complete this operation. (0x8007000E)` Source: `crates/xcl/src/gpu/dxil/fuzz_tests.rs:1167:110` Command: `cargo test -p xcl --lib gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_ -- --test-threads=4 --nocapture` DXC 1.9 result: 0 passed, 4 failed, 836 filtered out, finished in 1.68s. The runtime confirmed that dxcompiler and dxil 1.9.2602.17 (21d28f72) were loaded. ### Malformed-container test I also ran: `cargo test -p xcl --lib gpu::dxil::validate::tests::malformed_containers_are_errors -- --exact --test-threads=1 --nocapture` With DXC 1.9, the test printed three `Invalid bitcode signature` messages but completed successfully. Result: 1 passed, 0 failed, 839 filtered out, finished in 0.01s. No access violation. ### Conclusion Upgrading DXC alone does not resolve the four fuzz failures on my RTX 5060 with driver 621.14. However, the previously crashing malformed-container test passes in isolation with DXC 1.9. ### Not tested - Other NVIDIA driver versions - Byte-for-byte comparison of generated DXIL - Complete workspace suite with DXC 1.9 - Release builds - Isolated malformed-container test with DXC 1.8 Happy to run specific diagnostic tests or patches if needed. ### AI use ChatGPT (GPT-6.2) assisted with test commands, log analysis and report formatting. All tests were performed on my own hardware.
Author
Owner

@⁠Arvi23 on GitHub · 2026-11-24 18:14 UTC · original

@⁠bmjask @⁠HKEY-Funk-Machine a likely cause of the second AMD driver fault (amdxc64.dll+0x6800a4, console CS 62b584e061c05fc5), and a fix you can take.

The direct path's DXIL for that program has irreducible control flow. DXC's validator refuses it: error: Execution flow must be reducible. The runtime never runs the validator, so the container goes to CreateComputePipelineState, and the AMD driver reads a null pointer instead of refusing it. This holds on 7d24e97 and on the current head 2851585 (207 120 B there); the phi and optimizer changes don't affect it.

It isn't only that program. I translated all 2 689 compute programs of the retail pack through the direct path on 2851585 and validated each container: 2 669 validate, and 20 are refused, all with "Execution flow must be reducible". That matches the 20 programs with irreducible loops that @⁠gefydev's lane-mask analysis found in the console code.

Fix: Arvi23/xcl dxil/irreducible-fallback, one commit 113f10b on the current head d24db9f (module.rs +69, tests.rs +27). The writer checks the layout it writes: with dominators over the reverse post-order (Cooper, Harvey, Kennedy), every edge to a block at or before its source must go to a block that dominates the source. Otherwise it records a builder error, so try_finish fails and the translator falls back to the HLSL path, whose pc dispatcher takes any flow. With it, 62b584e061c05fc5 logs direct DXIL fallback … irreducible control flow … – HLSL path and gets the HLSL path's 197 280 B, which validate. Test: irreducible_control_flow_is_a_builder_error (a loop with two entries; try_finish must fail).

Tested

  • AMD Radeon RX 9070 XT 16 GB (RDNA4, driver 26.11.2), Ryzen 7 5800X3D, Windows 10 IoT Enterprise LTSC 21H2 (19044), rustc 1.100.0 MSVC, DXC 1.9.2609.5, release.
  • 62b584e061c05fc5's compute pipeline on the RX 9070 XT, one process each (xcl shaders --precompile --only cs --pipelines with XCL_DIRECT_DXIL=1, fresh caches):
    • 2851585 without the fix: the process ends with 0xc0000005 inside CreateComputePipelineState (I did not capture the module offset);
    • with the fix: direct DXIL fallback … irreducible control flow … – HLSL path, 197 280 B of DXIL that validate, built by the driver in 7.0 s (1 pipeline made, 0 refused).
  • cargo test -p xcl --lib on 113f10b, CPU tests only: irreducible_control_flow_is_a_builder_error, emitted_kernel_passes_the_sdk_validator, emitted_kernel_disassembles_like_dxc_output, branchy_graphics_stages_validate: 4 passed.
  • The pack, 2851585 against the same commit on it (f580eea, rebased onto d24db9f as 113f10b without conflicts): every compute program through console_to_dxil_in with XCL_DIRECT_DXIL=1, each container through validate::validate (a local hook in xcl shaders --precompile, not in the commit). With the commit, the 20 refused programs fall back (direct DXIL fallback … irreducible control flow) and their containers validate. The other 2 669 programs' DXIL is byte-identical, so the check refused nothing the validator accepts.

Not tested

  • The RX 9070 (@⁠HKEY-Funk-Machine's card and driver), and a title run with the fix.
  • The GPU tests and the whole suite; VS / PS (XCL_DIRECT_DXIL=all) through the pack.
  • Making these programs reducible instead (node splitting) so that they stay on the direct path; with 20 of 2 689 programs the fallback seemed enough.

AI use: Claude Code (Claude Opus 5.5) found the validator error, wrote the commit, its test and this comment, and ran the measurements and the GPU check on the machine named.

**@⁠Arvi23** on GitHub · 2026-11-24 18:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140369636) @⁠bmjask @⁠HKEY-Funk-Machine a likely cause of the second AMD driver fault (`amdxc64.dll+0x6800a4`, console CS `62b584e061c05fc5`), and a fix you can take. **The direct path's DXIL for that program has irreducible control flow.** DXC's validator refuses it: `error: Execution flow must be reducible.` The runtime never runs the validator, so the container goes to `CreateComputePipelineState`, and the AMD driver reads a null pointer instead of refusing it. This holds on `7d24e97` and on the current head `2851585` (207 120 B there); the phi and optimizer changes don't affect it. It isn't only that program. I translated all 2 689 compute programs of the retail pack through the direct path on `2851585` and validated each container: **2 669 validate, and 20 are refused, all with "Execution flow must be reducible"**. That matches the 20 programs with irreducible loops that @⁠gefydev's lane-mask analysis found in the console code. **Fix:** [`Arvi23/xcl` `dxil/irreducible-fallback`](https://github.com/Arvi23/xcl/commits/dxil/irreducible-fallback), one commit `113f10b` on the current head `d24db9f` (`module.rs` +69, `tests.rs` +27). The writer checks the layout it writes: with dominators over the reverse post-order (Cooper, Harvey, Kennedy), every edge to a block at or before its source must go to a block that dominates the source. Otherwise it records a builder error, so `try_finish` fails and the translator falls back to the HLSL path, whose `pc` dispatcher takes any flow. With it, `62b584e061c05fc5` logs `direct DXIL fallback … irreducible control flow … – HLSL path` and gets the HLSL path's 197 280 B, which validate. Test: `irreducible_control_flow_is_a_builder_error` (a loop with two entries; `try_finish` must fail). **Tested** - AMD Radeon RX 9070 XT 16 GB (RDNA4, driver 26.11.2), Ryzen 7 5800X3D, Windows 10 IoT Enterprise LTSC 21H2 (19044), rustc 1.100.0 MSVC, DXC 1.9.2609.5, release. - `62b584e061c05fc5`'s compute pipeline on the RX 9070 XT, one process each (`xcl shaders --precompile --only cs --pipelines` with `XCL_DIRECT_DXIL=1`, fresh caches): - `2851585` without the fix: the process ends with `0xc0000005` inside `CreateComputePipelineState` (I did not capture the module offset); - with the fix: `direct DXIL fallback … irreducible control flow … – HLSL path`, 197 280 B of DXIL that validate, built by the driver in 7.0 s (1 pipeline made, 0 refused). - `cargo test -p xcl --lib` on `113f10b`, CPU tests only: `irreducible_control_flow_is_a_builder_error`, `emitted_kernel_passes_the_sdk_validator`, `emitted_kernel_disassembles_like_dxc_output`, `branchy_graphics_stages_validate`: 4 passed. - The pack, `2851585` against the same commit on it (`f580eea`, rebased onto `d24db9f` as `113f10b` without conflicts): every compute program through `console_to_dxil_in` with `XCL_DIRECT_DXIL=1`, each container through `validate::validate` (a local hook in `xcl shaders --precompile`, not in the commit). With the commit, the 20 refused programs fall back (`direct DXIL fallback … irreducible control flow`) and their containers validate. The other 2 669 programs' DXIL is byte-identical, so the check refused nothing the validator accepts. **Not tested** - The RX 9070 (@⁠HKEY-Funk-Machine's card and driver), and a title run with the fix. - The GPU tests and the whole suite; VS / PS (`XCL_DIRECT_DXIL=all`) through the pack. - Making these programs reducible instead (node splitting) so that they stay on the direct path; with 20 of 2 689 programs the fallback seemed enough. AI use: Claude Code (Claude Opus 5.5) found the validator error, wrote the commit, its test and this comment, and ran the measurements and the GPU check on the machine named.
Author
Owner

@⁠gefydev on GitHub · 2026-11-24 18:16 UTC · original

@⁠Arvi23 @⁠bmjask for reference: the lane-mask analysis on recomp-lane-masks finds the same 20 irreducible compute programs in the console code and refuses them in the per-lane form, which agrees with Arvi23's count. His writer check is the right fallback for the per-instruction form.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 18:16 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140417897) @⁠Arvi23 @⁠bmjask for reference: the lane-mask analysis on `recomp-lane-masks` finds the same 20 irreducible compute programs in the console code and refuses them in the per-lane form, which agrees with Arvi23's count. His writer check is the right fallback for the per-instruction form. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.
Author
Owner

@⁠Sr-0w on GitHub · 2026-11-24 18:21 UTC · original

@⁠bmjask a size data point for the cleanup work, at d24db9f. The size drop on 62b584e061c05fc5 (1.85 MB → 207 KB) does not reach the largest compute programs of the retail pack. The 40 largest by console code, through translate_compute, native wave64, 4 windows (RX 7800 XT host, release):

console code direct DXIL translation
488 744 B 14 766 824 B 15.2 s
486 624 B 14 720 028 B 16.4 s
333 596 B 10 728 408 B 20.9 s
239 232 B 4 188 504 B 9.7 s
231 304 B 4 052 644 B 8.9 s
~120 KB (31 programs) 2.15 – 2.29 MB each 4 – 9 s

So it's about 18–30 bytes of DXIL per byte of console code. For scale, in my earlier world-load runs on this card, the largest compute DXIL the HLSL path built was 1.09 MB, and the direct path's 11.3 MB. These programs are the ones the world load waits on, so with XCL_DIRECT_DXIL=1 their driver builds still dominate (65 s for the slowest on the run I posted). If it helps, I can run any size pass or knob you push against these 40 programs and post the table again.

AI use: Claude Code (Claude Opus 5.5) measured the sizes and wrote this comment.

**@⁠Sr-0w** on GitHub · 2026-11-24 18:21 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140523277) @⁠bmjask a size data point for the cleanup work, at `d24db9f`. The size drop on `62b584e061c05fc5` (1.85 MB → 207 KB) does not reach the largest compute programs of the retail pack. The 40 largest by console code, through `translate_compute`, native wave64, 4 windows (RX 7800 XT host, release): | console code | direct DXIL | translation | |---|---|---| | 488 744 B | **14 766 824 B** | 15.2 s | | 486 624 B | 14 720 028 B | 16.4 s | | 333 596 B | 10 728 408 B | 20.9 s | | 239 232 B | 4 188 504 B | 9.7 s | | 231 304 B | 4 052 644 B | 8.9 s | | ~120 KB (31 programs) | 2.15 – 2.29 MB each | 4 – 9 s | So it's about 18–30 bytes of DXIL per byte of console code. For scale, in my earlier world-load runs on this card, the largest compute DXIL the HLSL path built was 1.09 MB, and the direct path's 11.3 MB. These programs are the ones the world load waits on, so with `XCL_DIRECT_DXIL=1` their driver builds still dominate (65 s for the slowest on the run I posted). If it helps, I can run any size pass or knob you push against these 40 programs and post the table again. AI use: Claude Code (Claude Opus 5.5) measured the sizes and wrote this comment.
Author
Owner

@⁠bmjask on GitHub · 2026-11-24 18:22 UTC · original

@⁠HKEY-Funk-Machine: found it. The amdxc64.dll+0x6800a4 fault on cs 62b584e061c05fc5 (InstanceCulling:CS_Prop_BatchNoCull_*) was our bug, not the driver's. The console code has 7 loops entered in the middle, and the direct path copied that irreducible CFG into DXIL. DXIL forbids that, and a debug validator says "Execution flow must be reducible", but release builds skip the validator. NVIDIA tolerated it and AMD's compiler faulted.

76c527b7dd78 splits nodes until every loop has a single entry, falling back to HLSL past 4× growth. That program now translates and validates (201 KB, against 266 KB on the HLSL path). It also bumps TRANSLATOR_VERSION to 4 and adds a Countbits.i64 per-half workaround (seed 1599's value comes downstream of a constant Countbits.i64, the same family as Bfrev.i64).

When you have time on the RX 9070:

  1. XCL_DIRECT_DXIL=1 XCL_TRANSLATED_CACHE=0 XCL_PSO_DISK_CACHE=0, then play past where it faulted. There should be no fault and no direct-DXIL fallback for that program.
  2. If it still faults: XCL_DXIL_DUMP=62b584e061c05fc5 writes %TEMP%\xcl-dxil-dump\<hash>.dxil. Please share dxc -dumpbin statistics only, and try XCL_DXIL_NO_OPT=all.
  3. fuzz_validate_and_gpu_* moved to the stacked follow-up PR, to keep this diff under GitHub's 20 000-line limit. Seed 722 looks like the driver moving WaveReadLaneFirst into a divergent switch case: our declaration matches DXC's. A reduced repro will come with that PR.

Also in this push: a guarded region now merges only the registers it writes. On the 200-program sample, translation time is p50 29 ms / p95 0.38 s, down from 64 ms / 1.6 s, and size is 1.25× HLSL+DXC. Full suite: 858 passed, 0 failed. Regression pair in the description: 98 % of main's frames.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠bmjask.

**@⁠bmjask** on GitHub · 2026-11-24 18:22 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140566159) @⁠HKEY-Funk-Machine: found it. The `amdxc64.dll+0x6800a4` fault on `cs 62b584e061c05fc5` (`InstanceCulling:CS_Prop_BatchNoCull_*`) was our bug, not the driver's. The console code has 7 loops entered in the middle, and the direct path copied that **irreducible** CFG into DXIL. DXIL forbids that, and a debug validator says "Execution flow must be reducible", but release builds skip the validator. NVIDIA tolerated it and AMD's compiler faulted. `76c527b7dd78` splits nodes until every loop has a single entry, falling back to HLSL past 4× growth. That program now translates and validates (201 KB, against 266 KB on the HLSL path). It also bumps `TRANSLATOR_VERSION` to 4 and adds a `Countbits.i64` per-half workaround (seed 1599's value comes downstream of a constant `Countbits.i64`, the same family as `Bfrev.i64`). When you have time on the RX 9070: 1. `XCL_DIRECT_DXIL=1 XCL_TRANSLATED_CACHE=0 XCL_PSO_DISK_CACHE=0`, then play past where it faulted. There should be no fault and no direct-DXIL fallback for that program. 2. If it still faults: `XCL_DXIL_DUMP=62b584e061c05fc5` writes `%TEMP%\xcl-dxil-dump\<hash>.dxil`. Please share `dxc -dumpbin` statistics only, and try `XCL_DXIL_NO_OPT=all`. 3. `fuzz_validate_and_gpu_*` moved to the stacked follow-up PR, to keep this diff under GitHub's 20 000-line limit. Seed 722 looks like the driver moving `WaveReadLaneFirst` into a divergent switch case: our declaration matches DXC's. A reduced repro will come with that PR. Also in this push: a guarded region now merges only the registers it writes. On the 200-program sample, translation time is p50 29 ms / p95 0.38 s, down from 64 ms / 1.6 s, and size is 1.25× HLSL+DXC. Full suite: 858 passed, 0 failed. Regression pair in the description: 98 % of main's frames. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠bmjask.
Author
Owner

@⁠Sr-0w on GitHub · 2026-11-24 18:23 UTC · original

@⁠bmjask RDNA3 (RX 7800 XT, native wave64) on d24db9f: everything that failed here before passes now.

  • gpu::dxil: 79 passed, 0 failed, 1 ignored, 0 SKIPPED. That includes wave_ops_match_cpu, which used to remove the device on this card (I had been running with --skip), half_precision_overloads_run and all four fuzz_validate_and_gpu_*. Seed 328's bfrev.i64 mismatch is gone too.
  • cargo test --workspace --no-fail-fast -- --test-threads=4 (release): 857 passed, 0 failed, 43 ignored.

Setup: Radeon RX 7800 XT, Adrenalin, Windows 11 Pro 26300, Rust 1.100, release, DXC 1.9. The tree is clean d24db9f plus one local #[ignore] measuring test.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this comment.

**@⁠Sr-0w** on GitHub · 2026-11-24 18:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140567580) @⁠bmjask RDNA3 (RX 7800 XT, native wave64) on `d24db9f`: **everything that failed here before passes now.** - `gpu::dxil`: **79 passed, 0 failed, 1 ignored, 0 SKIPPED**. That includes `wave_ops_match_cpu`, which used to remove the device on this card (I had been running with `--skip`), `half_precision_overloads_run` and all four `fuzz_validate_and_gpu_*`. Seed 328's `bfrev.i64` mismatch is gone too. - `cargo test --workspace --no-fail-fast -- --test-threads=4` (release): **857 passed, 0 failed, 43 ignored**. Setup: Radeon RX 7800 XT, Adrenalin, Windows 11 Pro 26300, Rust 1.100, release, DXC 1.9. The tree is clean `d24db9f` plus one local `#[ignore]` measuring test. AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this comment.
Author
Owner

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

@⁠bmjask a small correctness finding for the per-instruction form: V_CVT_F16_F32 gives 0 for an f32 below the smallest f16 denormal, where the HLSL path and the console round to that denormal. It was found by @⁠vladbondarenko97's F32_CONVERSIONS test program, on lane 1 of v29 (0x0 against 0x1), on direct-on-1426 with #1426 7d24e97. The per-lane form keeps that instruction on the fallback until it is fixed.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.

**@⁠gefydev** on GitHub · 2026-11-24 18:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140599033) @⁠bmjask a small correctness finding for the per-instruction form: `V_CVT_F16_F32` gives 0 for an f32 below the smallest f16 denormal, where the HLSL path and the console round to that denormal. It was found by @⁠vladbondarenko97's `F32_CONVERSIONS` test program, on lane 1 of v29 (`0x0` against `0x1`), on `direct-on-1426` with #1426 `7d24e97`. The per-lane form keeps that instruction on the fallback until it is fixed. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠gefydev.
Author
Owner

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

Independent NVIDIA RTX 3090 verification of head 285158534ae1c8e01a8e6e1718edbf65eb9a7663 (including the sweep fixes, Module::optimize, AMD driver workarounds, and XCL_HEAP_WINDOWS refusal merge).

Tested

  • Windows 11 Pro for Workstations (build 26200), AMD Ryzen 7 7800X3D (8 cores), NVIDIA GeForce RTX 3090 (24 GB VRAM, driver 617.42, wave32), 32 GB RAM, Rust 1.100.0 MSVC (debug), Windows SDK 10.0.26100.0 DXC (dxcompiler 1.9.2602.17, dxil 1.9.2602.17, validator 1.9).
  • cargo build --workspace -j 8: succeeded (0 errors).
  • XCL_ADAPTER=nvidia cargo test --workspace -j 8 -- --test-threads=8 --show-output: 862 passed, 0 failed, 43 ignored, 5 SKIPPED (plus 10 XCL_SAMPLE_* tests skipped because the env vars were unset):
    • SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
    • SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64
    • SKIPPED test_title_draws_with_a_root_signature_under_the_debug_layer: no d3d12SDKLayers.dll
    • SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows
    • SKIPPED uploads_start_from_each_subresources_state: no D3D12 debug layer (0x887A002D)
  • All 84 gpu::dxil tests passed with 0 validator skips (2 ignored: dump_dxc_lowering, debug_seed), including:
    • fuzz_validate_and_gpu_{0..3}: 2,000 seeds validated and 1,232 GPU-compared on RTX 3090.
    • long_programs_translate: 4,001 instructions in 167.6 ms (debug); long_pixel_shader_translates_fast: 3,000 instructions in 195.7 ms, 128,052 B DXIL (debug).
    • malformed_containers_are_errors: passed on dxcompiler 1.9.2602.17.
    • Re-ran gpu::dxil with XCL_DXIL_NO_OPT=all: 84 passed, 0 failed, 2 ignored (3.29 s).
  • Targeted XCL_DIRECT_DXIL and XCL_HEAP_WINDOWS=1 e2e checks on gpu_compute_e2e:
    • XCL_DIRECT_DXIL=1 on console_wave64_compute_through_the_pso_hook_dispatch_and_read_back: passed (2,892 B DXIL, readback matched).
    • XCL_HEAP_WINDOWS=1 + XCL_DIRECT_DXIL=1 on console_wave64_compute_through_the_pso_hook_dispatch_and_read_back: passed; direct translator logged direct DXIL fallback stage=CS reason="unsupported: heap memory windows (XCL_HEAP_WINDOWS)" and fell back cleanly to HLSL (5,708 B DXIL).
    • XCL_HEAP_WINDOWS=1 + XCL_DIRECT_DXIL=1 on heap_window_out_of_memory_falls_back_to_the_switch_form: passed; after injected OOM switched to switch form, direct DXIL built the switch-form compute PSO directly (2,892 B DXIL vs 6,128 B DXIL on the HLSL path) and passed readback.

Findings

  1. gpu_compute_e2e::offline_compute_pipeline_is_reused_by_a_second_process fails when XCL_DIRECT_DXIL=1 or XCL_DIRECT_DXIL=all is set in the environment: it panics at crates/xcl/tests/gpu_compute_e2e.rs:114 (Option::unwrap() on None) because the test looks for a top-level *.dxil file in XCL_DXIL_CACHE (which only dxc::compile_cached writes on the HLSL path, whereas direct DXIL writes only translated/v2/... and driver/*.pso).
  2. crates/xcl/src/gpu/dxil/validate.rs still passes short inputs (< 32 bytes) straight to IDxcValidator::Validate / Disassemble, so the dxcompiler 1.8.2502.11 crash on b"DXBC" noted in earlier comments is not yet guarded in this commit (not hit on dxcompiler 1.9.2602.17).

Not tested

AMD / native wave64 GPUs, dxcompiler 1.8.2502.11, D3D12 debug-layer tests, retail shader pack sweep, and a retail title smoke run.

AI use

agy with gemini-4-neon-high ran the build, tests, and drafted this report.

**@⁠MatyEjsr** on GitHub · 2026-11-24 18:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140610219) Independent NVIDIA RTX 3090 verification of head `285158534ae1c8e01a8e6e1718edbf65eb9a7663` (including the sweep fixes, `Module::optimize`, AMD driver workarounds, and `XCL_HEAP_WINDOWS` refusal merge). **Tested** - Windows 11 Pro for Workstations (build 26200), AMD Ryzen 7 7800X3D (8 cores), NVIDIA GeForce RTX 3090 (24 GB VRAM, driver 617.42, wave32), 32 GB RAM, Rust 1.100.0 MSVC (debug), Windows SDK 10.0.26100.0 DXC (`dxcompiler 1.9.2602.17`, `dxil 1.9.2602.17`, validator 1.9). - `cargo build --workspace -j 8`: succeeded (0 errors). - `XCL_ADAPTER=nvidia cargo test --workspace -j 8 -- --test-threads=8 --show-output`: **862 passed, 0 failed, 43 ignored**, **5 SKIPPED** (plus 10 `XCL_SAMPLE_*` tests skipped because the env vars were unset): - `SKIPPED gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64` - `SKIPPED gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64` - `SKIPPED test_title_draws_with_a_root_signature_under_the_debug_layer: no d3d12SDKLayers.dll` - `SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows` - `SKIPPED uploads_start_from_each_subresources_state: no D3D12 debug layer (0x887A002D)` - All **84** `gpu::dxil` tests passed with 0 validator skips (2 ignored: `dump_dxc_lowering`, `debug_seed`), including: - `fuzz_validate_and_gpu_{0..3}`: 2,000 seeds validated and 1,232 GPU-compared on RTX 3090. - `long_programs_translate`: 4,001 instructions in 167.6 ms (debug); `long_pixel_shader_translates_fast`: 3,000 instructions in 195.7 ms, 128,052 B DXIL (debug). - `malformed_containers_are_errors`: passed on `dxcompiler 1.9.2602.17`. - Re-ran `gpu::dxil` with `XCL_DXIL_NO_OPT=all`: 84 passed, 0 failed, 2 ignored (3.29 s). - Targeted `XCL_DIRECT_DXIL` and `XCL_HEAP_WINDOWS=1` e2e checks on `gpu_compute_e2e`: - `XCL_DIRECT_DXIL=1` on `console_wave64_compute_through_the_pso_hook_dispatch_and_read_back`: passed (2,892 B DXIL, readback matched). - `XCL_HEAP_WINDOWS=1` + `XCL_DIRECT_DXIL=1` on `console_wave64_compute_through_the_pso_hook_dispatch_and_read_back`: passed; direct translator logged `direct DXIL fallback stage=CS reason="unsupported: heap memory windows (XCL_HEAP_WINDOWS)"` and fell back cleanly to HLSL (5,708 B DXIL). - `XCL_HEAP_WINDOWS=1` + `XCL_DIRECT_DXIL=1` on `heap_window_out_of_memory_falls_back_to_the_switch_form`: passed; after injected OOM switched to switch form, direct DXIL built the switch-form compute PSO directly (2,892 B DXIL vs 6,128 B DXIL on the HLSL path) and passed readback. **Findings** 1. `gpu_compute_e2e::offline_compute_pipeline_is_reused_by_a_second_process` fails when `XCL_DIRECT_DXIL=1` or `XCL_DIRECT_DXIL=all` is set in the environment: it panics at `crates/xcl/tests/gpu_compute_e2e.rs:114` (`Option::unwrap()` on `None`) because the test looks for a top-level `*.dxil` file in `XCL_DXIL_CACHE` (which only `dxc::compile_cached` writes on the HLSL path, whereas direct DXIL writes only `translated/v2/...` and `driver/*.pso`). 2. `crates/xcl/src/gpu/dxil/validate.rs` still passes short inputs (`< 32` bytes) straight to `IDxcValidator::Validate` / `Disassemble`, so the `dxcompiler 1.8.2502.11` crash on `b"DXBC"` noted in earlier comments is not yet guarded in this commit (not hit on `dxcompiler 1.9.2602.17`). **Not tested** AMD / native wave64 GPUs, `dxcompiler 1.8.2502.11`, D3D12 debug-layer tests, retail shader pack sweep, and a retail title smoke run. **AI use** agy with gemini-4-neon-high ran the build, tests, and drafted this report.
Author
Owner

@⁠Kalmarv on GitHub · 2026-11-24 18:25 UTC · original

@⁠MuhammadUzair-dev @⁠adonizm on the four fuzz_validate_and_gpu_* refusals (0x8007000E): on our RTX 5070 Ti, NVIDIA 610.74 (Windows: 32.0.16.1074), all four pass at def2134 (the last #1426 commit with fuzz_tests.rs) and at direct-on-1426 a7cf078. That holds with DXC 1.9.2609.5 and with the SDK's 1.7.2308 (validation step skipped), with 1 232 of 2 000 seeds compared on the GPU. Your seeds 70, 545, 1019 and 1507 validate and run with 0 mismatches here. Each has the fixed form: %n = sub i32 0, %x and then atomicrmw add … %n on groupshared; none has atomicrmw sub.

One thing that fits, as an inference only. Before the fix (065aef3) our driver refused seeds 62, 545, 1019 and 1507. Your list is the same with 70 instead of 62. Seed 62 subtracts the constant -1, which now folds to a constant add; 70, 545, 1019 and 1507 subtract a variable. So your drivers may turn "add of 0 - x" back into the atomic sub that the Blackwell compiler refuses, and 610.74 doesn't. Which driver versions are you on? If they are newer than 610.74, that's the difference, and the fuzzer (or the writer) would need a form the driver can't fold back.

AI use: Claude Code (Claude Fable 5.2, Claude Opus 5.5)

**@⁠Kalmarv** on GitHub · 2026-11-24 18:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140618279) @⁠MuhammadUzair-dev @⁠adonizm on the four `fuzz_validate_and_gpu_*` refusals (`0x8007000E`): on our RTX 5070 Ti, **NVIDIA 610.74** (Windows: 32.0.16.1074), all four pass at `def2134` (the last #1426 commit with `fuzz_tests.rs`) and at `direct-on-1426` `a7cf078`. That holds with DXC 1.9.2609.5 and with the SDK's 1.7.2308 (validation step skipped), with 1 232 of 2 000 seeds compared on the GPU. Your seeds 70, 545, 1019 and 1507 validate and run with 0 mismatches here. Each has the fixed form: `%n = sub i32 0, %x` and then `atomicrmw add … %n` on groupshared; none has `atomicrmw sub`. One thing that fits, as an inference only. Before the fix (`065aef3`) our driver refused seeds 62, 545, 1019 and 1507. Your list is the same with 70 instead of 62. Seed 62 subtracts the constant -1, which now folds to a constant add; 70, 545, 1019 and 1507 subtract a variable. So your drivers may turn "add of `0 - x`" back into the atomic sub that the Blackwell compiler refuses, and 610.74 doesn't. Which driver versions are you on? If they are newer than 610.74, that's the difference, and the fuzzer (or the writer) would need a form the driver can't fold back. **AI use:** Claude Code (Claude Fable 5.2, Claude Opus 5.5)
Author
Owner

@⁠MiguelMachado-dev on GitHub · 2026-11-24 18:28 UTC · original

Blackwell (RTX 5080, driver 621.24, DXC 1.8.2502.11) validation run on d24db9f86ddb27efe115d084a06d59fb1e26c47c: all tests pass, including malformed_containers_are_errors on DXC 1.8.

Tested

  • Commit: d24db9f86ddb27efe115d084a06d59fb1e26c47c (clean tree, debug build)
  • Hardware / software: NVIDIA GeForce RTX 5080 16 GB (Blackwell, 32-lane waves, driver 621.24), Intel Core i7-14700KF, Windows 11 build 26300, rustc 1.97.1 (stable-x86_64-pc-windows-msvc), DXC 1.8.2502.11 (Windows Kits\10\bin\10.0.26100.0\x64, dxil.dll present)
  • cargo build --workspace: exit 0
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 857 passed, 0 failed, 42 ignored (lib: 808 passed, 0 failed, 22 ignored; integration binaries: 49 passed, 0 failed, 20 ignored; gpu::dxil: 79 passed, 0 failed, 1 ignored — malformed_containers_are_errors, wave_ops_match_cpu, and half_precision_overloads_run all pass)
    • SKIPPED (3): gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask (no wave64), gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware (no wave64), heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows)
  • XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp --no-fail-fast -- --test-threads=4: 194 passed, 0 failed, 18 ignored (SKIPPED: 2 no wave64)
  • XCL_DIRECT_DXIL=all cargo test -p xcl --lib gpu::recomp --no-fail-fast -- --test-threads=4: 194 passed, 0 failed, 18 ignored (SKIPPED: 2 no wave64)

Not tested

  • Release build, DXC 1.9, native wave64 / AMD / Intel hardware, retail shader pack (XCL_SAMPLE_* unset), and title smoke runs.

AI use: Antigravity (Gemini 4 Neon) ran the build and test commands on this machine and drafted this report from their output.

**@⁠MiguelMachado-dev** on GitHub · 2026-11-24 18:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140694852) Blackwell (`RTX 5080`, driver `621.24`, DXC `1.8.2502.11`) validation run on `d24db9f86ddb27efe115d084a06d59fb1e26c47c`: all tests pass, including `malformed_containers_are_errors` on DXC 1.8. **Tested** - Commit: `d24db9f86ddb27efe115d084a06d59fb1e26c47c` (clean tree, debug build) - Hardware / software: NVIDIA GeForce RTX 5080 16 GB (Blackwell, 32-lane waves, driver `621.24`), Intel Core i7-14700KF, Windows 11 build `26300`, `rustc 1.97.1` (`stable-x86_64-pc-windows-msvc`), DXC `1.8.2502.11` (`Windows Kits\10\bin\10.0.26100.0\x64`, `dxil.dll` present) - `cargo build --workspace`: exit 0 - `cargo test --workspace --no-fail-fast -- --test-threads=4`: **857 passed, 0 failed, 42 ignored** (`lib`: 808 passed, 0 failed, 22 ignored; integration binaries: 49 passed, 0 failed, 20 ignored; `gpu::dxil`: 79 passed, 0 failed, 1 ignored — `malformed_containers_are_errors`, `wave_ops_match_cpu`, and `half_precision_overloads_run` all pass) - `SKIPPED` (3): `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask` (`no wave64`), `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware` (`no wave64`), `heap_window_out_of_memory_falls_back_to_the_switch_form` (`no heap windows`) - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp --no-fail-fast -- --test-threads=4`: **194 passed, 0 failed, 18 ignored** (`SKIPPED`: 2 `no wave64`) - `XCL_DIRECT_DXIL=all cargo test -p xcl --lib gpu::recomp --no-fail-fast -- --test-threads=4`: **194 passed, 0 failed, 18 ignored** (`SKIPPED`: 2 `no wave64`) **Not tested** - Release build, DXC 1.9, native wave64 / AMD / Intel hardware, retail shader pack (`XCL_SAMPLE_*` unset), and title smoke runs. **AI use:** Antigravity (Gemini 4 Neon) ran the build and test commands on this machine and drafted this report from their output.
Author
Owner

@⁠Sr-0w on GitHub · 2026-11-24 18:33 UTC · original

@⁠bmjask title runs with XCL_DIRECT_DXIL=1 on RDNA3 (RX 7800 XT, native wave64, release, XCL_TRANSLATED_CACHE=0), before and after 6976bc4:

065aef3 (earlier run) d24db9f 81d2ad5
compute builds in the run 107 127 183
DXIL of those builds 59.5 MB 6.2 MB 11.9 MB
largest DXIL 13.98 MB 0.84 MB 0.94 MB
slowest driver build 65.0 s 25.1 s 28.1 s
end of the run title watchdog, 145 s amdxc64.dll+0xe717fb, read at 0x28, in CreateComputePipelineState, 142 s title watchdog (+0x23cf683), 137 s
  • The size work shows in the title: the DXIL the world load builds is about a tenth of what it was, and no single build passes 30 s any more.
  • 6976bc4 fixes the driver fault on this card too. On d24db9f the run died in AMD's compiler on a null read, the same class as @⁠Arvi23's irreducible-flow finding. On 81d2ad5 there is no driver fault, and the run goes on until the title's watchdog.
  • What the watchdog catches now is the sum of the compiles, not any one of them. From about 107 s, five title threads each call CreateComputePipelineState back to back, and each spends 23–29 s of the last 30 s inside the driver: 5–29 builds per thread, none over 16 s. So a title thread does not return to its loop for about 30 s, and the watchdog fires. This is outside this PR (where compute pipelines get built, not what they are built from), so I'm only noting it here for the direct path's numbers.

AI use: Claude Code (Claude Opus 5.5) ran the title, read the logs and wrote this comment.

**@⁠Sr-0w** on GitHub · 2026-11-24 18:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140804690) @⁠bmjask title runs with `XCL_DIRECT_DXIL=1` on RDNA3 (RX 7800 XT, native wave64, release, `XCL_TRANSLATED_CACHE=0`), before and after `6976bc4`: | | `065aef3` (earlier run) | `d24db9f` | `81d2ad5` | |---|---|---|---| | compute builds in the run | 107 | 127 | 183 | | DXIL of those builds | 59.5 MB | **6.2 MB** | 11.9 MB | | largest DXIL | 13.98 MB | **0.84 MB** | 0.94 MB | | slowest driver build | 65.0 s | **25.1 s** | 28.1 s | | end of the run | title watchdog, 145 s | **`amdxc64.dll+0xe717fb`, read at 0x28**, in `CreateComputePipelineState`, 142 s | title watchdog (`+0x23cf683`), 137 s | - **The size work shows in the title:** the DXIL the world load builds is about a tenth of what it was, and no single build passes 30 s any more. - **`6976bc4` fixes the driver fault on this card too.** On `d24db9f` the run died in AMD's compiler on a null read, the same class as @⁠Arvi23's irreducible-flow finding. On `81d2ad5` there is no driver fault, and the run goes on until the title's watchdog. - **What the watchdog catches now** is the sum of the compiles, not any one of them. From about 107 s, five title threads each call `CreateComputePipelineState` back to back, and each spends 23–29 s of the last 30 s inside the driver: 5–29 builds per thread, none over 16 s. So a title thread does not return to its loop for about 30 s, and the watchdog fires. This is outside this PR (where compute pipelines get built, not what they are built from), so I'm only noting it here for the direct path's numbers. AI use: Claude Code (Claude Opus 5.5) ran the title, read the logs and wrote this comment.
Author
Owner

@⁠erickbobd on GitHub · 2026-11-24 18:33 UTC · original

I ran the Windows/Blackwell functional checks on clean 81d2ad5a9d06f6d11211f0c2524d5db9c3362bcf (same tree as the c160d86 merge). Workspace: 858 passed / 0 failed / 42 ignored; gpu::dxil: 80 / 0 / 1; direct-enabled gpu::recomp: 194 / 0 / 18. RTX 5070 Ti, NVIDIA 617.14, SDK DXC 1.8.2502.11.

The detailed commands, skips and limits are in the requested GPU-results thread: #42 . This does not cover a retail title's direct runtime path or the separate per-lane adapter; I am testing the latter separately.

AI use: Codex (GPT-6; exact variant unavailable) ran the checks and wrote this note.

**@⁠erickbobd** on GitHub · 2026-11-24 18:33 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140809546) I ran the Windows/Blackwell functional checks on clean `81d2ad5a9d06f6d11211f0c2524d5db9c3362bcf` (same tree as the `c160d86` merge). Workspace: 858 passed / 0 failed / 42 ignored; `gpu::dxil`: 80 / 0 / 1; direct-enabled `gpu::recomp`: 194 / 0 / 18. RTX 5070 Ti, NVIDIA 617.14, SDK DXC 1.8.2502.11. The detailed commands, skips and limits are in the requested GPU-results thread: https://git.gtahub.st/github/xcl-dev--xcl/issues/42 . This does not cover a retail title's direct runtime path or the separate per-lane adapter; I am testing the latter separately. AI use: Codex (GPT-6; exact variant unavailable) ran the checks and wrote this note.
Author
Owner

@⁠HKEY-Funk-Machine on GitHub · 2026-11-24 18:48 UTC · original

@⁠bmjask the irreducible-CFG fix works on the RX 9070: cs 62b584e061c05fc5 now builds, and there's no amdxc64.dll+0x6800a4 fault. The run ended later on something else, an out-of-memory abort while the driver was building the largest direct-DXIL compute programs (details below).

Tested

  • main c160d86 (#1426 merged, includes 81d2ad5) + #751 + #1288 (both needed to get past the title's watchdog and a texture race here) + two local-only changes: skip InitializeApiImplEx2 in xgameruntime/api.rs (hangs here), and a log line before and after each compute CreateComputePipelineState. Release build.
  • AMD Radeon RX 9070 (RDNA4, native wave64), driver 32.0.32015.7029, Ryzen 9 7945HX3D, 32 GB RAM (commit limit ~67 GB), Windows 11 Pro 26300, Rust 1.100.0.
  • XCL_DIRECT_DXIL=1 XCL_TRANSLATED_CACHE=0 XCL_PSO_DISK_CACHE=0 XCL_PSO_PRELOAD=0 XCL_NETWORK=0 timeout 900 xcl run <game>, A pressed on the title screen.

Results

  • cs 62b584e061c05fc5: direct DXIL, 190 888 B, CreateComputePipelineState hr=0x0 in 7.2 s. 0 direct DXIL fallback lines in the whole run, for this program or any other.
  • 281 compute pipelines built through the direct path: mean 81 KB of DXIL, mean 1.87 s, slowest 51.8 s. 1 800 frames presented, then the title waited on pipeline builds, as on the HLSL path.
  • End of the run: at the end, two builds were still in progress: cs 56c0cd3b82a00c6e (14 766 824 B of DXIL, the size @⁠Sr-0w lists for the largest program) and cs 4585e350d1b864e3 (891 140 B). Then cs 83a0f0eec0ddb740 (454 216 B) returned 0x8007000E after 16.9 s, and a 3 MB Rust allocation failed (memory allocation of 3145728 bytes failed). The process exited with 0xc0000409.
  • A second run with memory sampled every 2 s (same tree and settings) ended the same way and points at the 14.7 MB build. Its private bytes were 28.7 GB when cs 56c0cd3b82a00c6e's CreateComputePipelineState began (13:45:15). From there they climbed steadily, about 0.9 GB/s, to 105 GB (system commit 121 GB) 82 s later. Then the next builds returned 0x8007000E and a 1.5 MB allocation failed (0xc0000409 again). That build never returned. Meanwhile seven other compute builds (287–438 KB of DXIL) started and finished one after another on another thread, in 4–17 s each, so they can't account for a 76 GB climb. I didn't run the cross-check with that one build skipped. (62b584e061c05fc5 built in 1 ms in this run, from the driver's own cache.) This matches @⁠Sr-0w's point that the size cleanup doesn't reach the largest programs yet. His RX 7800 XT title runs on 81d2ad5 end at the watchdog (~137 s) with 0.94 MB as the largest DXIL. With #1288 the title here gets past the watchdog, which is probably why this run reached the 14.7 MB program.

Not tested

  • Fuzz seeds 1599 / 722 (the tests are in the follow-up PR now), the XCL_DXIL_DUMP statistics (not needed since it no longer faults), XCL_DIRECT_DXIL=all, and a run with cs 56c0cd3b82a00c6e skipped, the same program on the HLSL path (my HLSL runs stall before reaching it), and anything past the out-of-memory abort.

AI use: Claude Code (Claude Opus 5.5) ran the build, the two runs and the memory sampling, and wrote this comment.

**@⁠HKEY-Funk-Machine** on GitHub · 2026-11-24 18:48 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7141181058) @⁠bmjask the irreducible-CFG fix works on the RX 9070: `cs 62b584e061c05fc5` now builds, and there's no `amdxc64.dll+0x6800a4` fault. The run ended later on something else, an out-of-memory abort while the driver was building the largest direct-DXIL compute programs (details below). **Tested** - `main` `c160d86` (#1426 merged, includes `81d2ad5`) + #751 + #1288 (both needed to get past the title's watchdog and a texture race here) + two local-only changes: skip `InitializeApiImplEx2` in `xgameruntime/api.rs` (hangs here), and a log line before and after each compute `CreateComputePipelineState`. Release build. - AMD Radeon RX 9070 (RDNA4, native wave64), driver 32.0.32015.7029, Ryzen 9 7945HX3D, 32 GB RAM (commit limit ~67 GB), Windows 11 Pro 26300, Rust 1.100.0. - `XCL_DIRECT_DXIL=1 XCL_TRANSLATED_CACHE=0 XCL_PSO_DISK_CACHE=0 XCL_PSO_PRELOAD=0 XCL_NETWORK=0 timeout 900 xcl run <game>`, A pressed on the title screen. **Results** - `cs 62b584e061c05fc5`: direct DXIL, **190 888 B, `CreateComputePipelineState` hr=0x0 in 7.2 s**. 0 `direct DXIL fallback` lines in the whole run, for this program or any other. - 281 compute pipelines built through the direct path: mean 81 KB of DXIL, mean 1.87 s, slowest 51.8 s. 1 800 frames presented, then the title waited on pipeline builds, as on the HLSL path. - **End of the run:** at the end, two builds were still in progress: `cs 56c0cd3b82a00c6e` (**14 766 824 B** of DXIL, the size @⁠Sr-0w lists for the largest program) and `cs 4585e350d1b864e3` (891 140 B). Then `cs 83a0f0eec0ddb740` (454 216 B) returned `0x8007000E` after 16.9 s, and a 3 MB Rust allocation failed (`memory allocation of 3145728 bytes failed`). The process exited with `0xc0000409`. - **A second run with memory sampled every 2 s** (same tree and settings) ended the same way and points at the 14.7 MB build. Its private bytes were 28.7 GB when `cs 56c0cd3b82a00c6e`'s `CreateComputePipelineState` began (13:45:15). From there they climbed steadily, about 0.9 GB/s, to **105 GB** (system commit 121 GB) 82 s later. Then the next builds returned `0x8007000E` and a 1.5 MB allocation failed (`0xc0000409` again). That build never returned. Meanwhile seven other compute builds (287–438 KB of DXIL) started and finished one after another on another thread, in 4–17 s each, so they can't account for a 76 GB climb. I didn't run the cross-check with that one build skipped. (`62b584e061c05fc5` built in 1 ms in this run, from the driver's own cache.) This matches @⁠Sr-0w's point that the size cleanup doesn't reach the largest programs yet. His RX 7800 XT title runs on `81d2ad5` end at the watchdog (~137 s) with 0.94 MB as the largest DXIL. With #1288 the title here gets past the watchdog, which is probably why this run reached the 14.7 MB program. **Not tested** - Fuzz seeds 1599 / 722 (the tests are in the follow-up PR now), the `XCL_DXIL_DUMP` statistics (not needed since it no longer faults), `XCL_DIRECT_DXIL=all`, and a run with `cs 56c0cd3b82a00c6e` skipped, the same program on the HLSL path (my HLSL runs stall before reaching it), and anything past the out-of-memory abort. AI use: Claude Code (Claude Opus 5.5) ran the build, the two runs and the memory sampling, and wrote this comment.
Author
Owner

@⁠ik0nk4 on GitHub · 2026-11-24 18:27 UTC · original · edited 2026-11-24 18:48 UTC

Independent Windows A/B check for the direct DXIL sweep at d24db9f and 76c527b (the current head 81d2ad5 only removes documentation from the diff).

Setup — Windows 11 Pro build 26200, Rust 1.100.0 x86_64-pc-windows-gnu release build, DXC and validator 1.9.2609.5. Unmodified translator, same local retail shader archive, fresh XCL cache per run:

xcl shaders <local pack> --direct --sample 200 --seed 1269 --split 0 --windows 4 --threads 1 --max-bytes 16384 --timeout 10 --compare --validate
Revision Direct output validated Unsupported Direct DXIL bytes HLSL + DXC bytes Direct translation + validation p50 / p95
d24db9f run 1 171/175 4 9,040,812 8,033,796 22.34 / 90.23 ms
d24db9f run 2 171/175 4 9,040,812 8,033,796 24.36 / 101.89 ms
76c527b run 1 171/175 4 9,040,812 8,033,796 15.53 / 56.74 ms

Each run translated CS 9/9, MS 69/69, PS 71/71 and VS 22/22. The four refusals were ES+GS geometry mode. The 16 KiB input cap skipped 25 programs. Zero validator failures, panics or timeouts. Sizes are totals over the same 171 successful pairs and direct output was 12.5% larger in aggregate. Coverage and aggregate size were stable across the CFG and SSA changes on this sample.

The newer run has one timing sample and the percentiles include validation and thread overhead. This sweep did not time HLSL compilation separately, create driver PSOs, or test giant compute shaders or the AMD driver crash.

AI use: OpenAI Codex (GPT-6.2 Sol) assisted with the local build, test execution and report drafting.

Hardware follow-up on 76c527b — Windows 11 build 26200, AMD Radeon RX 9060 XT (RDNA4), driver 32.0.32029.2010, AMD Ryzen 7 5700X 8-Core Processor, Agility SDK 1.619.1 and DXC 1.9.2609.5. Ran gpu::dxil::ops_tests::wave_ops_match_cpu and gpu::dxil::ops_tests::half_precision_overloads_run in separate release test processes with XCL_ADAPTER=radeon and XCL_REQUIRE_GPU=wave64. Both passed with no skips. The command for each case was cargo test --locked --release -p xcl --lib gpu::dxil::ops_tests::<test> -- --exact --nocapture. These are synthetic GPU checks. The retail pipeline that previously crashed the driver was outside this follow-up.

Follow-up: size-cap coverage on the same 200 records. At 76c527b, reran the command above without --compare, with --timeout 30 and three input caps. Validated / attempted: 171/175 at 16 KiB, 191/196 at 64 KiB, and 195/200 at 4 MiB (zero skipped). Of the 25 programs previously excluded by size, 24 validated. The additional refusal was a pixel shader using image_get_lod with a static sampler (record offset 0xbca5b82, FSSM#0). The other four refusals were ES+GS. All 16 compute programs validated. Zero validator failures, panics or timeouts. This checks DXIL validation only. No GPU dispatch or rendering was measured in these runs.

Input for the size-cap sweep: shaders.rpf, 411695600 bytes, SHA-256 0bc1634594e51ca8e7ef5f2bc6f5b32b081ce779ac094d686de08ecb75dc24a8. AI use for this follow-up: OpenAI Codex (GPT-6.2 Astra) ran the size-cap checks and drafted the addendum.

**@⁠ik0nk4** on GitHub · 2026-11-24 18:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7140667340) · edited 2026-11-24 18:48 UTC Independent Windows A/B check for the direct DXIL sweep at `d24db9f` and `76c527b` (the current head `81d2ad5` only removes documentation from the diff). **Setup** — Windows 11 Pro build 26200, Rust 1.100.0 x86_64-pc-windows-gnu release build, DXC and validator 1.9.2609.5. Unmodified translator, same local retail shader archive, fresh XCL cache per run: ```text xcl shaders <local pack> --direct --sample 200 --seed 1269 --split 0 --windows 4 --threads 1 --max-bytes 16384 --timeout 10 --compare --validate ``` | Revision | Direct output validated | Unsupported | Direct DXIL bytes | HLSL + DXC bytes | Direct translation + validation p50 / p95 | |---|---:|---:|---:|---:|---:| | `d24db9f` run 1 | 171/175 | 4 | 9,040,812 | 8,033,796 | 22.34 / 90.23 ms | | `d24db9f` run 2 | 171/175 | 4 | 9,040,812 | 8,033,796 | 24.36 / 101.89 ms | | `76c527b` run 1 | 171/175 | 4 | 9,040,812 | 8,033,796 | 15.53 / 56.74 ms | Each run translated CS 9/9, MS 69/69, PS 71/71 and VS 22/22. The four refusals were ES+GS geometry mode. The 16 KiB input cap skipped 25 programs. Zero validator failures, panics or timeouts. Sizes are totals over the same 171 successful pairs and direct output was 12.5% larger in aggregate. Coverage and aggregate size were stable across the CFG and SSA changes on this sample. The newer run has one timing sample and the percentiles include validation and thread overhead. This sweep did not time HLSL compilation separately, create driver PSOs, or test giant compute shaders or the AMD driver crash. AI use: OpenAI Codex (GPT-6.2 Sol) assisted with the local build, test execution and report drafting. **Hardware follow-up on `76c527b`** — Windows 11 build 26200, AMD Radeon RX 9060 XT (RDNA4), driver 32.0.32029.2010, AMD Ryzen 7 5700X 8-Core Processor, Agility SDK 1.619.1 and DXC 1.9.2609.5. Ran `gpu::dxil::ops_tests::wave_ops_match_cpu` and `gpu::dxil::ops_tests::half_precision_overloads_run` in separate release test processes with `XCL_ADAPTER=radeon` and `XCL_REQUIRE_GPU=wave64`. Both passed with no skips. The command for each case was `cargo test --locked --release -p xcl --lib gpu::dxil::ops_tests::<test> -- --exact --nocapture`. These are synthetic GPU checks. The retail pipeline that previously crashed the driver was outside this follow-up. **Follow-up: size-cap coverage on the same 200 records.** At `76c527b`, reran the command above without `--compare`, with `--timeout 30` and three input caps. Validated / attempted: 171/175 at 16 KiB, 191/196 at 64 KiB, and 195/200 at 4 MiB (zero skipped). Of the 25 programs previously excluded by size, 24 validated. The additional refusal was a pixel shader using `image_get_lod` with a static sampler (record offset `0xbca5b82`, FSSM#0). The other four refusals were ES+GS. All 16 compute programs validated. Zero validator failures, panics or timeouts. This checks DXIL validation only. No GPU dispatch or rendering was measured in these runs. Input for the size-cap sweep: `shaders.rpf`, 411695600 bytes, SHA-256 `0bc1634594e51ca8e7ef5f2bc6f5b32b081ce779ac094d686de08ecb75dc24a8`. AI use for this follow-up: OpenAI Codex (GPT-6.2 Astra) ran the size-cap checks and drafted the addendum.
Author
Owner

@⁠Daydream3r on GitHub · 2026-11-24 18:56 UTC · original

Independent RTX 5070 Ti checks of merged c160d86ef2, clean main, 2026-11-24. No source changes.

Tested

  • RTX 5070 Ti / NVIDIA 621.01, Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 25H2 26200.6584, Rust 1.100.0 MSVC, MSVC Build Tools 2022 17.14.37906.3, DXC/DXIL 1.9.2609.5. XCL_ADAPTER=RTX 5070 Ti; debug for cargo tests, release for CLI/title. Builds already passed on this commit.
  • cargo test --locked -p xcl --lib gpu::dxil -- --nocapture --test-threads=4: 80 passed, 0 failed, 1 ignored.
  • XCL_DIRECT_DXIL=all, cargo test --locked -p xcl --lib gpu::recomp -- --nocapture --test-threads=4: 194 passed, 0 failed, 18 ignored. Two explicit skips inside the passing count: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64). This set includes HLSL/geometry cases retained by its wrappers; it is not a direct-only test count.
  • XCL_DIRECT_DXIL=1, cargo test --locked -p xcl --test gpu_compute_e2e -- --nocapture --test-threads=1: 4 passed, 0 failed, 0 ignored. These three commands used XCL_HEAP_WINDOWS=1, XCL_REQUIRE_GPU=mesh, networking off, no game sample inputs.

Real shader graphics checks and heap-window control

With XCL_SAMPLE_RPF pointing to the local title's pack, XCL_REQUIRE_GPU=mesh, use:
cargo test --locked -p xcl --test gpu_pso_e2e -- --nocapture --test-threads=1 retail_vs_ps_through_the_pso_hook_render_and_read_back retail_textured_ps_decoded_descriptors_and_a_descriptor_change_between_draws

XCL_DIRECT_DXIL XCL_HEAP_WINDOWS Result
unset unset 2 passed, 0 failed, 0 ignored
all unset 2 passed, 0 failed, 0 ignored
unset 1 0 passed, 2 failed, 0 ignored
all 1 0 passed, 2 failed, 0 ignored

In each failing row, the readback was the clear colour [0.1, 0.2, 0.3, 0.4]: the textured test expected [0.0, 0.0, 1.0, 1.0] at (0,0), and the triangle test failed at (25,17). The all + heap-windows row explicitly logged VS/PS fallback to HLSL because heap memory windows are unsupported by direct translation. No claim that this failure is caused by the direct backend, or that it proves an in-game rendering fault: the harness-versus-runtime cause is not isolated.

Repeated the all/heap-unset row and unset/heap-1 row with XCL_TRANSLATED_CACHE=0 and a separate XCL_DXIL_CACHE: respectively 2 passed and 2 failed again. The passing direct graphics repeat logged no fallback. No assertions were changed.

Bounded real-pack sample

xcl shaders <local shaders.rpf> --direct --sample 32 --seed 20261124 --validate --compare --max-bytes 16384 --timeout 10 --threads 1

31 programs from 32 sampled records (seed 20261124; 1 over 16384 B skipped), validated, compared with HLSL+DXC
direct DXIL coverage
  stage     total  translated  unsupported  validator  panicked  timeout
  GS            1        0 (  0.0%)          1          0         0        0
  MS           15       15 (100.0%)          0          0         0        0
  PS           12       12 (100.0%)          0          0         0        0
  VS            3        3 (100.0%)          0          0         0        0
  all          31       30 ( 96.8%)          1          0         0        0
  translation time per program: p50 11.60 ms, p95 41.27 ms, max 49.97 ms
  DXIL size, 30 programs: direct 1858900 B, HLSL+DXC 1633996 B (direct/HLSL 1.14)
  unsupported constructs (1 kinds, top 1):
       1  geometry mode (ES+GS): not supported by the direct translator  [GS 1]  e.g. VS_VoxelizeGeneric_f406ea93_Wrapped @0x19af2b5 FSSM#0
time 8.5 s

This validates DXIL and compares output size against HLSL+DXC; it does not compare rendered pixels for all sampled programs. No compute programs happened to be selected. The small sample is not corpus-wide coverage or a speed benchmark.

Live title, networking off, heap windows unset

  • Two 60 s no-input runs from separately copied matching title-data and DXIL-cache snapshots, ordinary path vs XCL_DIRECT_DXIL=1: both exit 0, no crash/device-removal matches. Raw generated smoke blocks reported 1655 vs 1671 frames and peak commit 14529 vs 14628 MB. This small difference is not an acceleration claim; neither run tested world loading. Direct run's exit summary: CS direct 27 / HLSL fallback 0.
  • A further interactive run with XCL_DIRECT_DXIL=1, XCL_DIRECT_DXIL_STATS=1, existing direct-run cache, requested limit 180 s: user pressed Enter for Player1. I saw coloured loading artwork, then no rendered world. At 115.368 s it crashed with 0xc0000005 at game_scarlett_master.exe+0x23cf683, write to 0x0; stack includes +0x2215c35. Same signature as the earlier ordinary-path run on 9e3831e, but not a same-commit/input-timed A/B comparison, so not evidence of a direct-path regression.
  • At this crash the summary was CS direct 221 / HLSL fallback 0. These are translation counters, not a count of distinct shaders proven to execute correctly. Report: 2053 presents; no device removal; peak commit 29482 MB. Smoke parser counted two matching crash lines for this one process crash.
  • DirectStorage also logged 0x89240009 for requests associated with texture files which do exist locally. XCL defines this code as E_ACCESS_VIOLATION; this is not evidence that the archives are missing/corrupt or that file reads hit EOF. The precise failed memory check was not isolated.

Not tested

  • Full direct-enabled workspace suite, live =all graphics, rendered gameplay, native wave64, AMD/Intel/WARP, D3D12 debug layer, long-run performance, deterministic input-timed same-binary fault comparison. The agent cannot hear audio and makes no audio-quality claim.

AI use

Codex desktop, GPT-6 ran the commands on this PC, inspected the sources and window screenshots, and drafted this report from actual logs. No game files, shader binaries, dumps or images attached. Hardware test report, not a merge approval.

**@⁠Daydream3r** on GitHub · 2026-11-24 18:56 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7141371615) Independent RTX 5070 Ti checks of merged **c160d86ef2efe3a07e4dfb473e4fa72eafb413c0**, clean main, 2026-11-24. No source changes. **Tested** - RTX 5070 Ti / NVIDIA 621.01, Ryzen 7 9800X3D, 64 GB, Windows 11 Pro 25H2 26200.6584, Rust 1.100.0 MSVC, MSVC Build Tools 2022 17.14.37906.3, DXC/DXIL 1.9.2609.5. `XCL_ADAPTER=RTX 5070 Ti`; debug for cargo tests, release for CLI/title. Builds already passed on this commit. - `cargo test --locked -p xcl --lib gpu::dxil -- --nocapture --test-threads=4`: 80 passed, 0 failed, 1 ignored. - `XCL_DIRECT_DXIL=all`, `cargo test --locked -p xcl --lib gpu::recomp -- --nocapture --test-threads=4`: 194 passed, 0 failed, 18 ignored. Two explicit skips inside the passing count: `gpu_geometry_wave32_prefix_count_over_a_mask` and `gpu_wave32_program_in_wave64_hardware` (`no wave64`). This set includes HLSL/geometry cases retained by its wrappers; it is not a direct-only test count. - `XCL_DIRECT_DXIL=1`, `cargo test --locked -p xcl --test gpu_compute_e2e -- --nocapture --test-threads=1`: 4 passed, 0 failed, 0 ignored. These three commands used `XCL_HEAP_WINDOWS=1`, `XCL_REQUIRE_GPU=mesh`, networking off, no game sample inputs. **Real shader graphics checks and heap-window control** With `XCL_SAMPLE_RPF` pointing to the local title's pack, `XCL_REQUIRE_GPU=mesh`, use: `cargo test --locked -p xcl --test gpu_pso_e2e -- --nocapture --test-threads=1 retail_vs_ps_through_the_pso_hook_render_and_read_back retail_textured_ps_decoded_descriptors_and_a_descriptor_change_between_draws` | XCL_DIRECT_DXIL | XCL_HEAP_WINDOWS | Result | |---|---|---| | unset | unset | 2 passed, 0 failed, 0 ignored | | all | unset | 2 passed, 0 failed, 0 ignored | | unset | 1 | 0 passed, 2 failed, 0 ignored | | all | 1 | 0 passed, 2 failed, 0 ignored | In each failing row, the readback was the clear colour `[0.1, 0.2, 0.3, 0.4]`: the textured test expected `[0.0, 0.0, 1.0, 1.0]` at (0,0), and the triangle test failed at (25,17). The `all` + heap-windows row explicitly logged VS/PS fallback to HLSL because heap memory windows are unsupported by direct translation. No claim that this failure is caused by the direct backend, or that it proves an in-game rendering fault: the harness-versus-runtime cause is not isolated. Repeated the `all`/heap-unset row and unset/heap-1 row with `XCL_TRANSLATED_CACHE=0` and a separate `XCL_DXIL_CACHE`: respectively 2 passed and 2 failed again. The passing direct graphics repeat logged no fallback. No assertions were changed. **Bounded real-pack sample** `xcl shaders <local shaders.rpf> --direct --sample 32 --seed 20261124 --validate --compare --max-bytes 16384 --timeout 10 --threads 1` ```text 31 programs from 32 sampled records (seed 20261124; 1 over 16384 B skipped), validated, compared with HLSL+DXC direct DXIL coverage stage total translated unsupported validator panicked timeout GS 1 0 ( 0.0%) 1 0 0 0 MS 15 15 (100.0%) 0 0 0 0 PS 12 12 (100.0%) 0 0 0 0 VS 3 3 (100.0%) 0 0 0 0 all 31 30 ( 96.8%) 1 0 0 0 translation time per program: p50 11.60 ms, p95 41.27 ms, max 49.97 ms DXIL size, 30 programs: direct 1858900 B, HLSL+DXC 1633996 B (direct/HLSL 1.14) unsupported constructs (1 kinds, top 1): 1 geometry mode (ES+GS): not supported by the direct translator [GS 1] e.g. VS_VoxelizeGeneric_f406ea93_Wrapped @0x19af2b5 FSSM#0 time 8.5 s ``` This validates DXIL and compares output size against HLSL+DXC; it does not compare rendered pixels for all sampled programs. No compute programs happened to be selected. The small sample is not corpus-wide coverage or a speed benchmark. **Live title, networking off, heap windows unset** - Two 60 s no-input runs from separately copied matching title-data and DXIL-cache snapshots, ordinary path vs `XCL_DIRECT_DXIL=1`: both exit 0, no crash/device-removal matches. Raw generated smoke blocks reported 1655 vs 1671 frames and peak commit 14529 vs 14628 MB. This small difference is not an acceleration claim; neither run tested world loading. Direct run's exit summary: `CS direct 27 / HLSL fallback 0`. - A further interactive run with `XCL_DIRECT_DXIL=1`, `XCL_DIRECT_DXIL_STATS=1`, existing direct-run cache, requested limit 180 s: user pressed Enter for Player1. I saw coloured loading artwork, then no rendered world. At **115.368 s** it crashed with **0xc0000005 at game_scarlett_master.exe+0x23cf683**, write to 0x0; stack includes +0x2215c35. Same signature as the earlier ordinary-path run on 9e3831e, but not a same-commit/input-timed A/B comparison, so not evidence of a direct-path regression. - At this crash the summary was **CS direct 221 / HLSL fallback 0**. These are translation counters, not a count of distinct shaders proven to execute correctly. Report: 2053 presents; no device removal; peak commit 29482 MB. Smoke parser counted two matching crash lines for this one process crash. - DirectStorage also logged 0x89240009 for requests associated with texture files which do exist locally. XCL defines this code as E_ACCESS_VIOLATION; this is not evidence that the archives are missing/corrupt or that file reads hit EOF. The precise failed memory check was not isolated. **Not tested** - Full direct-enabled workspace suite, live `=all` graphics, rendered gameplay, native wave64, AMD/Intel/WARP, D3D12 debug layer, long-run performance, deterministic input-timed same-binary fault comparison. The agent cannot hear audio and makes no audio-quality claim. **AI use** Codex desktop, GPT-6 ran the commands on this PC, inspected the sources and window screenshots, and drafted this report from actual logs. No game files, shader binaries, dumps or images attached. Hardware test report, not a merge approval.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-24 19:27 UTC · original

Post-merge AMD validation on the merge commit c160d86e, since this PR was explicitly after more hardware: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, DXC 1.9.2609.5 pinned, release profile, default mode (the ops suite drives the DXIL builder itself, no env needed).

Ran all 20 gpu::dxil::ops_tests::* individually so one death does not hide the rest:

  • 18/20 ok solo
  • gpu::dxil::ops_tests::integer_ops_match_cpu: process dies, deterministic 3/3. Not a Rust panic and no assertion: the wine process just exits (cargo: exit status: 3) mid-test, with --nocapture showing nothing after adapter enumeration.
  • gpu::dxil::ops_tests::uaddc_and_usubb_match_cpu: same silent death.

The two crashers share a theme: carry/borrow (uaddc/usubb) and, in the integer test, wide/duration ops (umul_wide, imul_wide, udiv_rem, bfi/bfe). Silent death with no panic usually means the DXIL handed downstream is rejected in a way that aborts the compile path rather than returning an error, so those specific intrinsics/lowerings are where I would look first.

Also relevant from testing PR #1658's direct-path suite on this same card today: 4/6 green, 2 deterministic failures where lanes that should be predicated off still write (split-wave64 compute), noted there in detail.

So on AMD: the DXIL core is broadly working (18/20 + mesh/graphics stages), with two crash repros and two mask-lane assertion repros, all deterministic and runnable with a single filter each.

Counts only, no game data.

AI use: Hermes agent (local Qwen-class) ran everything and drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-24 19:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7142119770) Post-merge AMD validation on the merge commit `c160d86e`, since this PR was explicitly after more hardware: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, DXC 1.9.2609.5 pinned, release profile, default mode (the ops suite drives the DXIL builder itself, no env needed). Ran all 20 `gpu::dxil::ops_tests::*` individually so one death does not hide the rest: - 18/20 ok solo - `gpu::dxil::ops_tests::integer_ops_match_cpu`: process dies, deterministic 3/3. Not a Rust panic and no assertion: the wine process just exits (cargo: `exit status: 3`) mid-test, with `--nocapture` showing nothing after adapter enumeration. - `gpu::dxil::ops_tests::uaddc_and_usubb_match_cpu`: same silent death. The two crashers share a theme: carry/borrow (`uaddc`/`usubb`) and, in the integer test, wide/duration ops (`umul_wide`, `imul_wide`, `udiv_rem`, `bfi`/`bfe`). Silent death with no panic usually means the DXIL handed downstream is rejected in a way that aborts the compile path rather than returning an error, so those specific intrinsics/lowerings are where I would look first. Also relevant from testing PR #1658's direct-path suite on this same card today: 4/6 green, 2 deterministic failures where lanes that should be predicated off still write (split-wave64 compute), noted there in detail. So on AMD: the DXIL core is broadly working (18/20 + mesh/graphics stages), with two crash repros and two mask-lane assertion repros, all deterministic and runnable with a single filter each. Counts only, no game data. AI use: Hermes agent (local Qwen-class) ran everything and drafted this; I checked it before posting.
Author
Owner

@⁠RandomGithub12309 on GitHub · 2026-11-24 19:27 UTC · original

@⁠bmjask posting #1699 here as well per @⁠gefydev's note on #1269.

It is based on main commit c160d86ef2efe3a07e4dfb473e4fa72eafb413c0 (Merge pull request #1426, PR head 7b8711407e77b09f156eb1d7a5dd2a56a6841dfd) and updates crates/xcl/src/gpu/dxil/lower_mem.rs (kernel.rs TRANSLATOR_VERSION 4 → 5, tests in tests.rs):

  • Replaces with_mem's four sequential guarded diamonds with with_mem_n emitting a single Op::Switch over VAR_WIN (folding constant windows inline), merging results directly via join phis and sealing join as a pass-through from the pre-switch block.
  • Packs contiguous unbounded multi-dword loads/stores (s_load_dwordx2..x16, ld_raw, FLAT/global load_dwordx2..x4 / store_dwordx2..x4) into up to 4-wide rawBufferLoad/rawBufferStore chunks under one switch, shares one switch across s_buffer_load* / buffer_load* dwords with per-dword bounds clamping, and combines 1-dword buffer_store_dword's lane and range guards.

On a 200-program retail pack sweep (--direct --sample 200 --max-bytes 0 --validate --compare, 4 windows, split wave64): 197 / 200 translated (0 validator errors), total DXIL 30.24 MB → 22.57 MB (−25.4 %, direct/HLSL 1.25 → 0.94), translation time p50 20.36 → 15.66 ms, p95 277.55 → 152.00 ms, max 837.86 → 417.81 ms. (Note: #1699 also touches with_mem in lower_mem.rs, which overlaps textually with open #1693; happy to rebase if #1693 lands first.)

AI use: Antigravity (Gemini 4 Neon) wrote this comment (PR #1699 was written with Gemini 4 Carbon and Gemini 4 Hydrogen).

**@⁠RandomGithub12309** on GitHub · 2026-11-24 19:27 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7142125942) @⁠bmjask posting #1699 here as well per @⁠gefydev's note on #1269. It is based on `main` commit `c160d86ef2efe3a07e4dfb473e4fa72eafb413c0` (`Merge pull request #1426`, PR head `7b8711407e77b09f156eb1d7a5dd2a56a6841dfd`) and updates `crates/xcl/src/gpu/dxil/lower_mem.rs` (`kernel.rs` `TRANSLATOR_VERSION` 4 → 5, tests in `tests.rs`): - Replaces `with_mem`'s four sequential `guarded` diamonds with `with_mem_n` emitting a single `Op::Switch` over `VAR_WIN` (folding constant windows inline), merging results directly via `join` phis and sealing `join` as a pass-through from the pre-switch block. - Packs contiguous unbounded multi-dword loads/stores (`s_load_dwordx2..x16`, `ld_raw`, FLAT/global `load_dwordx2..x4` / `store_dwordx2..x4`) into up to 4-wide `rawBufferLoad`/`rawBufferStore` chunks under one switch, shares one switch across `s_buffer_load*` / `buffer_load*` dwords with per-dword bounds clamping, and combines 1-dword `buffer_store_dword`'s lane and range guards. On a 200-program retail pack sweep (`--direct --sample 200 --max-bytes 0 --validate --compare`, 4 windows, split wave64): `197 / 200` translated (`0` validator errors), total DXIL `30.24 MB → 22.57 MB` (`−25.4 %`, `direct/HLSL 1.25 → 0.94`), translation time `p50 20.36 → 15.66 ms`, `p95 277.55 → 152.00 ms`, `max 837.86 → 417.81 ms`. (Note: `#1699` also touches `with_mem` in `lower_mem.rs`, which overlaps textually with open `#1693`; happy to rebase if `#1693` lands first.) AI use: Antigravity (Gemini 4 Neon) wrote this comment (PR #1699 was written with Gemini 4 Carbon and Gemini 4 Hydrogen).
Author
Owner

@⁠Sr-0w on GitHub · 2026-11-24 19:37 UTC · original

@⁠bmjask: a heads-up on your code before I open a PR against main, as @⁠gefydev suggested on #1269.

What: heap memory windows (XCL_HEAP_WINDOWS=1) in the direct form. Today translate_entry refuses them, and the program falls back to HLSL. In heap mode, Lw::with_mem makes one access through ResourceDescriptorHeap[MEM_HEAP_BASE + w], with a non-uniform index, as the HLSL path's heap form does. It no longer switches over 4 root UAVs.

  • An out-of-range w still goes to window 0, the same as your switch.
  • The change touches 5 files in gpu/dxil, +40 lines:
    • Shader::heap_raw_uav;
    • Lw::heap_mems;
    • Lw::multi_window in place of the three mems.len() > 1 checks.
  • One GPU test runs the 4 GiB windows program through both direct forms, switch and heap. It fails with today's refusal and passes with the change.

Why: AMD driver time. RX 7800 XT, main c160d86, cold CreateComputePipelineState, one build at a time. The programs are the slowest builds from my title runs, in your per-instruction form:

program switch, 4 windows heap, 4 windows
5683ddcd01491067 961 KB, 23.1 s 559 KB, 6.1 s
6e148dbd563de205 401 KB, 12.0 s 217 KB, 4.9 s
cc047f458010c5d2 586 KB, 10.1 s 355 KB, 5.7 s
1404420b38db8597 471 KB, 8.2 s 275 KB, 2.9 s
2e0055c25f49848a 277 KB, 7.6 s 174 KB, 3.9 s
34207613d17f8b96 453 KB, 6.9 s 295 KB, 3.7 s
73000efc296c082e 173 KB, 6.7 s 100 KB, 3.5 s
6da1f38b06d6c735 313 KB, 6.2 s 134 KB, 1.7 s

The heap form is within 2–5 % of the one-window DXIL size. On the 21 programs measured (the ones without textures, which the test root signature takes), total driver time goes from 123.4 s to 52.9 s.

A second finding, for a later PR against main if you agree: buffer_*_format computes every conversion for each access and then picks one. For example, 6973db5b609fa431 is 1.7 KB of console code and gives 181 KB of DXIL from 48 format accesses. Tell me if you'd rather do that one yourself.

AI use: Claude Code (Claude Opus 5.5) wrote the change, ran the measurements and wrote this comment.

**@⁠Sr-0w** on GitHub · 2026-11-24 19:37 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7142361200) @⁠bmjask: a heads-up on your code before I open a PR against `main`, as @⁠gefydev suggested on #1269. **What:** heap memory windows (`XCL_HEAP_WINDOWS=1`) in the direct form. Today `translate_entry` refuses them, and the program falls back to HLSL. In heap mode, `Lw::with_mem` makes one access through `ResourceDescriptorHeap[MEM_HEAP_BASE + w]`, with a non-uniform index, as the HLSL path's heap form does. It no longer switches over 4 root UAVs. - An out-of-range `w` still goes to window 0, the same as your switch. - The change touches 5 files in `gpu/dxil`, +40 lines: - `Shader::heap_raw_uav`; - `Lw::heap_mems`; - `Lw::multi_window` in place of the three `mems.len() > 1` checks. - One GPU test runs the 4 GiB windows program through both direct forms, switch and heap. It fails with today's refusal and passes with the change. **Why:** AMD driver time. RX 7800 XT, `main` `c160d86`, cold `CreateComputePipelineState`, one build at a time. The programs are the slowest builds from my title runs, in your per-instruction form: | program | switch, 4 windows | heap, 4 windows | |---|---|---| | `5683ddcd01491067` | 961 KB, 23.1 s | 559 KB, **6.1 s** | | `6e148dbd563de205` | 401 KB, 12.0 s | 217 KB, **4.9 s** | | `cc047f458010c5d2` | 586 KB, 10.1 s | 355 KB, **5.7 s** | | `1404420b38db8597` | 471 KB, 8.2 s | 275 KB, **2.9 s** | | `2e0055c25f49848a` | 277 KB, 7.6 s | 174 KB, **3.9 s** | | `34207613d17f8b96` | 453 KB, 6.9 s | 295 KB, **3.7 s** | | `73000efc296c082e` | 173 KB, 6.7 s | 100 KB, **3.5 s** | | `6da1f38b06d6c735` | 313 KB, 6.2 s | 134 KB, **1.7 s** | The heap form is within 2–5 % of the one-window DXIL size. On the 21 programs measured (the ones without textures, which the test root signature takes), total driver time goes from 123.4 s to 52.9 s. A second finding, for a later PR against `main` if you agree: `buffer_*_format` computes every conversion for each access and then picks one. For example, `6973db5b609fa431` is 1.7 KB of console code and gives 181 KB of DXIL from 48 format accesses. Tell me if you'd rather do that one yourself. AI use: Claude Code (Claude Opus 5.5) wrote the change, ran the measurements and wrote this comment.
Author
Owner

@⁠Fran-co-F on GitHub · 2026-11-24 19:44 UTC · original

@⁠bmjask as @⁠gefydev asked: the DXC-optimizer experiment from #1269 (#1269), for comparison with Module::optimize.

It runs on top of Module::optimize: the baseline is main c160d86, where shader.rs already calls self.m.optimize(). The container then goes through IDxcOptimizer (-hlsl-dxilload -instcombine -simplifycfg -early-cse -gvn -adce -dxil-remove-dead-blocks -globaldce -hlsl-dxilemit), back into a container with IDxcAssembler, and is signed by IDxcValidator (InPlaceEdit).

RX 9070 XT, RADV (Mesa 26.3.1), vkd3d-proton ec20719, cold, one program per process. Totals are translation + optimizer + driver. The same 106 sample programs and 21 hard ones are measured on the HLSL path too.

HLSL path main direct (with Module::optimize) + DXC optimizer
sample, 100 of 106 built 843 s, 32.7 MB DXIL – 250 s, 29.8 MB (median 1.9×)
22303 50.9 s, 893 KB 16.3 s, 1 370 KB 5.5 s, 801 KB
23097 (and 6 more like it) over 26 GB in ACO, never built – 9–12 s, about 1 GB, 1 021 KB

Against main's direct path alone, on the 77 programs measured both ways:

main direct (Module::optimize) + DXC passes
DXIL, total 28.5 MB 18.2 MB (−36 %); per program 0.48–1.22×, median 0.87×
time, total 338 s 149 s (2.3×)
the 23 programs over 2 s 13–28 s each (the ~1.3–1.7 MB ones) 3–9 s each (2.5–3.2×)
the 54 programs under 2 s 11.4 s 15.9 s (the optimizer's 0.05–0.1 s is not recovered)

So instcombine / gvn / simplifycfg still find a lot on top of the in-tree passes, mostly on the big programs. Those are the passes I would look at first. Running them only above a size threshold (about 64 KB of DXIL) would avoid the small-program cost.

  • Flags must match usage: 4 of 106 sample programs (22253, 23062, 23076, 23085), 22617, and 8 programs in a title run. The validator refuses them after the passes, presumably because the shader flags are not recomputed. Those keep the unoptimized container.
  • Not for the giants: 22616 / 22617 (14.8 MB direct) take about 60 s in the optimizer. 22616 then crashes in vkd3d-proton (without @⁠0naku's dxil-spirv patches), and 22617 is refused as above. 22618 and 23213 do not finish in 300 s.
  • 22562 hangs in the driver (0 % CPU, 300 s), with and without the passes.
patch against c160d86 (opt-in, XCL_DIRECT_OPT, 62 lines)
diff --git a/crates/xcl/src/gpu/dxil/validate.rs b/crates/xcl/src/gpu/dxil/validate.rs
index 7ba10b2..caae8a1 100644
--- a/crates/xcl/src/gpu/dxil/validate.rs
+++ b/crates/xcl/src/gpu/dxil/validate.rs
@@ -167,3 +167,55 @@ mod tests {
         }
     }
 }
+
+/// The DXC optimizer's pass names (`IDxcOptimizer`).
+pub fn optimizer_passes() -> Result<Vec<String>, String> {
+    let o: IDxcOptimizer = instance(compiler_create()?, &CLSID_DxcOptimizer)?;
+    let mut out = Vec::new();
+    unsafe {
+        let n = o.GetAvailablePassCount().map_err(|e| format!("{e}"))?;
+        for i in 0..n {
+            let p = o.GetAvailablePass(i).map_err(|e| format!("{e}"))?;
+            let name = p.GetOptionName().map_err(|e| format!("{e}"))?;
+            out.push(name.to_string().unwrap_or_default());
+        }
+    }
+    Ok(out)
+}
+
+/// `container` through `IDxcOptimizer` with `passes`
+/// (e.g. `-instcombine`), then back into a container (`IDxcAssembler`) signed by the
+/// validator (`DxcValidatorFlags_InPlaceEdit`). `Err` says which step refused it.
+pub fn optimize(container: &[u8], passes: &[&str]) -> Result<Vec<u8>, String> {
+    header_fits(container)?;
+    let create = compiler_create()?;
+    let o: IDxcOptimizer = instance(create, &CLSID_DxcOptimizer)?;
+    let input = blob(container)?;
+    let wide: Vec<Vec<u16>> = passes.iter().map(|p| p.encode_utf16().chain([0]).collect()).collect();
+    let ptrs: Vec<windows::core::PCWSTR> = wide.iter().map(|w| windows::core::PCWSTR(w.as_ptr())).collect();
+    let mut module: Option<IDxcBlob> = None;
+    let mut text: Option<IDxcBlobEncoding> = None;
+    unsafe { o.RunOptimizer(&input, &ptrs, &mut module, Some(&mut text)) }.map_err(|e| format!("RunOptimizer: {e}"))?;
+    let module = module.ok_or("RunOptimizer: no module")?;
+    let a: IDxcAssembler = instance(create, &CLSID_DxcAssembler)?;
+    let r = unsafe { a.AssembleToContainer(&module) }.map_err(|e| format!("AssembleToContainer: {e}"))?;
+    unsafe {
+        let st = r.GetStatus().map_err(|e| format!("{e}"))?;
+        if st.is_err() {
+            return Err(format!("assemble: {}", error_text(r.GetErrorBuffer())));
+        }
+    }
+    let out = unsafe { r.GetResult() }.map_err(|e| format!("GetResult: {e}"))?;
+    let bytes = unsafe { std::slice::from_raw_parts(out.GetBufferPointer() as *const u8, out.GetBufferSize()).to_vec() };
+    // sign: the validator writes the digest into the container it checked
+    let v: IDxcValidator = instance(create, &CLSID_DxcValidator)?;
+    let b = blob(&bytes)?;
+    unsafe {
+        let r = v.Validate(&b, DxcValidatorFlags_InPlaceEdit).map_err(|e| format!("Validate: {e}"))?;
+        let st = r.GetStatus().map_err(|e| format!("{e}"))?;
+        if st.is_err() {
+            return Err(format!("validate: {}", error_text(r.GetErrorBuffer()).lines().next().unwrap_or("")));
+        }
+        Ok(std::slice::from_raw_parts(b.GetBufferPointer() as *const u8, b.GetBufferSize()).to_vec())
+    }
+}
diff --git a/crates/xcl/src/gpu/recomp/pso.rs b/crates/xcl/src/gpu/recomp/pso.rs
index 46e237b..f541d0b 100644
--- a/crates/xcl/src/gpu/recomp/pso.rs
+++ b/crates/xcl/src/gpu/recomp/pso.rs
@@ -346,8 +346,17 @@ fn compile_console_shader(blob: &[u8], stage: Stage, sampler_base: u32, windows:
     // for what it cannot translate yet
     if stage == Stage::Compute && crate::gpu::dxil::kernel::enabled() {
         match direct_compute(blob, sampler_base, windows, split_wave64) {
-            Ok(c) => {
+            Ok(mut c) => {
                 crate::gpu::dxil::coverage::record_translated("CS");
+                // `XCL_DIRECT_OPT="-pass …"` (opt-in): the container through DXC's own optimizer,
+                // re-assembled and signed; kept unoptimized when any step refuses it
+                if let Ok(passes) = std::env::var("XCL_DIRECT_OPT") {
+                    let list: Vec<&str> = passes.split_whitespace().collect();
+                    match crate::gpu::dxil::validate::optimize(&c.dxil, &list) {
+                        Ok(d) => c.dxil = d,
+                        Err(e) => crate::xlog_info!("[SHADER] direct DXIL optimizer refused ({}): unoptimized", e.lines().next().unwrap_or("")),
+                    }
+                }
                 return Ok(c);
             }
             Err(e) => direct_fallback("CS", &e),

Tested: release cross-build for x86_64-pc-windows-msvc from Linux, runs under Wine + vkd3d-proton on the hardware above. Not tested: the test suite (Linux only here), Windows / NVIDIA, other pass lists.

AI use: Claude Code (Claude Opus 5.5) wrote the patch, ran the measurements on my machine and wrote this.

**@⁠Fran-co-F** on GitHub · 2026-11-24 19:44 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7142522294) @⁠bmjask as @⁠gefydev asked: the DXC-optimizer experiment from #1269 (https://git.gtahub.st/github/xcl-dev--xcl/issues/1269), for comparison with `Module::optimize`. **It runs on top of `Module::optimize`:** the baseline is `main` `c160d86`, where `shader.rs` already calls `self.m.optimize()`. The container then goes through `IDxcOptimizer` (`-hlsl-dxilload -instcombine -simplifycfg -early-cse -gvn -adce -dxil-remove-dead-blocks -globaldce -hlsl-dxilemit`), back into a container with `IDxcAssembler`, and is signed by `IDxcValidator` (`InPlaceEdit`). **RX 9070 XT, RADV (Mesa 26.3.1), vkd3d-proton `ec20719`, cold, one program per process.** Totals are translation + optimizer + driver. The same 106 sample programs and 21 hard ones are measured on the HLSL path too. | | HLSL path | `main` direct (with `Module::optimize`) | + DXC optimizer | |---|---|---|---| | sample, 100 of 106 built | 843 s, 32.7 MB DXIL | – | **250 s, 29.8 MB** (median 1.9×) | | 22303 | 50.9 s, 893 KB | 16.3 s, 1 370 KB | **5.5 s, 801 KB** | | 23097 (and 6 more like it) | over 26 GB in ACO, never built | – | **9–12 s, about 1 GB, 1 021 KB** | **Against `main`'s direct path alone, on the 77 programs measured both ways:** | | `main` direct (`Module::optimize`) | + DXC passes | |---|---|---| | DXIL, total | 28.5 MB | **18.2 MB (−36 %)**; per program 0.48–1.22×, median 0.87× | | time, total | 338 s | **149 s (2.3×)** | | the 23 programs over 2 s | 13–28 s each (the ~1.3–1.7 MB ones) | **3–9 s each** (2.5–3.2×) | | the 54 programs under 2 s | 11.4 s | 15.9 s (the optimizer's 0.05–0.1 s is not recovered) | So `instcombine` / `gvn` / `simplifycfg` still find a lot on top of the in-tree passes, mostly on the big programs. Those are the passes I would look at first. Running them only above a size threshold (about 64 KB of DXIL) would avoid the small-program cost. - **`Flags must match usage`:** 4 of 106 sample programs (22253, 23062, 23076, 23085), 22617, and 8 programs in a title run. The validator refuses them after the passes, presumably because the shader flags are not recomputed. Those keep the unoptimized container. - **Not for the giants:** 22616 / 22617 (14.8 MB direct) take about 60 s in the optimizer. 22616 then crashes in vkd3d-proton (without @⁠0naku's dxil-spirv patches), and 22617 is refused as above. 22618 and 23213 do not finish in 300 s. - 22562 hangs in the driver (0 % CPU, 300 s), with and without the passes. <details><summary>patch against <code>c160d86</code> (opt-in, <code>XCL_DIRECT_OPT</code>, 62 lines)</summary> ```diff diff --git a/crates/xcl/src/gpu/dxil/validate.rs b/crates/xcl/src/gpu/dxil/validate.rs index 7ba10b2..caae8a1 100644 --- a/crates/xcl/src/gpu/dxil/validate.rs +++ b/crates/xcl/src/gpu/dxil/validate.rs @@ -167,3 +167,55 @@ mod tests { } } } + +/// The DXC optimizer's pass names (`IDxcOptimizer`). +pub fn optimizer_passes() -> Result<Vec<String>, String> { + let o: IDxcOptimizer = instance(compiler_create()?, &CLSID_DxcOptimizer)?; + let mut out = Vec::new(); + unsafe { + let n = o.GetAvailablePassCount().map_err(|e| format!("{e}"))?; + for i in 0..n { + let p = o.GetAvailablePass(i).map_err(|e| format!("{e}"))?; + let name = p.GetOptionName().map_err(|e| format!("{e}"))?; + out.push(name.to_string().unwrap_or_default()); + } + } + Ok(out) +} + +/// `container` through `IDxcOptimizer` with `passes` +/// (e.g. `-instcombine`), then back into a container (`IDxcAssembler`) signed by the +/// validator (`DxcValidatorFlags_InPlaceEdit`). `Err` says which step refused it. +pub fn optimize(container: &[u8], passes: &[&str]) -> Result<Vec<u8>, String> { + header_fits(container)?; + let create = compiler_create()?; + let o: IDxcOptimizer = instance(create, &CLSID_DxcOptimizer)?; + let input = blob(container)?; + let wide: Vec<Vec<u16>> = passes.iter().map(|p| p.encode_utf16().chain([0]).collect()).collect(); + let ptrs: Vec<windows::core::PCWSTR> = wide.iter().map(|w| windows::core::PCWSTR(w.as_ptr())).collect(); + let mut module: Option<IDxcBlob> = None; + let mut text: Option<IDxcBlobEncoding> = None; + unsafe { o.RunOptimizer(&input, &ptrs, &mut module, Some(&mut text)) }.map_err(|e| format!("RunOptimizer: {e}"))?; + let module = module.ok_or("RunOptimizer: no module")?; + let a: IDxcAssembler = instance(create, &CLSID_DxcAssembler)?; + let r = unsafe { a.AssembleToContainer(&module) }.map_err(|e| format!("AssembleToContainer: {e}"))?; + unsafe { + let st = r.GetStatus().map_err(|e| format!("{e}"))?; + if st.is_err() { + return Err(format!("assemble: {}", error_text(r.GetErrorBuffer()))); + } + } + let out = unsafe { r.GetResult() }.map_err(|e| format!("GetResult: {e}"))?; + let bytes = unsafe { std::slice::from_raw_parts(out.GetBufferPointer() as *const u8, out.GetBufferSize()).to_vec() }; + // sign: the validator writes the digest into the container it checked + let v: IDxcValidator = instance(create, &CLSID_DxcValidator)?; + let b = blob(&bytes)?; + unsafe { + let r = v.Validate(&b, DxcValidatorFlags_InPlaceEdit).map_err(|e| format!("Validate: {e}"))?; + let st = r.GetStatus().map_err(|e| format!("{e}"))?; + if st.is_err() { + return Err(format!("validate: {}", error_text(r.GetErrorBuffer()).lines().next().unwrap_or(""))); + } + Ok(std::slice::from_raw_parts(b.GetBufferPointer() as *const u8, b.GetBufferSize()).to_vec()) + } +} diff --git a/crates/xcl/src/gpu/recomp/pso.rs b/crates/xcl/src/gpu/recomp/pso.rs index 46e237b..f541d0b 100644 --- a/crates/xcl/src/gpu/recomp/pso.rs +++ b/crates/xcl/src/gpu/recomp/pso.rs @@ -346,8 +346,17 @@ fn compile_console_shader(blob: &[u8], stage: Stage, sampler_base: u32, windows: // for what it cannot translate yet if stage == Stage::Compute && crate::gpu::dxil::kernel::enabled() { match direct_compute(blob, sampler_base, windows, split_wave64) { - Ok(c) => { + Ok(mut c) => { crate::gpu::dxil::coverage::record_translated("CS"); + // `XCL_DIRECT_OPT="-pass …"` (opt-in): the container through DXC's own optimizer, + // re-assembled and signed; kept unoptimized when any step refuses it + if let Ok(passes) = std::env::var("XCL_DIRECT_OPT") { + let list: Vec<&str> = passes.split_whitespace().collect(); + match crate::gpu::dxil::validate::optimize(&c.dxil, &list) { + Ok(d) => c.dxil = d, + Err(e) => crate::xlog_info!("[SHADER] direct DXIL optimizer refused ({}): unoptimized", e.lines().next().unwrap_or("")), + } + } return Ok(c); } Err(e) => direct_fallback("CS", &e), ``` </details> **Tested:** release cross-build for `x86_64-pc-windows-msvc` from Linux, runs under Wine + vkd3d-proton on the hardware above. **Not tested:** the test suite (Linux only here), Windows / NVIDIA, other pass lists. **AI use:** Claude Code (Claude Opus 5.5) wrote the patch, ran the measurements on my machine and wrote this.
Author
Owner

@⁠Itsmetibo on GitHub · 2026-11-24 19:50 UTC · original

@⁠bmjask a small change to main code in gpu/dxil/module.rs, which gefydev is pulling into direct-on-1426 from #1269 (branch: https://github.com/Itsmetibo/xcl/tree/recomp/batch-phi-replace, commit 4c3fe1e):

  • new Module::replace_uses(&HashMap<Value, Value>): replaces every old → new of the map in one pass over the instructions and metadata, following chains (a → b, b → c: a use of a becomes c), the same as replace_all_uses called once per entry in order;
  • replace_all_uses(old, new) stays, with the same behaviour, and now calls replace_uses with a one-entry map.

Why: the per-lane lowering called replace_all_uses once per trivial phi, and each call walks the whole module, so the time was about quadratic in program size. On an RTX 3060 Ti machine (i5-11600), the CS + MS per-lane survey did not finish in 10 minutes before and takes 177 s with the batched call. A new test in dxil/tests.rs (batched_replacements_match_one_at_a_time) checks that a batched map with a chain gives the same container as the one-at-a-time calls.

AI use: Claude Code (Claude Opus 5.5) wrote this change and this comment.

**@⁠Itsmetibo** on GitHub · 2026-11-24 19:50 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7142670390) @⁠bmjask a small change to `main` code in `gpu/dxil/module.rs`, which gefydev is pulling into `direct-on-1426` from #1269 (branch: https://github.com/Itsmetibo/xcl/tree/recomp/batch-phi-replace, commit `4c3fe1e`): - new `Module::replace_uses(&HashMap<Value, Value>)`: replaces every `old → new` of the map in one pass over the instructions and metadata, following chains (`a → b`, `b → c`: a use of `a` becomes `c`), the same as `replace_all_uses` called once per entry in order; - `replace_all_uses(old, new)` stays, with the same behaviour, and now calls `replace_uses` with a one-entry map. Why: the per-lane lowering called `replace_all_uses` once per trivial phi, and each call walks the whole module, so the time was about quadratic in program size. On an RTX 3060 Ti machine (i5-11600), the CS + MS per-lane survey did not finish in 10 minutes before and takes 177 s with the batched call. A new test in `dxil/tests.rs` (`batched_replacements_match_one_at_a_time`) checks that a batched map with a chain gives the same container as the one-at-a-time calls. AI use: Claude Code (Claude Opus 5.5) wrote this change and this comment.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-24 20:04 UTC · original

Pinpoint follow-up: split the two crashing tests into one-op-per-kernel probes (19 probes, same commit/stack as my comment above, each run solo). Crashes reproduce with a single intrinsic, no other ops in the kernel:

  • uaddc alone: crash (exit status 3)
  • usubb alone: crash
  • udiv_rem alone: crash

All 16 others ok solo: bfrev, all four bit_count variants, imax/imin/umax/umin, imad/umad, ibfe/ubfe/bfi, umul_wide, imul_wide.

Not a divide-by-zero artifact: the second input vector is rotate_left(7) ^ 0x9e37_79b9, never zero.

So the crashing set is exactly: add-with-carry, sub-with-borrow, and unsigned div/rem. integer_ops_match_cpu crashes because it contains udiv_rem; uaddc_and_usubb_match_cpu because of the carry/borrow pair. Wide multiplies are fine.

That is a much smaller hunting ground: three lowering paths (UAddc, USubb, udiv_rem) emit something the downstream compile path on this card dies on instead of returning an error. Each is now a ~10-line repro kernel.

(These are local probe tests; happy to PR them as a permanent one-op-per-kernel suite if useful.)

AI use: Hermes agent (local Qwen-class) wrote the probes, ran them, drafted this; I checked it before posting.

**@⁠SlopTart** on GitHub · 2026-11-24 20:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7142993955) Pinpoint follow-up: split the two crashing tests into one-op-per-kernel probes (19 probes, same commit/stack as my comment above, each run solo). Crashes reproduce with a single intrinsic, no other ops in the kernel: - `uaddc` alone: crash (exit status 3) - `usubb` alone: crash - `udiv_rem` alone: crash All 16 others ok solo: `bfrev`, all four `bit_count` variants, `imax/imin/umax/umin`, `imad/umad`, `ibfe/ubfe/bfi`, `umul_wide`, `imul_wide`. Not a divide-by-zero artifact: the second input vector is `rotate_left(7) ^ 0x9e37_79b9`, never zero. So the crashing set is exactly: add-with-carry, sub-with-borrow, and unsigned div/rem. `integer_ops_match_cpu` crashes because it contains `udiv_rem`; `uaddc_and_usubb_match_cpu` because of the carry/borrow pair. Wide multiplies are fine. That is a much smaller hunting ground: three lowering paths (`UAddc`, `USubb`, `udiv_rem`) emit something the downstream compile path on this card dies on instead of returning an error. Each is now a ~10-line repro kernel. (These are local probe tests; happy to PR them as a permanent one-op-per-kernel suite if useful.) AI use: Hermes agent (local Qwen-class) wrote the probes, ran them, drafted this; I checked it before posting.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-24 20:34 UTC · original

@⁠bmjask a heads-up, as gefydev asked on #1269: #1742 changes gpu/dxil (prelude.rs, lower_valu.rs, lower_wide.rs). In the default rounding mode, v_cvt_f16_f32, v_mul_f16 and v_pk_mul_f16 now round to nearest-even, as the HLSL path does since #166. Before, they went through dx.op.legacyF32ToF16, which rounds toward zero. A new Lw::to_f16_rounded does this, and programs that set MODE[3:2] keep the dynamic path. TRANSLATOR_VERSION goes from 5 to 6. The GPU test runs in wave32, split wave64 and native wave64 (RX 7800 XT). It is your code, so a look would be welcome.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠oni-swr.

**@⁠oni-swr** on GitHub · 2026-11-24 20:34 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7143762416) @⁠bmjask a heads-up, as gefydev asked on #1269: #1742 changes `gpu/dxil` (`prelude.rs`, `lower_valu.rs`, `lower_wide.rs`). In the default rounding mode, `v_cvt_f16_f32`, `v_mul_f16` and `v_pk_mul_f16` now round to nearest-even, as the HLSL path does since #166. Before, they went through `dx.op.legacyF32ToF16`, which rounds toward zero. A new `Lw::to_f16_rounded` does this, and programs that set `MODE[3:2]` keep the dynamic path. `TRANSLATOR_VERSION` goes from 5 to 6. The GPU test runs in wave32, split wave64 and native wave64 (RX 7800 XT). It is your code, so a look would be welcome. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠oni-swr.
Author
Owner

@⁠Itsmetibo on GitHub · 2026-11-24 20:38 UTC · original

@⁠bmjask Windows / NVIDIA data for Fran-co-F's DXC-optimizer patch (#1426), the two "Not tested" items. Machine: RTX 3060 Ti 8 GB, i5-11600, Windows 11, NVIDIA driver, release build of main 6c89285 + the patch as posted.

Tests. cargo test --release --workspace --no-fail-fast -- --test-threads=4 with XCL_DIRECT_OPT set: 863 passed, 0 failed, 42 ignored. gpu_compute_e2e with XCL_DIRECT_DXIL=1: 3 passed, 1 failed, the same with and without the optimizer (offline_compute_pipeline_is_reused_by_a_second_process, the failure already reported on main). No optimizer refusals in the tests.

Driver time. One fresh process per program and setting (xcl shaders --precompile --pipelines, XCL_DIRECT_DXIL=1, XCL's caches off, a fresh XCL_DXIL_CACHE), timing console_to_dxil_in (translate, plus the DXC passes when on) and CreateComputePipelineState. NVIDIA's own driver cache can't be turned off here, so each container is timed on its first build only (a second build of the same DXIL takes ~11 ms). This GPU is wave32-only, so the programs go through the split wave64 form with 4 heap windows. One run per program and setting, with the on/off order alternating, so differences of a few percent are within noise.

program DXIL off → opt translate ms off → opt driver s off → opt driver change
22303 1 497 476 → 1 121 292 435 → 3 025 74.7 → 82.5 +10 %
23097 1 873 304 → 1 414 444 433 → 3 266 104.7 → 106.7 +2 %
23105 1 704 472 → 1 276 620 391 → 2 875 95.0 → 91.0 −4 %
23106 1 799 312 → 1 362 404 417 → 3 332 111.1 → 103.8 −7 %
23133 1 791 244 → 1 349 596 451 → 3 287 106.7 → 103.0 −3 %
23138 1 584 212 → 1 196 244 496 → 3 605 102.4 → 103.1 +1 %
23153 1 820 204 → 1 374 052 427 → 3 734 109.5 → 124.0 +13 %
23159 1 745 360 → 1 319 168 506 → 3 455 110.1 → 110.5 0 %
22210 1 629 620 → 1 251 908 569 → 3 731 93.7 → 96.6 +3 %
22608 272 868 → 210 032 54 → 511 5.81 → 6.12 +5 %
22253 286 376 → 226 456 78 → 550 4.30 → 4.59 +7 %
22290 546 696 → 442 740 122 → 875 7.53 → 7.55 0 %
23089 423 036 → 323 612 187 → 980 8.70 → 10.19 +17 %
22230 230 184 → 210 312 46 → 483 3.19 → 3.16 −1 %
22171 59 528 → 51 480 11 → 71 0.244 → 0.232
22270 73 808 → 70 268 12 → 125 0.403 → 0.760
22200 8 604 → 8 848 3 → 13 0.046 → 0.045
23062 19 604 → 17 736 4 → 29 0.103 → 0.098
23076 19 616 → 17 760 5 → 28 0.113 → 0.111
23085 23 712 → 21 544 6 → 32 0.172 → 0.145

Summary:

  • The 9 large programs (1.5–1.9 MB): the DXIL is 23–25 % smaller, but the driver total goes from 907.9 s to 921.2 s (+1.5 %), and the DXC passes add about 26 s of translation in total (≈3 s each). On this driver the smaller container doesn't build faster; Fran-co-F's 16.3 s → 5.5 s on RADV doesn't carry over to NVIDIA.
  • The 5 medium programs (210–550 KB): driver 29.5 s → 31.6 s, plus 0.4–0.8 s of passes each.
  • The 6 small programs: under a second either way, mostly noise; the passes add 10–110 ms each.
  • Flags must match usage: 0 refusals in the 40 runs (optref counted from the "direct DXIL optimizer refused" log line).

So on Windows / NVIDIA, this pass list costs translation time without lowering driver time. I didn't test other pass lists.

AI use: Claude Code (Claude Opus 5.5) ran these measurements on this machine and wrote this comment.

**@⁠Itsmetibo** on GitHub · 2026-11-24 20:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7143866180) @⁠bmjask Windows / NVIDIA data for Fran-co-F's DXC-optimizer patch (https://git.gtahub.st/github/xcl-dev--xcl/pulls/1426), the two "Not tested" items. Machine: RTX 3060 Ti 8 GB, i5-11600, Windows 11, NVIDIA driver, release build of `main` `6c89285` + the patch as posted. **Tests.** `cargo test --release --workspace --no-fail-fast -- --test-threads=4` with `XCL_DIRECT_OPT` set: 863 passed, 0 failed, 42 ignored. `gpu_compute_e2e` with `XCL_DIRECT_DXIL=1`: 3 passed, 1 failed, the same with and without the optimizer (`offline_compute_pipeline_is_reused_by_a_second_process`, the failure already reported on `main`). No optimizer refusals in the tests. **Driver time.** One fresh process per program and setting (`xcl shaders --precompile --pipelines`, `XCL_DIRECT_DXIL=1`, XCL's caches off, a fresh `XCL_DXIL_CACHE`), timing `console_to_dxil_in` (translate, plus the DXC passes when on) and `CreateComputePipelineState`. NVIDIA's own driver cache can't be turned off here, so each container is timed on its first build only (a second build of the same DXIL takes ~11 ms). This GPU is wave32-only, so the programs go through the split wave64 form with 4 heap windows. One run per program and setting, with the on/off order alternating, so differences of a few percent are within noise. | program | DXIL off → opt | translate ms off → opt | driver s off → opt | driver change | |---|---|---|---|---| | 22303 | 1 497 476 → 1 121 292 | 435 → 3 025 | 74.7 → 82.5 | +10 % | | 23097 | 1 873 304 → 1 414 444 | 433 → 3 266 | 104.7 → 106.7 | +2 % | | 23105 | 1 704 472 → 1 276 620 | 391 → 2 875 | 95.0 → 91.0 | −4 % | | 23106 | 1 799 312 → 1 362 404 | 417 → 3 332 | 111.1 → 103.8 | −7 % | | 23133 | 1 791 244 → 1 349 596 | 451 → 3 287 | 106.7 → 103.0 | −3 % | | 23138 | 1 584 212 → 1 196 244 | 496 → 3 605 | 102.4 → 103.1 | +1 % | | 23153 | 1 820 204 → 1 374 052 | 427 → 3 734 | 109.5 → 124.0 | +13 % | | 23159 | 1 745 360 → 1 319 168 | 506 → 3 455 | 110.1 → 110.5 | 0 % | | 22210 | 1 629 620 → 1 251 908 | 569 → 3 731 | 93.7 → 96.6 | +3 % | | 22608 | 272 868 → 210 032 | 54 → 511 | 5.81 → 6.12 | +5 % | | 22253 | 286 376 → 226 456 | 78 → 550 | 4.30 → 4.59 | +7 % | | 22290 | 546 696 → 442 740 | 122 → 875 | 7.53 → 7.55 | 0 % | | 23089 | 423 036 → 323 612 | 187 → 980 | 8.70 → 10.19 | +17 % | | 22230 | 230 184 → 210 312 | 46 → 483 | 3.19 → 3.16 | −1 % | | 22171 | 59 528 → 51 480 | 11 → 71 | 0.244 → 0.232 | | | 22270 | 73 808 → 70 268 | 12 → 125 | 0.403 → 0.760 | | | 22200 | 8 604 → 8 848 | 3 → 13 | 0.046 → 0.045 | | | 23062 | 19 604 → 17 736 | 4 → 29 | 0.103 → 0.098 | | | 23076 | 19 616 → 17 760 | 5 → 28 | 0.113 → 0.111 | | | 23085 | 23 712 → 21 544 | 6 → 32 | 0.172 → 0.145 | | Summary: - **The 9 large programs (1.5–1.9 MB):** the DXIL is 23–25 % smaller, but the driver total goes from 907.9 s to 921.2 s (+1.5 %), and the DXC passes add about 26 s of translation in total (≈3 s each). On this driver the smaller container doesn't build faster; Fran-co-F's 16.3 s → 5.5 s on RADV doesn't carry over to NVIDIA. - **The 5 medium programs (210–550 KB):** driver 29.5 s → 31.6 s, plus 0.4–0.8 s of passes each. - **The 6 small programs:** under a second either way, mostly noise; the passes add 10–110 ms each. - **`Flags must match usage`:** 0 refusals in the 40 runs (`optref` counted from the "direct DXIL optimizer refused" log line). So on Windows / NVIDIA, this pass list costs translation time without lowering driver time. I didn't test other pass lists. AI use: Claude Code (Claude Opus 5.5) ran these measurements on this machine and wrote this comment.
Author
Owner

@⁠cansolele on GitHub · 2026-11-24 20:45 UTC · original

@⁠bmjask, following @⁠gefydev's suggestion in #1269, I've opened draft PR #1788 to defer cold direct-DXIL compute translation during cached-only async PSO probes.

Synthetic GPU regression tests passed on an RTX 5060 Ti. The required paired retail-title smoke runs are still pending.

#1788

AI use: Codex (GPT-6.2 Sol) for development, analysis, and testing.

**@⁠cansolele** on GitHub · 2026-11-24 20:45 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7144014781) @⁠bmjask, following @⁠gefydev's suggestion in #1269, I've opened draft PR #1788 to defer cold direct-DXIL compute translation during cached-only async PSO probes. Synthetic GPU regression tests passed on an RTX 5060 Ti. The required paired retail-title smoke runs are still pending. https://git.gtahub.st/github/xcl-dev--xcl/pulls/1788 AI use: Codex (GPT-6.2 Sol) for development, analysis, and testing.
Author
Owner

@⁠Gevroska on GitHub · 2026-11-24 20:46 UTC · original

I compared the default shader path with XCL_DIRECT_DXIL=all on an RTX 3080 under Windows, using clean merge commit c160d86. I ran the same first-run form sequence once per configuration, with matching cache conditions. Both runs accepted Confirm, reached a black screen during world loading, and exited with 0xc0000005 at the same guest offset (+0x23cf683). Neither reached gameplay.

Observation Default XCL_DIRECT_DXIL=all
Time from last nonzero present bin to guest fault 29.3 s 28.5 s
Reported device removals 0 0

The all run recorded 119 compute, 31 pixel, and 23 vertex shader translations through the direct backend, with zero recorded HLSL fallback attempts in those stages. Those counts confirm that direct translation was exercised. With one run per configuration, my conclusion is limited to this revision and setup: the same world-loading fault occurred in both runs. Its cause remains open.

I used Codex with GPT-6.2 Sol to run the comparison and prepare the report. A separate GPT-6.2 Sol agent independently checked the saved observations, input sequences, and log summaries. GPT-6.1 Terra checked for overlap with existing upstream reports.

**@⁠Gevroska** on GitHub · 2026-11-24 20:46 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7144044943) I compared the default shader path with `XCL_DIRECT_DXIL=all` on an RTX 3080 under Windows, using clean merge commit `c160d86`. I ran the same first-run form sequence once per configuration, with matching cache conditions. Both runs accepted Confirm, reached a black screen during world loading, and exited with `0xc0000005` at the same guest offset (`+0x23cf683`). Neither reached gameplay. | Observation | Default | `XCL_DIRECT_DXIL=all` | |---|---:|---:| | Time from last nonzero present bin to guest fault | 29.3 s | 28.5 s | | Reported device removals | 0 | 0 | The `all` run recorded 119 compute, 31 pixel, and 23 vertex shader translations through the direct backend, with zero recorded HLSL fallback attempts in those stages. Those counts confirm that direct translation was exercised. With one run per configuration, my conclusion is limited to this revision and setup: the same world-loading fault occurred in both runs. Its cause remains open. I used Codex with GPT-6.2 Sol to run the comparison and prepare the report. A separate GPT-6.2 Sol agent independently checked the saved observations, input sequences, and log summaries. GPT-6.1 Terra checked for overlap with existing upstream reports.
Author
Owner

@⁠SlopTart on GitHub · 2026-11-24 21:00 UTC · original

Following up on my comments here: opened #1807 with the probe suite as real tests (one-op-per-kernel section in ops_tests.rs, reusing the existing helpers, +157 lines, no deletions). Fresh run on the same stack confirms 10 probes pass and exactly uaddc, usubb, udiv_rem abort, every run.

If the CI NVIDIA card runs them: passing there localizes the fault to the AMD path; aborting there means it is reproducible without AMD hardware. Either way it stops being a comment-thread claim and becomes a standing test either fixed or triaged.

AI use: Hermes agent (local Qwen-class) wrote and ran the probes; I checked the diff and logs before opening.

**@⁠SlopTart** on GitHub · 2026-11-24 21:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7144342922) Following up on my comments here: opened #1807 with the probe suite as real tests (one-op-per-kernel section in `ops_tests.rs`, reusing the existing helpers, +157 lines, no deletions). Fresh run on the same stack confirms 10 probes pass and exactly `uaddc`, `usubb`, `udiv_rem` abort, every run. If the CI NVIDIA card runs them: passing there localizes the fault to the AMD path; aborting there means it is reproducible without AMD hardware. Either way it stops being a comment-thread claim and becomes a standing test either fixed or triaged. AI use: Hermes agent (local Qwen-class) wrote and ran the probes; I checked the diff and logs before opening.
Author
Owner

@⁠tycosnh on GitHub · 2026-11-24 21:05 UTC · original

#1426 on an RTX 4090 (621.24): the three giant compute programs, and a title run

Head bc93a3a, release, Ryzen 7 9800X3D, 31 GB RAM, Windows 11 Pro 26300, DXC 1.8.2502.11. Retail 1.0.2.1. Each program alone in a folder, xcl shaders <folder> --precompile --only cs and then --pipelines, each backend into its own empty XCL_DXIL_CACHE, XCL_PSO_DISK_CACHE=0, 900 s cap per step.

program HLSL path: translate + DXC / DXIL / driver XCL_DIRECT_DXIL=1: translate / DXIL / driver
billboard_nobump:CS_RaytracingResolve_c6735e5f 9.5 s / 1.09 MB / 35.8 s 3.1 s / 35.7 MB / 29.1 s
indirect_diffuse_lighting:CS_ScreenProbes_ActivateRays_d60186e6 DXC not done in 900 s (60 GB commit) 13.6 s / 138.5 MB / 356 s
indirect_diffuse_lighting:CS_ScreenProbes_ActivateProbes_9083c094 99 s / 29.75 MB / driver not done in 900 s 6.5 s / 81.8 MB / driver not done in 900 s

So the direct path gets ActivateRays built where DXC never finishes, and is a bit faster on RaytracingResolve, but its containers are 33–130× the size of DXC's, and ActivateProbes still does not finish in NVIDIA's compiler either way.

Title run (5 min, XCL_PSO_WAIT_MS=50, A pressed every 5 s from 55 s, XCL_NETWORK=0), same build with and without XCL_DIRECT_DXIL=1:

  • Direct: every compute program went through the direct path (no direct DXIL: … – HLSL path line). Reached the world load (6 922 dispatches in the 2 s at 116 s); 269 compute pipelines built cold, the longest 31.0 s for a 33.9 MB container. At 146.6 s the title hit a breakpoint: 0x80000003 in game_scarlett_master.exe+0x3bf4.
  • HLSL path: reached the same point (7 225 dispatches at 112 s) and ended on the usual +0x2215c35 GPU watchdog at 172 s. Its driver cache was warm (325 of 506 pipelines from blobs), so the pipeline times are not comparable.

The +0x3bf4 breakpoint has not shown up in our HLSL-path runs. I have the logs if a trace of the programs used before it helps.

AI use: Claude Code (Claude Opus 5.5) ran these on my machine and wrote this report.

**@⁠tycosnh** on GitHub · 2026-11-24 21:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7144471349) **#1426 on an RTX 4090 (621.24): the three giant compute programs, and a title run** Head bc93a3a, release, Ryzen 7 9800X3D, 31 GB RAM, Windows 11 Pro 26300, DXC 1.8.2502.11. Retail 1.0.2.1. Each program alone in a folder, `xcl shaders <folder> --precompile --only cs` and then `--pipelines`, each backend into its own empty `XCL_DXIL_CACHE`, `XCL_PSO_DISK_CACHE=0`, 900 s cap per step. | program | HLSL path: translate + DXC / DXIL / driver | `XCL_DIRECT_DXIL=1`: translate / DXIL / driver | |---|---|---| | `billboard_nobump:CS_RaytracingResolve_c6735e5f` | 9.5 s / 1.09 MB / 35.8 s | 3.1 s / 35.7 MB / 29.1 s | | `indirect_diffuse_lighting:CS_ScreenProbes_ActivateRays_d60186e6` | DXC not done in 900 s (60 GB commit) | 13.6 s / 138.5 MB / 356 s | | `indirect_diffuse_lighting:CS_ScreenProbes_ActivateProbes_9083c094` | 99 s / 29.75 MB / driver not done in 900 s | 6.5 s / 81.8 MB / driver not done in 900 s | So the direct path gets ActivateRays built where DXC never finishes, and is a bit faster on RaytracingResolve, but its containers are 33–130× the size of DXC's, and ActivateProbes still does not finish in NVIDIA's compiler either way. **Title run** (5 min, `XCL_PSO_WAIT_MS=50`, A pressed every 5 s from 55 s, `XCL_NETWORK=0`), same build with and without `XCL_DIRECT_DXIL=1`: - **Direct:** every compute program went through the direct path (no `direct DXIL: … – HLSL path` line). Reached the world load (6 922 dispatches in the 2 s at 116 s); 269 compute pipelines built cold, the longest 31.0 s for a 33.9 MB container. At 146.6 s the title hit a breakpoint: `0x80000003 in game_scarlett_master.exe+0x3bf4`. - **HLSL path:** reached the same point (7 225 dispatches at 112 s) and ended on the usual `+0x2215c35` GPU watchdog at 172 s. Its driver cache was warm (325 of 506 pipelines from blobs), so the pipeline times are not comparable. The `+0x3bf4` breakpoint has not shown up in our HLSL-path runs. I have the logs if a trace of the programs used before it helps. AI use: Claude Code (Claude Opus 5.5) ran these on my machine and wrote this report.
Author
Owner

@⁠bmjask on GitHub · 2026-11-24 22:06 UTC · original

Thanks for the post-merge reports and heads-ups. Short answers per thread:

  • @⁠Sr-0w (RX 7800 XT title run): thanks for the three-revision table. As you say, the watchdog now trips on compiles piling up on the title's threads, not on any single build. That's where pipelines get built, so it's outside this PR. #1788 (deferring cold direct compute in cached-only probes) and #1809 address part of it. Heap windows in the direct form: the driver-time table (e.g. 961 KB/23.1 s → 559 KB/6.1 s) makes a good case. A PR against main is welcome. Out-of-range w mapping to window 0 matches the switch form.
  • @⁠HKEY-Funk-Machine: thanks for confirming the irreducible-CFG fix on the RX 9070. The OOM on 56c0cd3b82a00c6e (14.8 MB) is still open. @⁠raylitebull reports the same program OOMing amdxc64.dll on #1809.
  • @⁠SlopTart: thanks for narrowing the RADV aborts to uaddc, usubb and udiv_rem alone, and for turning the probes into #1807. I haven't found the cause yet. Whether they also abort on NVIDIA will tell us whether it's our lowering or the RADV/vkd3d path.
  • @⁠RandomGithub12309 (#1699), @⁠oni-swr (#1742), @⁠cansolele (#1788), @⁠Itsmetibo (replace_uses): thanks for the heads-ups. They'll be reviewed as their own PRs. @⁠oni-swr: since #1679 also bumps TRANSLATOR_VERSION (now 8 with the pending MSAA fix), the version numbers will need reconciling at merge.
  • @⁠Fran-co-F / @⁠Itsmetibo (DXC optimizer): thanks for both sides of the measurement. On RADV it's 2.3× less total driver time. On the RTX 3060 Ti it's about +10 % driver time on 22303 and much slower translation, so it isn't a clear win everywhere. It could be worth an opt-in, but not a default from this data.
  • @⁠tycosnh: thanks for the RTX 4090 numbers on the three giant programs. Containers 33–130× DXC's size are the main weakness, and the size work since bc93a3a (#1748 among others) is aimed at that.
  • @⁠erickbobd, @⁠Daydream3r, @⁠Gevroska: thanks for the clean-main checks. @⁠Gevroska, the same +0x23cf683 fault on both paths points away from the direct backend, as you concluded.

AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠bmjask.

**@⁠bmjask** on GitHub · 2026-11-24 22:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7145807600) Thanks for the post-merge reports and heads-ups. Short answers per thread: - **@⁠Sr-0w (RX 7800 XT title run):** thanks for the three-revision table. As you say, the watchdog now trips on compiles piling up on the title's threads, not on any single build. That's where pipelines get built, so it's outside this PR. #1788 (deferring cold direct compute in cached-only probes) and #1809 address part of it. **Heap windows in the direct form:** the driver-time table (e.g. 961 KB/23.1 s → 559 KB/6.1 s) makes a good case. A PR against `main` is welcome. Out-of-range `w` mapping to window 0 matches the switch form. - **@⁠HKEY-Funk-Machine:** thanks for confirming the irreducible-CFG fix on the RX 9070. The OOM on `56c0cd3b82a00c6e` (14.8 MB) is still open. @⁠raylitebull reports the same program OOMing `amdxc64.dll` on #1809. - **@⁠SlopTart:** thanks for narrowing the RADV aborts to `uaddc`, `usubb` and `udiv_rem` alone, and for turning the probes into #1807. I haven't found the cause yet. Whether they also abort on NVIDIA will tell us whether it's our lowering or the RADV/vkd3d path. - **@⁠RandomGithub12309 (#1699), @⁠oni-swr (#1742), @⁠cansolele (#1788), @⁠Itsmetibo (`replace_uses`):** thanks for the heads-ups. They'll be reviewed as their own PRs. @⁠oni-swr: since #1679 also bumps `TRANSLATOR_VERSION` (now 8 with the pending MSAA fix), the version numbers will need reconciling at merge. - **@⁠Fran-co-F / @⁠Itsmetibo (DXC optimizer):** thanks for both sides of the measurement. On RADV it's 2.3× less total driver time. On the RTX 3060 Ti it's about +10 % driver time on 22303 and much slower translation, so it isn't a clear win everywhere. It could be worth an opt-in, but not a default from this data. - **@⁠tycosnh:** thanks for the RTX 4090 numbers on the three giant programs. Containers 33–130× DXC's size are the main weakness, and the size work since `bc93a3a` (#1748 among others) is aimed at that. - **@⁠erickbobd, @⁠Daydream3r, @⁠Gevroska:** thanks for the clean-main checks. @⁠Gevroska, the same `+0x23cf683` fault on both paths points away from the direct backend, as you concluded. AI use: Claude Code (Claude Opus 5.5) wrote this comment for @⁠bmjask.
Author
Owner

@⁠nineforge0 on GitHub · 2026-11-24 16:35 UTC · original · edited 2026-11-24 23:13 UTC

The complete opcode target set for this backend, in case it helps decide what to implement before discovering gaps by fallback. I decoded all 24,804 shader records in the retail shader database (shaders.rpf entry 0) (25,194 programs, 44.25M instructions) and counted every distinct GFX10.3 opcode.

Coverage: 470 distinct opcodes total. 85 cover 90% of executed instructions, 194 cover 99%, 282 cover 99.9%. 0 undecodable dwords, 0 opcodes we couldnt name. Per stage: CS 437 (81 unique to CS), MS 249 (all also in CS except exp and s_sendmsg), PS 358, VS 269, ES/GS 65. So the direct path for MS+CS needs ~437 opcodes; the 99% core is 194.

Two correctness traps worth hardcoding before they bite (both are high-frequency):

  1. v_mul_legacy_f32 is the single most-executed instruction (12.4% of all instructions, ~5.5M occurrences). It is a legacy multiply where 0 * x == 0 even when x is Inf or NaN. Translating it as a plain fmul gives wrong results on those operands — a subtle source of wrong pixels.
  2. The console keeps the non-fused GFX10.1 multiply-adds. v_mac_f32 appears in 5,091 programs (VOP2 form) and v_mad_f32 in 7,293. These must NOT be lowered to fused fma — they round the intermediate.

One ambiguity I cant resolve without hardware (you have the AMD cards, we dont): VOP3 opcode 0x140 — 24,717 occurrences in 6,058 programs. The current RDNA2 spec calls it v_fma_legacy_f32 (fused); the older GFX10.1 spec calls it v_mad_legacy_f32 (non-fused). Since the console keeps the other GFX10.1 non-fused ops, non-fused is the likely meaning, but a native wave64 probe (fma vs mad rounding on a crafted input) would settle it. If someone running the AMD native tests here can check, it would pin down 6,058 programs.

Full census + per-opcode table: https://github.com/nineforge0/forge9/blob/main/docs/rdna2_opcode_coverage.md (reproduce: forge9 isa shaders.rpf 0 --opcodes, or --opcodes --stage MS).


Analysis produced with AI assistance (Claude Opus 5.5), directed and reviewed by the account owner. Data extracted from the account owner's own copy of the executable; no game files or keys were shared.

Edit: the source is the title's shader database (shaders.rpf entry 0), not the pipeline cache (entry 1). The numbers are unchanged.

**@⁠nineforge0** on GitHub · 2026-11-24 16:35 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7137916766) · edited 2026-11-24 23:13 UTC The complete opcode target set for this backend, in case it helps decide what to implement before discovering gaps by fallback. I decoded all 24,804 shader records in the retail shader database (`shaders.rpf` entry 0) (25,194 programs, 44.25M instructions) and counted every distinct GFX10.3 opcode. **Coverage:** 470 distinct opcodes total. **85 cover 90% of executed instructions, 194 cover 99%, 282 cover 99.9%.** 0 undecodable dwords, 0 opcodes we couldnt name. Per stage: CS 437 (81 unique to CS), MS 249 (all also in CS except `exp` and `s_sendmsg`), PS 358, VS 269, ES/GS 65. So the direct path for MS+CS needs ~437 opcodes; the 99% core is 194. **Two correctness traps worth hardcoding before they bite (both are high-frequency):** 1. **`v_mul_legacy_f32` is the single most-executed instruction (12.4% of all instructions, ~5.5M occurrences).** It is a legacy multiply where `0 * x == 0` even when `x` is Inf or NaN. Translating it as a plain `fmul` gives wrong results on those operands — a subtle source of wrong pixels. 2. **The console keeps the non-fused GFX10.1 multiply-adds.** `v_mac_f32` appears in 5,091 programs (VOP2 form) and `v_mad_f32` in 7,293. These must NOT be lowered to fused `fma` — they round the intermediate. **One ambiguity I cant resolve without hardware (you have the AMD cards, we dont):** VOP3 opcode `0x140` — 24,717 occurrences in 6,058 programs. The current RDNA2 spec calls it `v_fma_legacy_f32` (fused); the older GFX10.1 spec calls it `v_mad_legacy_f32` (non-fused). Since the console keeps the other GFX10.1 non-fused ops, non-fused is the likely meaning, but a native wave64 probe (fma vs mad rounding on a crafted input) would settle it. If someone running the AMD native tests here can check, it would pin down 6,058 programs. Full census + per-opcode table: https://github.com/nineforge0/forge9/blob/main/docs/rdna2_opcode_coverage.md (reproduce: `forge9 isa shaders.rpf 0 --opcodes`, or `--opcodes --stage MS`). --- *Analysis produced with AI assistance (Claude Opus 5.5), directed and reviewed by the account owner. Data extracted from the account owner's own copy of the executable; no game files or keys were shared.* _Edit: the source is the title's shader database (`shaders.rpf` entry 0), not the pipeline cache (entry 1). The numbers are unchanged._
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 05:13 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 05:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#issuecomment-7183287227) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
Author
Owner

@⁠GonZiin on GitHub · 2026-11-24 17:46 UTC · original · reviewed

Native Windows RDNA4 recheck of 424d315372d60948b79422b1976ef8d486632b49. The direct recompiler suite passes on this head. The DXIL suite still has two GPU/CPU mismatches, plus the previously reported SDK validator crash.

Tested

  • Windows 11 Pro build 26300, Ryzen 7 7800X3D, Radeon RX 9070 XT (driver 32.0.32029.2010), Rust 1.100.0 MSVC, debug, DXC 1.8.2502.11 from SDK 10.0.26100.0. Selected the 9070 XT explicitly and set XCL_REQUIRE_GPU=wave64,mesh.
  • XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp -- --test-threads=4 reported 191 passed, 0 failed, 18 ignored and 0 GPU skips.
  • cargo test -p xcl --lib gpu::dxil -- --skip malformed_containers_are_errors --test-threads=1 --nocapture reported 81 passed, 2 failed, 2 ignored and 0 GPU skips. Both wave_ops_match_cpu and half_precision_overloads_run passed.
  • fuzz_validate_and_gpu_1, seed 722, returned res[30] = 0x1 with CPU reference 0x7fffffff. fuzz_validate_and_gpu_3, seed 1599, returned res[193] = 0x1 with CPU reference 0x0. The other two fuzz ranges passed.
  • cargo test -p xcl --lib -- --exact gpu::dxil::validate::tests::malformed_containers_are_errors --test-threads=1 independently reproduced the SDK 1.8.2502.11 process exit 0xC0000005 on this head.

Not tested

Retail titles, DXC 1.9 on this setup, and the cause of the two residual fuzz mismatches.

AI use

Codex (gpt-6.2-sol) ran the tests and drafted this review.

**@⁠GonZiin** on GitHub · 2026-11-24 17:46 UTC · [original](https://github.com/xcl-dev/xcl/pull/1426#pullrequestreview-6044445656) · **reviewed** Native Windows RDNA4 recheck of `424d315372d60948b79422b1976ef8d486632b49`. The direct recompiler suite passes on this head. The DXIL suite still has two GPU/CPU mismatches, plus the previously reported SDK validator crash. **Tested** - Windows 11 Pro build 26300, Ryzen 7 7800X3D, Radeon RX 9070 XT (driver 32.0.32029.2010), Rust 1.100.0 MSVC, debug, DXC 1.8.2502.11 from SDK 10.0.26100.0. Selected the 9070 XT explicitly and set `XCL_REQUIRE_GPU=wave64,mesh`. - `XCL_DIRECT_DXIL=1 cargo test -p xcl --lib gpu::recomp -- --test-threads=4` reported 191 passed, 0 failed, 18 ignored and 0 GPU skips. - `cargo test -p xcl --lib gpu::dxil -- --skip malformed_containers_are_errors --test-threads=1 --nocapture` reported 81 passed, 2 failed, 2 ignored and 0 GPU skips. Both `wave_ops_match_cpu` and `half_precision_overloads_run` passed. - `fuzz_validate_and_gpu_1`, seed 722, returned `res[30] = 0x1` with CPU reference `0x7fffffff`. `fuzz_validate_and_gpu_3`, seed 1599, returned `res[193] = 0x1` with CPU reference `0x0`. The other two fuzz ranges passed. - `cargo test -p xcl --lib -- --exact gpu::dxil::validate::tests::malformed_containers_are_errors --test-threads=1` independently reproduced the SDK 1.8.2502.11 process exit `0xC0000005` on this head. **Not tested** Retail titles, DXC 1.9 on this setup, and the cause of the two residual fuzz mismatches. **AI use** Codex (`gpt-6.2-sol`) ran the tests and drafted this review.
This discussion has been locked. Commenting is limited to contributors.
No description provided.