Tests: verify direct DXIL vs HLSL parity for FLAT, GLOBAL, SCRATCH ops #2143

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

@⁠HumanlyDev on GitHub · 2026-11-25 06:10 UTC · original
HumanlyDev:tests/gpu-dxil-flat-global-scratch-parity → main · +397 −0 · 1 files · 1 commits · open

Add GPU differential parity integration tests between the direct RDNA2 → DXIL translator (xcl::gpu::dxil::kernel::translate_full, validated with dxil.dll) and HLSL + DXC (xcl::gpu::recomp) for GLOBAL, FLAT, and SCRATCH memory instructions across wave32 and wave64 (split-wave64 on wave32-only GPUs). Test-only change under crates/xcl/tests/; no runtime files modified.

What is in it

  • crates/xcl/tests/gpu_dxil_flat_global_scratch_parity.rs (397 lines):
    • direct_dxil_global_load_store_subdword_d16_and_saddr_parity: GLOBAL_{LOAD,STORE}_DWORD{,X2,X3,X4} (64-bit VADDR with SADDR=0x7D, and 32-bit VADDR + SGPR SADDR with positive/negative signed 12-bit offsets), GLOBAL_{LOAD,STORE}_{BYTE,SHORT} / UBYTE / SBYTE / USHORT / SSHORT, all six D16 / D16_HI load variants preserving untouched 16-bit halves, GLOBAL_{LOAD,STORE}_DWORD_ADDTID, and divergent EXEC masking.
    • direct_dxil_global_atomics_32_and_64_parity: 17 32-bit GLOBAL_ATOMIC_* ops (SWAP, CMPSWAP, ADD, SUB, SMIN, UMIN, SMAX, UMAX, AND, OR, XOR, INC, DEC, CSUB, FMIN, FMAX, FCMPSWAP) and 16 64-bit GLOBAL_ATOMIC_*_X2 ops with GLC=1, SADDR + negative offsets, CAS hit/miss (-0.0 == +0.0), INC/DEC/CSUB wrap/clamp, positive/negative floats, and EXEC masking.
    • direct_dxil_flat_load_store_and_atomic_parity: FLAT_{LOAD,STORE}_DWORD{,X2,X3,X4}, sub-dword / D16 / D16_HI ops, 16 32-bit and 64-bit FLAT_ATOMIC_* ops with GLC=1, and divergent EXEC load/store masking.
    • direct_dxil_scratch_load_store_subdword_d16_and_exec_parity: per-lane SCRATCH_{LOAD,STORE}_DWORD{,X2,X3,X4} with both SGPR SADDR and per-lane ADDR (SADDR=0x7D) + signed 12-bit offsets, sub-dword / D16 / D16_HI ops, and EXEC masking.

