Skip to content

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

Merged
throny merged 1 commit into
xcl-dev:mainfrom
HumanlyDev:tests/gpu-dxil-flat-global-scratch-parity
Dec 3, 2026
Merged

throny merged 1 commit into
xcl-dev:mainfrom
HumanlyDev:tests/gpu-dxil-flat-global-scratch-parity

Conversation

@HumanlyDev

Copy link
Copy Markdown
Contributor

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)
@JoaoPauluu

Copy link
Copy Markdown

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 Linux: docs/linux.md, scripts/linux and Wine start-up checks for vkd3d-proton and DXVK (#154, #241) #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.

@DarkPanda69

Copy link
Copy Markdown

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 DXIL fuzz tests: fuzz_validate_and_gpu_1 fails on AMD (seed 722 and others, RDNA2-4), so the default suite is red there #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.

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

@github-actions

Copy link
Copy Markdown

Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Triage (#1607) – head 54387a4

The other direct DXIL vs HLSL parity PRs cover different instruction families: #1823 (VOP3P, movrel, 64-bit VALU), #2084 (MUBUF, TBUFFER, SMEM), #2093 (LDS) and #2276 (MIMG). None of them, open or merged, covers FLAT, GLOBAL or SCRATCH. The new file is test-only. It skips without DXC or a GPU, and it checks fixed expected values as well as backend-to-backend equality. No problems found in the diff.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

@cj-tomlin

Copy link
Copy Markdown

Test report, head 54387a46ad1fa4463ac70b90abf2f2fb52daf046 merged onto main 5eaadb54c14e0fc29597b2a1689d7dbd83491303 (clean, merge 2643cb46).

  • Hardware: NVIDIA GeForce RTX 3080 10 GB (wave32 only), driver 621.40, AMD Ryzen 7 7800X3D, Windows 11 build 26300, debug build.
  • cargo build --workspace: ok.
  • cargo test --workspace --no-fail-fast -- --test-threads=4: 2978 passed, 0 failed, 52 ignored; SKIPPED: 27 (22 no wave64, 2 no heap windows, 3 no D3D12 debug layer / d3d12SDKLayers.dll), the same 27 as plain main (2974 passed, 0 failed, 52 ignored) on this machine.
  • cargo test -p xcl --test gpu_dxil_flat_global_scratch_parity -- --nocapture: 4 passed, 0 failed, no SKIPPED line. On this card each test runs the wave32 and split-wave64 forms; native wave64 does not run here.
  • The GPU part really runs: with the swap old expectation in direct_dxil_global_atomics_32_and_64_parity changed from 4 to 5, that test fails with wave32 swap old (left 4, right 5); file restored afterwards.

Diff read (+397/-0, one new test file, test only). Minor: when neither wave32 nor wave64 is available, the test skips with the reason no wave64, which reads oddly but changes nothing here.

Tool and model: Claude Code (Claude Opus 5.5) merged, built, ran the tests and drafted this; I checked it.

@grathepic

Copy link
Copy Markdown

merge-check
base: 078358a
head: 54387a4
merge: clean (git diff --check origin/main..HEAD clean)
build: cargo +1.98.1-x86_64-pc-windows-msvc build --offline --locked --workspace -> ok
tests: cargo +1.98.1-x86_64-pc-windows-msvc test --offline --locked --workspace --no-fail-fast -- --test-threads=4 (with XCL_DXC_DIR=C:\VulkanSDK\1.4.363.0\Bin, XCL_SAMPLE_* unset) -> 3010 passed, 0 failed, 52 ignored across 45 harnesses; SKIPPED: 27 notices (22 no wave64, 2 no heap windows, 1 no GPU_UPLOAD heaps, 1 no dxil.dll, 1 cannot disable the driver cache (Windows Developer Mode required)); failing: none. All 4 new tests in tests/gpu_dxil_flat_global_scratch_parity.rs (direct_dxil_global_load_store_subdword_d16_and_saddr_parity, direct_dxil_global_atomics_32_and_64_parity, direct_dxil_flat_load_store_and_atomic_parity, direct_dxil_scratch_load_store_subdword_d16_and_exec_parity) ran on RTX 3080 (wave32 + split-wave64) and passed in 1.07s with 0 skips.
title run: none (Tier 0 test-only diff in crates/xcl/tests/gpu_dxil_flat_global_scratch_parity.rs)
review: Full 397-line single-commit diff read (+397/-0, crates/xcl/tests/gpu_dxil_flat_global_scratch_parity.rs). Clean, well-structured differential GPU tests comparing Direct DXIL against HLSL+DXC plus ground-truth checks across GLOBAL, GLOBAL_ATOMIC_* (32/64-bit), FLAT, FLAT_ATOMIC_*, and SCRATCH ops. Audited per-lane buffer layouts and offsets across all 4 tests: every memory region is in-bounds and disjoint across lanes/operations, SADDR/negative signed 12-bit offsets and EXEC masking are exercised, and SCRATCH SADDR load completes before overlapping vector stores. Minor non-blocking note: when neither wave32 nor wave64 is supported, line 101 calls runner::skip_test("no wave64") instead of a more general reason. Untested on this machine: native wave64 / AMD GPU (RTX 3080 is wave32-only), dxil.dll validator signing (VulkanSDK DXC lacks dxil.dll), and Linux/vkd3d-proton.
performance: none (test-only integration binary running in ~1.1 s; no runtime path changed)
verdict: safe to merge (clean merge, full workspace suite passes with 0 failures on NVIDIA RTX 3080, all 4 new FLAT/GLOBAL/SCRATCH Direct-DXIL vs HLSL GPU parity tests execute and pass with 0 skips, and diff is clean and strictly test-only)
hardware / tool and model: NVIDIA GeForce RTX 3080 (driver 32.0.16.2140), AMD Ryzen 7 5800X3D, Windows 11 (10.0.26300.0), Rust 1.98.1-x86_64-pc-windows-msvc, DXC 1.9.0.5512 (VulkanSDK, no dxil.dll) / Antigravity, Gemini 4 Neon

@github-actions github-actions Bot added area:tests Unit, integration, e2e tests, or testtitle needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) labels Dec 2, 2026
@Pipodi

Pipodi commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

merge-check
base: 078358a
head: 54387a4
merge: clean (git merge --no-ff onto 078358a, merge 861dc5bb; one new file, crates/xcl/tests/gpu_dxil_flat_global_scratch_parity.rs +397)
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 3010 passed, 0 failed, 52 ignored; failing: none (SKIPPED 25: 22 no wave64, 2 no heap windows, 1 cannot disable the driver cache). The four new tests (direct_dxil_global_load_store_subdword_d16_and_saddr_parity, direct_dxil_global_atomics_32_and_64_parity, direct_dxil_flat_load_store_and_atomic_parity, direct_dxil_scratch_load_store_subdword_d16_and_exec_parity) ran and passed, none printed SKIPPED: on this wave32-only adapter each ran its wave32 and split-wave64 cases (no native-wave64 case). The FLAT atomics test did not hit the HLSL fence timeout reported under vkd3d-proton.
title run: none (test-only change, no file under crates/xcl/src)
review: read the whole diff. No blocking findings. 1) Each test runs the same program through direct DXIL (validated with dxil.dll) and HLSL + DXC, compares the whole memory buffer and the listed VGPRs lane by lane, then checks hand-computed values (sub-dword sign/zero extension, D16/D16_HI halves, INC wrap, CSUB clamp, FCMPSWAP -0.0 == +0.0, EXEC-masked lanes keep their VDST and memory), so a bug shared by both paths is still caught where a ground truth is asserted. 2) I checked the per-lane address ranges of the global, atomic and FLAT layouts against the buffer sizes: in bounds and disjoint between lanes for 64 lanes. 3) Minor, as noted before: with neither wave size available the skip reason is no wave64 rather than no GPU; it cannot happen on a D3D12 adapter that passed the earlier checks. 4) Coverage is for the translators only; nothing in the runtime changes.
performance: none (test-only; the new test binary finished in 1.07 s here)
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 4090 24 GB, driver 621.40; Intel Core i9-13900K, 32 GB; Windows 11 build 26300; rustc 1.100.0, debug; Claude Code, Claude Opus 5.5

@github-actions github-actions Bot added ready-to-merge Has 2 independent safe merge-checks on current head (#3041) and removed needs-2nd-check Has 1 safe merge-check; needs second independent check (#3041) labels Dec 3, 2026
@throny
throny merged commit 395405e into xcl-dev:main Dec 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:tests Unit, integration, e2e tests, or testtitle ready-to-merge Has 2 independent safe merge-checks on current head (#3041) stale No activity for 3 days; closed 4 days later unless something happens

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants