Skip to content

Tests: verify RDNA2 multi-dword, d16, and dual LDS ops on the GPU - #544

Open
Vadson159 wants to merge 1 commit into
xcl-dev:mainfrom
Vadson159:test/recomp-lds
Open

Vadson159 wants to merge 1 commit into
xcl-dev:mainfrom
Vadson159:test/recomp-lds

Conversation

@Vadson159

Copy link
Copy Markdown
Contributor

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/src is 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_TOP emission alongside a cross-half V_READFIRSTLANE_B32 exchange, and DXC compilation across wave64, split-wave64, wave32, and wave32@hw64.
    • gpu_lds_wide_b64_b96_b128_and_addr_overlap: verifies DS_WRITE/READ_B64/B96/B128 and DS_NOP with 16-bit (OFFSET1 << 8) | OFFSET0 byte offsets (cross-checked at offset 0), neighbor (lane ^ 1) reads, VDST == ADDR / VDST + 1 == ADDR overlap hazards, divergent EXEC masking, and split-wave64 coexistence with V_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 == ADDR overlaps, 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 divergent EXEC masking.
    • gpu_lds_d16_subdword_and_sign_extension: verifies concurrent sibling-preserving DS_WRITE_B8_D16_HI (4 lanes/dword) and DS_WRITE_B16_D16_HI (2 lanes/dword), all 6 DS_READ_U8/I8/U16_D16/_HI variants across all 4 byte alignments and nonzero off16, 8-to-16 sign extension, untouched half preservation, VDST == ADDR, and divergent EXEC masking.

Tested

  • Hardware / OS: AMD Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (driver 32.0.32029.2010; AMD Radeon(TM) Graphics driver 32.0.21045.29003 also present), Windows 10.0.26300.0, rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.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 in crates/xcl/tests/gpu_recomp_lds.rs.
  • rustfmt --check crates/xcl/tests/gpu_recomp_lds.rs: passed.

Regression run

  • Not needed: tests only (crates/xcl/src is untouched).

Not tested

  • Wave32-only GPUs (NVIDIA / Intel) and RDNA1/2/3 GPUs (split-wave64 and wave32 paths were exercised on the RX 9070 XT).
  • Release build (--release) and retail titles (XCL_SAMPLE_* unset; no game folder locally).

AI use

  • Antigravity (Gemini 4 Hydrogen) wrote the tests and this PR description and ran the build, formatting check, clippy, and test suite on local hardware; all changes and tool outputs were verified before opening.

Add standalone GPU verification tests covering the 21 previously untested RDNA2 LDS instructions (DS_WRITE/READ_B64/B96/B128, DS_WRITE2/READ2_B64, DS_WRITE2ST64/READ2ST64_B32/B64, DS_WRITE_B8/B16_D16_HI, DS_READ_U8/I8/U16_D16/_HI, DS_NOP) plus DS_WRXCHG2_RTN_B32, DS_WRXCHG2ST64_RTN_B32, and 32-bit LDS atomics across all four wave modes.

Assisted-by: Antigravity (Gemini 4 Hydrogen)
@thehollowedone

Copy link
Copy Markdown

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 Ti and XCL_REQUIRE_GPU=1, cargo test --offline --locked -p xcl --test gpu_recomp_lds -- --test-threads=1 --nocapture reported 4 passed, 0 failed, 0 ignored, and no runtime skips. Tested commit 3eab39f

GPU 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.

@towiice towiice left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested PR head 3eab39f on 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), DXC v1.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_dxc
    • gpu_lds_d16_subdword_and_sign_extension
    • gpu_lds_wide_b64_b96_b128_and_addr_overlap
    • gpu_lds_dual_stride64_and_atomics

All multi-dword, d16, and dual LDS GPU tests pass on Turing.

@joeypercia

Copy link
Copy Markdown
Contributor

RDNA2 run (the PR has RDNA4 and an NVIDIA run): 3eab39f merged onto main 91f9a5e (clean merge).

Tested

  • AMD Radeon iGPU (Ryzen 7 7800X3D, RDNA2, 32–64 lanes, no mesh shaders), driver 26.11.2 (32.0.21045.29003); RTX 4070 Ti (616.56, 32 lanes); Windows 11 Pro 26200; Rust 1.100.0 MSVC; DXC 1.8.2502.11; debug
  • 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, no SKIPPED
  • cargo test --workspace --no-fail-fast -- --test-threads=4 on 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

  • RDNA1 / RDNA3; release build

Run and report by Claude Code (Claude Opus 5.5).

@akimfomin

akimfomin commented Nov 24, 2026 •

Copy link
Copy Markdown

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_HI probes 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 0xAB123456 and 0xDEADCDBE to adjacent LDS dwords, seeded the destination with 0xCAFE1357, and read at byte offset 3. The translated VIctory shader returned 0xBEAB1357 on 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.

@JJAutoCompare

Copy link
Copy Markdown

Empirical test report (3eab39f)

Independent Intel Arc A770 GPU verification of PR #544 at detached head 3eab39f8d43ea9d8422827fed53387c441ed2eff (clean worktree).

Hardware / environment

  • Intel Arc A770 Graphics (driver 32.0.101.9175), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation x64 build 26200.9974.
  • rustc 1.100.0 (0ef1bc386 2026-11-09) (x86_64-pc-windows-msvc), DXC 1.9.2609.5 (01b62ad47) + DXIL 1.9.2609.5, unoptimized Cargo test profile with debug info and incremental compilation disabled.

Commands and results

  • Located prebuilt integration test binary via cargo test -p xcl --tests --no-run --message-format=json outside the GPU lock.
  • Ran inside Invoke-ArcTest.ps1 with XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1:
    • gpu_recomp_lds.exe --nocapture --test-threads=1 (exit 0, 0.69s).
  • 4 passed, 0 failed, 0 ignored, 0 skipped.

Observed behavior

  • gpu_lds_d16_subdword_and_sign_extension, gpu_lds_dual_stride64_and_atomics, gpu_lds_wide_b64_b96_b128_and_addr_overlap, and lds_wide_dual_d16_translate_and_compile_with_dxc all passed on the Intel Arc A770 with DXC 1.9.2609.5.

Not tested

  • Full GPU workspace suite and game smoke runs were omitted.

AI use

Verified and published with T3 Code / Antigravity (gemini-4-neon).

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

off-goal Does not bear on the current goal (world loading); waits until it is reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants