Tests: verify direct DXIL vs HLSL parity for FLAT, GLOBAL, SCRATCH ops #2133
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2143"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by HumanlyDev on 2026-11-25T06:10:06Z.
Add GPU differential parity integration tests between the direct RDNA2 → DXIL translator (
xcl::gpu::dxil::kernel::translate_full, validated withdxil.dll) and HLSL + DXC (xcl::gpu::recomp) forGLOBAL,FLAT, andSCRATCHmemory instructions across wave32 and wave64 (split-wave64 on wave32-only GPUs). Test-only change undercrates/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-bitVADDRwithSADDR=0x7D, and 32-bitVADDR+ SGPRSADDRwith positive/negative signed 12-bit offsets),GLOBAL_{LOAD,STORE}_{BYTE,SHORT}/UBYTE/SBYTE/USHORT/SSHORT, all sixD16/D16_HIload variants preserving untouched 16-bit halves,GLOBAL_{LOAD,STORE}_DWORD_ADDTID, and divergentEXECmasking.direct_dxil_global_atomics_32_and_64_parity: 17 32-bitGLOBAL_ATOMIC_*ops (SWAP,CMPSWAP,ADD,SUB,SMIN,UMIN,SMAX,UMAX,AND,OR,XOR,INC,DEC,CSUB,FMIN,FMAX,FCMPSWAP) and 16 64-bitGLOBAL_ATOMIC_*_X2ops withGLC=1,SADDR+ negative offsets, CAS hit/miss (-0.0 == +0.0),INC/DEC/CSUBwrap/clamp, positive/negative floats, andEXECmasking.direct_dxil_flat_load_store_and_atomic_parity:FLAT_{LOAD,STORE}_DWORD{,X2,X3,X4}, sub-dword /D16/D16_HIops, 16 32-bit and 64-bitFLAT_ATOMIC_*ops withGLC=1, and divergentEXECload/store masking.direct_dxil_scratch_load_store_subdword_d16_and_exec_parity: per-laneSCRATCH_{LOAD,STORE}_DWORD{,X2,X3,X4}with both SGPRSADDRand per-laneADDR(SADDR=0x7D) + signed 12-bit offsets, sub-dword /D16/D16_HIops, andEXECmasking.Tested
32.0.16.1088) and AMD Radeon(TM) Graphics (driver32.0.21030.2001), AMD Ryzen 5 7600, Windows 11 Pro10.0.26200(build26200),rustc 1.100.0 (0ef1bc386 2026-11-09), DXC1.8.2502.11(Windows SDK10.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: 20no wave64, 3per-lane form#1426refusals, 1no heap windows, 1cannot disable the driver cache (Windows Developer Mode is required)).Regression run
crates/xcl/tests/(no runtime files undercrates/xcl/src/modified).Not tested
scripts/smoke.ps1) andXCL_SAMPLE_*tests (no retail game files or sample paths on this machine).XCL_HEAP_WINDOWS=1/ multi-window UMA arenas.AI use
lower_mem.rs,emit.rs,rdna2_spec.rs, andrunner.rs, wrotecrates/xcl/tests/gpu_dxil_flat_global_scratch_parity.rs, ran the test suites listed above on local hardware, and drafted this PR description.Imported from ivall/xcl. Originally posted by JoaoPauluu on 2026-11-25T06:25:24Z.
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
x86_64-pc-windows-gnu.54387a4as it is (merge base withmain6e1e2be), no uncommitted changes. Thegpu_dxil_flat_global_scratch_paritytest 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 atgpu_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.runner::runof 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
AI use
Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T06:28:30Z.
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.
cargo test -p xcl --test gpu_dxil_flat_global_scratch_parity: 4 passed, 0 failed, 0 SKIPPED, so each test also ran itsnative-wave64case.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.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 onmain); RTX 3060 586 passed, 0 failed.Head
54387a4applied onmain6ea813a, debug, Windows 11 Pro 26200,XCL_ADAPTERset 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.
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T06:49:23Z.
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!
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-28T08:02:30Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T07:28:32Z.
Triage (#1607) – head
54387a4The 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.
Imported from ivall/xcl. Originally posted by cj-tomlin on 2026-12-02T16:39:13Z.
Test report, head
54387a46ad1fa4463ac70b90abf2f2fb52daf046merged ontomain5eaadb54c14e0fc29597b2a1689d7dbd83491303(clean, merge2643cb46).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 plainmain(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.swap oldexpectation indirect_dxil_global_atomics_32_and_64_paritychanged from 4 to 5, that test fails withwave32 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.
Imported from ivall/xcl. Originally posted by grathepic on 2026-12-02T23:28:12Z.
merge-check
base:
078358a058head:
54387a46admerge: clean (
git diff --check origin/main..HEADclean)build:
cargo +1.98.1-x86_64-pc-windows-msvc build --offline --locked --workspace-> oktests:
cargo +1.98.1-x86_64-pc-windows-msvc test --offline --locked --workspace --no-fail-fast -- --test-threads=4(withXCL_DXC_DIR=C:\VulkanSDK\1.4.363.0\Bin,XCL_SAMPLE_*unset) -> 3010 passed, 0 failed, 52 ignored across 45 harnesses; SKIPPED: 27 notices (22no wave64, 2no heap windows, 1no GPU_UPLOAD heaps, 1no dxil.dll, 1cannot disable the driver cache (Windows Developer Mode required)); failing: none. All 4 new tests intests/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 acrossGLOBAL,GLOBAL_ATOMIC_*(32/64-bit),FLAT,FLAT_ATOMIC_*, andSCRATCHops. 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 andEXECmasking are exercised, andSCRATCHSADDRload completes before overlapping vector stores. Minor non-blocking note: when neither wave32 nor wave64 is supported, line 101 callsrunner::skip_test("no wave64")instead of a more general reason. Untested on this machine: nativewave64/ AMD GPU (RTX 3080 is wave32-only),dxil.dllvalidator signing (VulkanSDK DXC lacksdxil.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/SCRATCHDirect-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
Imported from ivall/xcl. Originally posted by Pipodi on 2026-12-02T23:51:36Z.
merge-check
base:
078358a058head:
54387a46admerge: clean (
git merge --no-ffonto078358a0, 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 wave64rather thanno 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