Tests: verify RDNA2 multi-dword, d16, and dual LDS ops on the GPU #539
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/544"
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 Vadson159 on 2026-11-24T01:36:01Z.
Add GPU verification tests for previously untested RDNA2 LDS (
DS_*) instructions against the AMD RDNA 2 ISA specification: wide multi-dword accesses (DS_WRITE_B64/B96/B128,DS_READ_B64/B96/B128,DS_NOP), dual-offset and stride-64 operations (DS_WRITE2_B64,DS_READ2_B64,DS_WRITE2ST64_B32/B64,DS_READ2ST64_B32/B64,DS_WRXCHG2_RTN_B32,DS_WRXCHG2ST64_RTN_B32), 32-bit LDS atomics (DS_INC_RTN_U32,DS_DEC_RTN_U32,DS_RSUB_RTN_U32,DS_WRXCHG_RTN_B32,DS_MSKOR_RTN_B32), and D16 sub-dword accesses (DS_WRITE_B8_D16_HI,DS_WRITE_B16_D16_HI,DS_READ_U8_D16/_HI,DS_READ_I8_D16/_HI,DS_READ_U16_D16/_HI).Tests only — no runtime code in
crates/xcl/srcis changed.What is in it
crates/xcl/tests/gpu_recomp_lds.rs:lds_wide_dual_d16_translate_and_compile_with_dxc: verifies HLSL translation,xcl_lds/XCL_X_LDS_TOPemission alongside a cross-halfV_READFIRSTLANE_B32exchange, and DXC compilation acrosswave64,split-wave64,wave32, andwave32@hw64.gpu_lds_wide_b64_b96_b128_and_addr_overlap: verifiesDS_WRITE/READ_B64/B96/B128andDS_NOPwith 16-bit(OFFSET1 << 8) | OFFSET0byte offsets (cross-checked at offset 0), neighbor(lane ^ 1)reads,VDST == ADDR/VDST + 1 == ADDRoverlap hazards, divergentEXECmasking, andsplit-wave64coexistence withV_READFIRSTLANE_B32.gpu_lds_dual_stride64_and_atomics: verifies 8-byte (*2_B64), 256-byte (*2ST64_B32), and 512-byte (*2ST64_B64) strides,VDST == ADDR/VDST + 1 == ADDRoverlaps,DS_WRXCHG2_RTN_B32/DS_WRXCHG2ST64_RTN_B32(including multi-lane shared-slot atomic permutation checks),DS_INC/DEC/RSUB_RTN_U32/DS_WRXCHG/MSKOR_RTN_B32, and divergentEXECmasking.gpu_lds_d16_subdword_and_sign_extension: verifies concurrent sibling-preservingDS_WRITE_B8_D16_HI(4 lanes/dword) andDS_WRITE_B16_D16_HI(2 lanes/dword), all 6DS_READ_U8/I8/U16_D16/_HIvariants across all 4 byte alignments and nonzerooff16, 8-to-16 sign extension, untouched half preservation,VDST == ADDR, and divergentEXECmasking.Tested
32.0.32029.2010; AMD Radeon(TM) Graphics driver32.0.21045.29003also present), Windows10.0.26300.0,rustc 1.100.0(0ef1bc386 2026-11-09), DXC1.8.2502.11(C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64), debug build.XCL_REQUIRE_GPU=wave64,mesh+.\scripts\test.ps1(cargo test --workspace -- --test-threads=4): 684 passed, 0 failed, 41 ignored (0 GPU tests skipped;XCL_SAMPLE_*unset).cargo test -p xcl --test gpu_recomp_lds: 4 passed, 0 failed, 0 ignored.cargo clippy -p xcl --test gpu_recomp_lds -- --no-deps: 0 warnings incrates/xcl/tests/gpu_recomp_lds.rs.rustfmt --check crates/xcl/tests/gpu_recomp_lds.rs: passed.Regression run
crates/xcl/srcis untouched).Not tested
split-wave64andwave32paths were exercised on the RX 9070 XT).--release) and retail titles (XCL_SAMPLE_*unset; no game folder locally).AI use
Imported from ivall/xcl. Originally posted by towiice on 2026-11-24T01:57:22Z.
Review: COMMENTED
Tested PR head
3eab39fon NVIDIA GeForce GTX 1650 SUPER (Turing / TU116, wave32, driver 610.88), Windows 11 build 10.0.26300 (26H2), Rust 1.100.0 (stable-x86_64-pc-windows-gnullvm), DXCv1.9.2609:cargo test -p xcl --test gpu_recomp_lds -- --test-threads=4: 4 passed, 0 failed (1.43 s):lds_wide_dual_d16_translate_and_compile_with_dxcgpu_lds_d16_subdword_and_sign_extensiongpu_lds_wide_b64_b96_b128_and_addr_overlapgpu_lds_dual_stride64_and_atomicsAll multi-dword, d16, and dual LDS GPU tests pass on Turing.
Imported from ivall/xcl. Originally posted by thehollowedone on 2026-11-24T01:38:42Z.
Tested
RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Windows 11 build 26300, Rust 1.99.1 MSVC, DXC 1.8.2502.11, debug. With
XCL_ADAPTER=3080 TiandXCL_REQUIRE_GPU=1,cargo test --offline --locked -p xcl --test gpu_recomp_lds -- --test-threads=1 --nocapturereported 4 passed, 0 failed, 0 ignored, and no runtime skips. Tested commit 3eab39fGPU readbacks matched in wave32 and split-wave64 for wide reads and writes, dual-address operations and atomics, and D16 packing and sign extension. The separate translation test compiled all four wave configurations with DXC.
Not tested
Native wave64 execution, the full workspace suite, and retail titles.
AI use
Codex with GPT-6.2 Sol ran the tests and drafted this report.
Imported from ivall/xcl. Originally posted by joeypercia on 2026-11-24T03:39:53Z.
RDNA2 run (the PR has RDNA4 and an NVIDIA run):
3eab39fmerged ontomain91f9a5e(clean merge).Tested
cargo test -p xcl --test gpu_recomp_lds: 4 passed, 0 failed on the RDNA2 iGPU (native wave64 and the 32-lane forms) and on the RTX 4070 Ti, noSKIPPEDcargo test --workspace --no-fail-fast -- --test-threads=4on the RDNA2 iGPU: 696 passed, 0 failed, 41 ignored;SKIPPED:gpu_geometry_mode_es_gs_strip,gpu_mesh_mode_two_passes(no mesh shaders)Not tested
Run and report by Claude Code (Claude Opus 5.5).
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #172Imported from ivall/xcl. Originally posted by akimfomin on 2026-11-24T10:01:33Z.
Thanks for adding the D16 coverage. PortBridge picked up this test while I was checking the related translator change in VIctory. The
DS_READ_U16_D16_HIprobes here appear to read aligned halfwords. If unaligned loads are in scope, would a byte-3 case be useful for the GPU fixture?I wrote
0xAB123456and0xDEADCDBEto adjacent LDS dwords, seeded the destination with0xCAFE1357, and read at byte offset 3. The translated VIctory shader returned0xBEAB1357on both NVIDIA D3D12 and WARP. That exercises the two-word read and preservation of the destination’s low half in one case. The result is for VIctory’s translator. Does the native XCL fixture agree?VIctory readback and test patch. AI-assisted with Codex.
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T06:53:52Z.
Empirical test report (
3eab39f8)Independent Intel Arc A770 GPU verification of PR #544 at detached head
3eab39f8d43ea9d8422827fed53387c441ed2eff(clean worktree).Hardware / environment
32.0.101.9175), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation x64 build26200.9974.rustc 1.100.0 (0ef1bc386 2026-11-09)(x86_64-pc-windows-msvc), DXC1.9.2609.5 (01b62ad47)+ DXIL1.9.2609.5, unoptimized Cargo test profile with debug info and incremental compilation disabled.Commands and results
cargo test -p xcl --tests --no-run --message-format=jsonoutside the GPU lock.Invoke-ArcTest.ps1withXCL_ADAPTER=A770andRUST_TEST_NOCAPTURE=1:gpu_recomp_lds.exe --nocapture --test-threads=1(exit 0, 0.69s).Observed behavior
gpu_lds_d16_subdword_and_sign_extension,gpu_lds_dual_stride64_and_atomics,gpu_lds_wide_b64_b96_b128_and_addr_overlap, andlds_wide_dual_d16_translate_and_compile_with_dxcall passed on the Intel Arc A770 with DXC 1.9.2609.5.Not tested
AI use
Verified and published with T3 Code / Antigravity (gemini-4-neon).
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T13:43:13Z.
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 Prime1997 on 2026-11-26T15:12:52Z.
Review: COMMENTED
Focused NVIDIA result: 4 passed, 0 failed, 0 ignored, 0 explicit skips.
Tested this head on an isolated merge tree with
nvidia-devaf2cecc40886a8682ecf3267f5328c6dc4b66ad7, using an RTX 3060 Ti (32.0.16.1714) and DXC 1.9.2609.5. Ran the four namedgpu_recomp_ldstests individually with--test-threads=1 --nocaptureafter rebuildingcargo test --locked -p xcl --test gpu_recomp_lds --no-run. Three tests were filtered out on each invocation; every test ran once. The GPU cases covered wave32 and split-wave64 LDS accesses, paired strides and atomics, and D16 packing. DXC compilation covered all four shader modes. Native wave64 execution and the current full workspace suite remain unverified here.Current main accepts the patch cleanly. Merged #1617 covers part of the stride cases. Open #1177 and #1178 overlap with the wide and D16 cases, while this suite adds masked lanes, shared-slot atomic exchanges, and more overlap cases. Please split the 1,233-line suite along those boundaries or explain in the description why it needs to stay together. Windows CI was awaiting approval at review time. The focused NVIDIA results support the fixtures.
AI use: Codex (GPT-6) reviewed the pinned changes and verified the reported evidence. Optional temporary Discord for coordinating contributor work, testing, and comparing results.
Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-11-30T19:09:07Z.
merge-check claim
head:
3eab39f8d4Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T19:10:47Z.
merge-check claim
head:
3eab39f8d4Imported from ivall/xcl. Originally posted by coolpersonnn on 2026-11-30T19:16:51Z.
merge-check
base:
ff0c364b3dhead:
3eab39f8d4merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2893 passed, 0 failed, 51 ignored (25 SKIPPED: 22 no wave64, 2 no heap windows, 1 cannot disable the driver cache); failing: none; all 4 new tests in tests/gpu_recomp_lds.rs passed in 0.54s (wave32 and split-wave64 executed on GPU; wave64 / wave32@hw64 modes require native wave64 hardware)
review: none. Read the full diff (+1233/-0, new file crates/xcl/tests/gpu_recomp_lds.rs). Pure test-only addition with no runtime changes and no unsafe. Verifies DXC compilation across all 4 wave modes plus GPU execution of wide LDS (b64/b96/b128 + DS_NOP), dual/stride64 loads & stores, dual atomic exchanges (including multi-lane linearizability permutation check) and 32-bit atomics (INC/DEC/RSUB/WRXCHG/MSKOR), D16 sub-dword writes/reads with sibling preservation and sign extension, 16-bit byte offsets, VDST==ADDR / VDST+1==ADDR hazards, divergent EXEC masking, and split-wave64 XCL_X_LDS_TOP coexistence. Uses runner::skip_test properly when GPU/DXC/wave64 is unavailable. No duplicates found in open/merged PRs or #1607 (open #1177 is a much smaller 76-line subset in recomp/tests.rs; #2093 tests direct DXIL vs HLSL parity).
performance: none (test-only change; no runtime code modified; new suite runs in 0.54s)
verdict: safe to merge
hardware / tool and model: NVIDIA GeForce RTX 5090 (driver 32.0.16.2101), AMD Ryzen 9 9950X3D, Windows 11 Pro build 26300, Rust 1.100.0 / T3 Code (Antigravity), Gemini 4 Neon (Medium)
Imported from ivall/xcl. Originally posted by saintwolf on 2026-11-30T19:18:09Z.
merge-check
base:
ff0c364b3dhead:
3eab39f8d4merge: clean (trial merge f809566a10f55d0b7e4c64ba44d7d50cae5b3538; git diff --check clean; +1233/-0, new file crates/xcl/tests/gpu_recomp_lds.rs)
build: cargo build --workspace -> ok (39 lib warnings, all pre-existing; none from the new file)
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2893 passed, 0 failed, 51 ignored (base ff0c364b's 2889 + the 4 new tests; 44 suites = 43 + the new test binary). SKIPPED: 27, the standard set for this card. All 4 new tests ran and passed here (0 SKIPPED in the targeted run, 0.54 s): the three GPU tests ran their split-wave64 and wave32 configs on this wave32-only card (native-w64 / wave32@hw64 are config-gated out on it and are covered on native wave64 hardware by the thread's AMD reports), and the translate/DXC test ran all four wave configs plus DXC compilation on the CPU.
review: read the whole 1233-line file. Test-only PR: four tests in one new integration-test file, no production-code change, no stop-criteria files, no new dependencies (every used API — rdna2::encode, recomp::{translate, Options, dxc, runner::run, KernelState, KernelResult} — verified against main by signature). The tests use exact-value oracles rather than differential comparison, which is sound here because LDS semantics are deterministic per-lane; I hand-verified the fixture math: (1) D16 sub-dword writes — DS_WRITE_B8_D16_HI writes bits [23:16] of DATA0 at the byte address, so four consecutive lanes assemble one dword, and DS_WRITE_B16_D16_HI pairs two lanes per dword; the expected assembled dwords check out byte by byte; (2) the 16-bit (OFFSET1 << 8) | OFFSET0 byte offsets are proven by independent offset-0 single-dword cross-reads at the exact computed addresses; (3) D16 read semantics — U8 replaces bits [7:0], U8_H [15:8], I8/I8_H sign-extend into [15:0]/[23:8], U16/U16_H replace whole halfwords, and the untouched halves keep the preloaded sentinels (0xA1A1_1111, 0xB2B2_2222, …) — every assertion matches; (4) 32-bit LDS atomics run on per-lane private slots (0x2900 + 32l), so old values are deterministic: INC/DEC wrap at the 9 limit, RSUB = 1000 - (100 + l), WRXCHG/MSKOR old/new all match the ISA; (5) the one genuinely racy case — all active lanes contending on the same two dwords in DS_WRXCHG2_RTN_B32 — is checked order-independently: the sorted multiset {returned olds} + {final LDS value} must equal {initial} + {all written tags}, the correct linearizability oracle with no arrival-order assumption; (6) divergent EXEC masking: is_active() uses the 64-bit (lo | hi << 32) mask for wave64/split configs and lo only for wave32, matching how the split halves see EXEC; masked read vs final-memory sentinel assertions check both the active and inactive lanes; (7) s_mov_b64(126, 193) verified: SGPR-source values 193..=208 decode as negative SIMM16 (rdna2.rs:706, emit.rs:818/848), so 193 = -1, i.e. EXEC all-ones — the "EXEC = -1 (all lanes)" comment is accurate; (8) layout hazard audit: every LDS address is below 0x3000, inside the 32 KB xcl_lds below XCL_X_LDS_TOP; the single region overlap (lane 16's atomic block at 0x2B00..0x2B14 vs WRXCHG2ST64 slot1 of lanes 0..4 at 0x2B00 + 4l) is separated by S_BARRIER in program order and each lane later reads only its own private slot, so it is harmless; VDST == ADDR / VDST + 1 == ADDR register hazards are exercised explicitly, including the D16 case where v22 holds its own address and the upper half must survive; (9) the translate test pins the recompiler's LDS ABI (groupshared uint xcl_lds[8192]) and the split-wave64 XCL_X_LDS_TOP / xcl_x_rla_uniform exchange markers and DXC-compiles the output in all four wave configs. Gating follows the standard pattern (runner::wave64_programs_supported + dxc::location with skip_test); the 0-SKIPPED targeted run confirms the GPU configs actually executed rather than silently returning. Thread: four independent reports all 4/4 on this exact head — RTX 3080 Ti (wave32 + split-wave64), RDNA2 iGPU (native wave64 + 32-lane forms) and RTX 4070 Ti, Intel Arc A770, plus DavidM1911's lib pass; akimfomin's note that the d16 probes read aligned halfwords is consistent with the fixture (reads at byte offsets 0x0104..0x0107 inside dwords). Overlap note: #2093 (direct DXIL vs HLSL parity for the same instruction family, different file) already carries two safe checks (BBareth, saintwolf) and will land first — this PR covers the recompiler/HLSL path plus the EXEC/hazard/D16 oracle coverage #2093 does not, so the two are complementary, not duplicates; no #1607 group covers #544, and open #1178 (d16 LDS) is thematically adjacent only.
performance: none; tests only.
verdict: safe to merge
hardware / tool and model: RTX 4070 SUPER (driver 32.0.16.2140), Ryzen 7 7800X3D, Windows 11 build 26300, Rust 1.100.0 / OpenCode, Qwen 3.8 27B
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:41:23Z.
Triage (#1607) – head
3eab39f#1177 (64/96/128-bit and paired LDS loads/stores) and #1178 (d16 LDS loads/stores) test a subset of the same DS ops as ~75-line additions to recomp/tests.rs; this PR was opened first and also covers the 32-bit LDS atomics,
DS_WRXCHG2*and four wave modes, in a new 1233-line file. OnlyDS_READ2ST64_B64is already exercised on main. No problems found in the diff;gpu_readyskips all of it (wave32 too) on an adapter without wave64 programs.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.