Tested

  • Hardware & toolchain: NVIDIA GeForce RTX 4060 (driver 32.0.16.1088) and AMD Radeon(TM) Graphics (driver 32.0.21030.2001), AMD Ryzen 5 7600, Windows 11 Pro 10.0.26200 (build 26200), rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.8.2502.11 (Windows SDK 10.0.26100.0), debug & release.
  • cargo test -p xcl --test gpu_dxil_flat_global_scratch_parity -- --nocapture (RTX 4060, debug): 4 passed, 0 failed, 0 ignored (0 SKIPPED; each test ran wave32 + split-wave64 on both Direct DXIL and HLSL+DXC).
  • XCL_ADAPTER=Radeon cargo test -p xcl --test gpu_dxil_flat_global_scratch_parity -- --nocapture (AMD Radeon(TM) Graphics, debug): 4 passed, 0 failed, 0 ignored (0 SKIPPED).
  • XCL_D3D12_DEBUG=1 cargo test -p xcl --test gpu_dxil_flat_global_scratch_parity -- --test-threads=1 --nocapture (RTX 4060, debug): 4 passed, 0 failed, 0 ignored.
  • XCL_ADAPTER=warp cargo test -p xcl --test gpu_dxil_flat_global_scratch_parity -- --nocapture (WARP, debug): 4 passed, 0 failed, 0 ignored (4 SKIPPED: no wave64).
  • cargo test --release -p xcl --test gpu_dxil_flat_global_scratch_parity -- --nocapture (RTX 4060, release): 4 passed, 0 failed, 0 ignored (0 SKIPPED).
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4, RTX 4060, debug): 1158 passed, 0 failed, 46 ignored across 22 test targets (25 SKIPPED GPU checks: 20 no wave64, 3 per-lane form #1426 refusals, 1 no heap windows, 1 cannot disable the driver cache (Windows Developer Mode is required)).

Regression run

  • Not needed: test-only change under crates/xcl/tests/ (no runtime files under crates/xcl/src/ modified).

Not tested

  • Retail game titles (scripts/smoke.ps1) and XCL_SAMPLE_* tests (no retail game files or sample paths on this machine).
  • Discrete AMD RDNA3/RDNA4 GPUs, Linux / Wine, and XCL_HEAP_WINDOWS=1 / multi-window UMA arenas.

AI use

  • Antigravity (Google DeepMind; Gemini 4): researched lower_mem.rs, emit.rs, rdna2_spec.rs, and runner.rs, wrote crates/xcl/tests/gpu_dxil_flat_global_scratch_parity.rs, ran the test suites listed above on local hardware, and drafted this PR description.
**@⁠HumanlyDev** on GitHub · 2026-11-25 06:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/2143) `HumanlyDev:tests/gpu-dxil-flat-global-scratch-parity` → `main` · +397 −0 · 1 files · 1 commits · open Add GPU differential parity integration tests between the direct RDNA2 → DXIL translator (`xcl::gpu::dxil::kernel::translate_full`, validated with `dxil.dll`) and HLSL + DXC (`xcl::gpu::recomp`) for `GLOBAL`, `FLAT`, and `SCRATCH` memory instructions across wave32 and wave64 (split-wave64 on wave32-only GPUs). Test-only change under `crates/xcl/tests/`; no runtime files modified. **What is in it** - `crates/xcl/tests/gpu_dxil_flat_global_scratch_parity.rs` (397 lines): - `direct_dxil_global_load_store_subdword_d16_and_saddr_parity`: `GLOBAL_{LOAD,STORE}_DWORD{,X2,X3,X4}` (64-bit `VADDR` with `SADDR=0x7D`, and 32-bit `VADDR` + SGPR `SADDR` with positive/negative signed 12-bit offsets), `GLOBAL_{LOAD,STORE}_{BYTE,SHORT}` / `UBYTE` / `SBYTE` / `USHORT` / `SSHORT`, all six `D16` / `D16_HI` load variants preserving untouched 16-bit halves, `GLOBAL_{LOAD,STORE}_DWORD_ADDTID`, and divergent `EXEC` masking. - `direct_dxil_global_atomics_32_and_64_parity`: 17 32-bit `GLOBAL_ATOMIC_*` ops (`SWAP`, `CMPSWAP`, `ADD`, `SUB`, `SMIN`, `UMIN`, `SMAX`, `UMAX`, `AND`, `OR`, `XOR`, `INC`, `DEC`, `CSUB`, `FMIN`, `FMAX`, `FCMPSWAP`) and 16 64-bit `GLOBAL_ATOMIC_*_X2` ops with `GLC=1`, `SADDR` + negative offsets, CAS hit/miss (`-0.0 == +0.0`), `INC`/`DEC`/`CSUB` wrap/clamp, positive/negative floats, and `EXEC` masking. - `direct_dxil_flat_load_store_and_atomic_parity`: `FLAT_{LOAD,STORE}_DWORD{,X2,X3,X4}`, sub-dword / `D16` / `D16_HI` ops, 16 32-bit and 64-bit `FLAT_ATOMIC_*` ops with `GLC=1`, and divergent `EXEC` load/store masking. - `direct_dxil_scratch_load_store_subdword_d16_and_exec_parity`: per-lane `SCRATCH_{LOAD,STORE}_DWORD{,X2,X3,X4}` with both SGPR `SADDR` and per-lane `ADDR` (`SADDR=0x7D`) + signed 12-bit offsets, sub-dword / `D16` / `D16_HI` ops, and `EXEC` masking. **Tested** - Hardware & toolchain: NVIDIA GeForce RTX 4060 (driver `32.0.16.1088`) and AMD Radeon(TM) Graphics (driver `32.0.21030.2001`), AMD Ryzen 5 7600, Windows 11 Pro `10.0.26200` (build `26200`), `rustc 1.100.0 (0ef1bc386 2026-11-09)`, DXC `1.8.2502.11` (Windows SDK `10.0.26100.0`), debug & release. - `cargo test -p xcl --test gpu_dxil_flat_global_scratch_parity -- --nocapture` (RTX 4060, debug): 4 passed, 0 failed, 0 ignored (0 SKIPPED; each test ran wave32 + split-wave64 on both Direct DXIL and HLSL+DXC). - `XCL_ADAPTER=Radeon cargo test -p xcl --test gpu_dxil_flat_global_scratch_parity -- --nocapture` (AMD Radeon(TM) Graphics, debug): 4 passed, 0 failed, 0 ignored (0 SKIPPED). - `XCL_D3D12_DEBUG=1 cargo test -p xcl --test gpu_dxil_flat_global_scratch_parity -- --test-threads=1 --nocapture` (RTX 4060, debug): 4 passed, 0 failed, 0 ignored. - `XCL_ADAPTER=warp cargo test -p xcl --test gpu_dxil_flat_global_scratch_parity -- --nocapture` (WARP, debug): 4 passed, 0 failed, 0 ignored (4 SKIPPED: `no wave64`). - `cargo test --release -p xcl --test gpu_dxil_flat_global_scratch_parity -- --nocapture` (RTX 4060, release): 4 passed, 0 failed, 0 ignored (0 SKIPPED). - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`, RTX 4060, debug): 1158 passed, 0 failed, 46 ignored across 22 test targets (25 SKIPPED GPU checks: 20 `no wave64`, 3 `per-lane form` `#1426` refusals, 1 `no heap windows`, 1 `cannot disable the driver cache (Windows Developer Mode is required)`). **Regression run** - Not needed: test-only change under `crates/xcl/tests/` (no runtime files under `crates/xcl/src/` modified). **Not tested** - Retail game titles (`scripts/smoke.ps1`) and `XCL_SAMPLE_*` tests (no retail game files or sample paths on this machine). - Discrete AMD RDNA3/RDNA4 GPUs, Linux / Wine, and `XCL_HEAP_WINDOWS=1` / multi-window UMA arenas. **AI use** - Antigravity (Google DeepMind; Gemini 4): researched `lower_mem.rs`, `emit.rs`, `rdna2_spec.rs`, and `runner.rs`, wrote `crates/xcl/tests/gpu_dxil_flat_global_scratch_parity.rs`, ran the test suites listed above on local hardware, and drafted this PR description.
Add GPU differential parity tests comparing the direct RDNA2 -> DXIL translator (validated with dxil.dll) against HLSL + DXC across wave32, split-wave64, and native wave64 (when supported) for GLOBAL, FLAT, and SCRATCH memory instructions.

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

@⁠JoaoPauluu on GitHub · 2026-11-25 06:25 UTC · original

A run with vkd3d-proton as the host D3D12: 2 of the 4 parity tests fail here. In both, the HLSL reference kernel does not finish, so the direct form is never compared.

Tested

  • RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for x86_64-pc-windows-gnu. 54387a4 as it is (merge base with main 6e1e2be), no uncommitted changes. The gpu_dxil_flat_global_scratch_parity test binary runs under Wine, one test per process.
    • direct_dxil_global_load_store_subdword_d16_and_saddr_parity: ok.
    • direct_dxil_scratch_load_store_subdword_d16_and_exec_parity: ok.
    • direct_dxil_flat_load_store_and_atomic_parity: fails at gpu_dxil_flat_global_scratch_parity.rs:124, wave32 HLSL run: kernel dispatch: GPU fence still pending after 10000 ms.
    • direct_dxil_global_atomics_32_and_64_parity: fails the same way, at the same line.
  • Both failures are in the runner::run of the HLSL → DXC kernel, the reference, before the direct form runs. The two tests with atomics hang on the GPU here, and the two without pass. I have not checked which instruction the HLSL kernel loops on.

Not tested

  • the direct forms of the two failing tests on their own, wave64 (32-lane waves only here), native Windows, AMD.

AI use

  • Claude Code (Claude Opus 5.5) built the commit, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
**@⁠JoaoPauluu** on GitHub · 2026-11-25 06:25 UTC · [original](https://github.com/xcl-dev/xcl/pull/2143#issuecomment-7154774668) A run with vkd3d-proton as the host D3D12: 2 of the 4 parity tests fail here. In both, the HLSL reference kernel does not finish, so the direct form is never compared. **Tested** - RTX 3060 12 GB (NVIDIA 620.70.06, 32-lane waves), i5-10400F, 16 GB, CachyOS (kernel 7.3.3), Proton Experimental 11.0-20261112 with the patched vkd3d-proton 3.1 from #257, DXC 1.9.2609.5. Release, cross-built for `x86_64-pc-windows-gnu`. `54387a4` as it is (merge base with `main` `6e1e2be`), no uncommitted changes. The `gpu_dxil_flat_global_scratch_parity` test binary runs under Wine, one test per process. - `direct_dxil_global_load_store_subdword_d16_and_saddr_parity`: ok. - `direct_dxil_scratch_load_store_subdword_d16_and_exec_parity`: ok. - `direct_dxil_flat_load_store_and_atomic_parity`: **fails** at `gpu_dxil_flat_global_scratch_parity.rs:124`, `wave32 HLSL run: kernel dispatch: GPU fence still pending after 10000 ms`. - `direct_dxil_global_atomics_32_and_64_parity`: **fails** the same way, at the same line. - Both failures are in the `runner::run` of the HLSL → DXC kernel, the reference, before the direct form runs. The two tests with atomics hang on the GPU here, and the two without pass. I have not checked which instruction the HLSL kernel loops on. **Not tested** - the direct forms of the two failing tests on their own, wave64 (32-lane waves only here), native Windows, AMD. **AI use** - Claude Code (Claude Opus 5.5) built the commit, ran the tests and wrote this report. The account owner asked for test reports to be posted and has not reviewed this one.
Author
Owner

@⁠DarkPanda69 on GitHub · 2026-11-25 06:28 UTC · original

Tested on the discrete RDNA4 card this PR lists as untested, and on native Windows with the same RTX 3060 as the vkd3d-proton run above: all 4 parity tests pass on both.

  • RX 9070 XT (RDNA4, driver 32.0.32029.2010, waves 32..64): cargo test -p xcl --test gpu_dxil_flat_global_scratch_parity: 4 passed, 0 failed, 0 SKIPPED, so each test also ran its native-wave64 case.
  • RTX 3060 (driver 32.0.16.1088, waves 32 only, native D3D12): 4 passed, 0 failed, 0 SKIPPED. Both atomics tests (direct_dxil_global_atomics_32_and_64_parity, direct_dxil_flat_load_store_and_atomic_parity) finish here, so the HLSL fence timeout above looks specific to vkd3d-proton rather than to the card.
  • Whole gpu:: lib filter with this PR applied: RX 9070 XT 584 passed, 2 failed (the AMD fuzz seeds 722 and 1599 tracked in #2115, same on main); RTX 3060 586 passed, 0 failed.

Head 54387a4 applied on main 6ea813a, debug, Windows 11 Pro 26200, XCL_ADAPTER set to each card.
Not tested: release build, XCL_HEAP_WINDOWS=1, Linux / Wine.
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

**@⁠DarkPanda69** on GitHub · 2026-11-25 06:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/2143#issuecomment-7154827205) Tested on the discrete RDNA4 card this PR lists as untested, and on native Windows with the same RTX 3060 as the vkd3d-proton run above: all 4 parity tests pass on both. - RX 9070 XT (RDNA4, driver 32.0.32029.2010, waves 32..64): `cargo test -p xcl --test gpu_dxil_flat_global_scratch_parity`: 4 passed, 0 failed, 0 SKIPPED, so each test also ran its `native-wave64` case. - RTX 3060 (driver 32.0.16.1088, waves 32 only, native D3D12): 4 passed, 0 failed, 0 SKIPPED. Both atomics tests (`direct_dxil_global_atomics_32_and_64_parity`, `direct_dxil_flat_load_store_and_atomic_parity`) finish here, so the HLSL fence timeout above looks specific to vkd3d-proton rather than to the card. - Whole `gpu::` lib filter with this PR applied: RX 9070 XT 584 passed, 2 failed (the AMD fuzz seeds 722 and 1599 tracked in #2115, same on `main`); RTX 3060 586 passed, 0 failed. Head `54387a4` applied on `main` `6ea813a`, debug, Windows 11 Pro 26200, `XCL_ADAPTER` set to each card. Not tested: release build, `XCL_HEAP_WINDOWS=1`, Linux / Wine. AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 06:49 UTC · original

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

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-25 06:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/2143#issuecomment-7155194957) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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