Tests: verify VALU carry/borrow ops and V_MAD_U64_U32 on the GPU #519

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

@⁠Vadson159 on GitHub · 2026-11-24 01:13 UTC · original
Vadson159:test/recomp-carry-borrow → main · +700 −0 · 1 files · 1 commits · open

Add GPU verification tests for RDNA2 VALU carry/borrow arithmetic (V_ADD_CO_U32, V_SUB_CO_U32, V_SUBREV_CO_U32, V_ADD_CO_CI_U32, V_SUB_CO_CI_U32, V_SUBREV_CO_CI_U32) across both ENC_VOP2 and VOP3_SDST_ENC, plus V_MAD_U64_U32, verified against the AMD RDNA 2 ISA specification.

Tests only — no runtime code in crates/xcl/src is changed.

What is in it

  • crates/xcl/tests/gpu_recomp_carry_borrow.rs:
    • carry_borrow_translate_and_compile_with_dxc: verifies HLSL translation and DXC compilation across all four wave modes (wave64, split-wave64, wave32, wave32@hw64), including x64_masks emitting xcl_x_ballot_local( for lane-by-lane intermediate carry/borrow masks alongside xcl_x_ballot( for whole-live masks.
    • gpu_carry_borrow_single_ops_and_edge_cases: verifies per-lane results and SDST / VCC carry/borrow masks across boundary pairs, LCG operands, SGPR / inline -1 / 32-bit literal sources, and V_CNDMASK_B32 upper-half readback for wave32@hw64.
    • gpu_multiword_chains_in_place_and_divergent_exec: verifies 96-bit add, sub, and subrev carry/borrow chains, VDST == SRC0 and SDST == SRC2 in-place aliasing, and divergent EXEC mask preservation/clearing.
    • gpu_v_mad_u64_u32_carry_and_aliasing: verifies 64-bit V_MAD_U64_U32 results and SDST carry-out masks across wraparound boundaries, SGPR / inline -1 / literal operands, VDST == SRC2 aliasing, and divergent EXEC.

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): 680 passed, 0 failed, 41 ignored (0 GPU tests skipped; XCL_SAMPLE_* unset). Note: an initial run hit an unrelated pre-existing race in hle::d3d12x::cpu_writes::tests::writes_land_after_the_queue (passed 1/1 standalone and in the subsequent full run).
  • cargo test -p xcl --test gpu_recomp_carry_borrow: 4 passed, 0 failed, 0 ignored.
  • cargo clippy -p xcl --test gpu_recomp_carry_borrow: 0 warnings in crates/xcl/tests/gpu_recomp_carry_borrow.rs.
  • rustfmt --check crates/xcl/tests/gpu_recomp_carry_borrow.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, clippy, rustfmt, and test suite on local hardware; all changes and tool outputs were verified before opening.
**@⁠Vadson159** on GitHub · 2026-11-24 01:13 UTC · [original](https://github.com/xcl-dev/xcl/pull/519) `Vadson159:test/recomp-carry-borrow` → `main` · +700 −0 · 1 files · 1 commits · open Add GPU verification tests for RDNA2 VALU carry/borrow arithmetic (`V_ADD_CO_U32`, `V_SUB_CO_U32`, `V_SUBREV_CO_U32`, `V_ADD_CO_CI_U32`, `V_SUB_CO_CI_U32`, `V_SUBREV_CO_CI_U32`) across both `ENC_VOP2` and `VOP3_SDST_ENC`, plus `V_MAD_U64_U32`, verified against the AMD RDNA 2 ISA specification. Tests only — no runtime code in `crates/xcl/src` is changed. **What is in it** - `crates/xcl/tests/gpu_recomp_carry_borrow.rs`: - `carry_borrow_translate_and_compile_with_dxc`: verifies HLSL translation and DXC compilation across all four wave modes (`wave64`, `split-wave64`, `wave32`, `wave32@hw64`), including `x64_masks` emitting `xcl_x_ballot_local(` for lane-by-lane intermediate carry/borrow masks alongside `xcl_x_ballot(` for whole-live masks. - `gpu_carry_borrow_single_ops_and_edge_cases`: verifies per-lane results and `SDST` / `VCC` carry/borrow masks across boundary pairs, LCG operands, SGPR / inline `-1` / 32-bit literal sources, and `V_CNDMASK_B32` upper-half readback for `wave32@hw64`. - `gpu_multiword_chains_in_place_and_divergent_exec`: verifies 96-bit add, sub, and subrev carry/borrow chains, `VDST == SRC0` and `SDST == SRC2` in-place aliasing, and divergent `EXEC` mask preservation/clearing. - `gpu_v_mad_u64_u32_carry_and_aliasing`: verifies 64-bit `V_MAD_U64_U32` results and `SDST` carry-out masks across wraparound boundaries, SGPR / inline `-1` / literal operands, `VDST == SRC2` aliasing, and divergent `EXEC`. **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`): **680 passed, 0 failed, 41 ignored** (0 GPU tests skipped; `XCL_SAMPLE_*` unset). Note: an initial run hit an unrelated pre-existing race in `hle::d3d12x::cpu_writes::tests::writes_land_after_the_queue` (passed 1/1 standalone and in the subsequent full run). - `cargo test -p xcl --test gpu_recomp_carry_borrow`: 4 passed, 0 failed, 0 ignored. - `cargo clippy -p xcl --test gpu_recomp_carry_borrow`: 0 warnings in `crates/xcl/tests/gpu_recomp_carry_borrow.rs`. - `rustfmt --check crates/xcl/tests/gpu_recomp_carry_borrow.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, clippy, rustfmt, and test suite on local hardware; all changes and tool outputs were verified before opening.
Add GPU integration tests for RDNA2 carry/borrow arithmetic (V_ADD_CO_U32, V_SUB_CO_U32, V_SUBREV_CO_U32, V_ADD_CO_CI_U32, V_SUB_CO_CI_U32, V_SUBREV_CO_CI_U32) across VOP2 and VOP3_SDST_ENC, plus V_MAD_U64_U32.

Verifies 96-bit carry/borrow chains (including x64_masks half-local intermediate masks in split wave64), VDST/SDST aliasing, divergent EXEC, and wave64 / split-wave64 / wave32 / wave32@hw64 execution against an independent RDNA2 ISA CPU reference.

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

@⁠thehollowedone on GitHub · 2026-11-24 01:19 UTC · original

Tested

The focused integration suite passed on the RTX 3080 Ti in native wave32 and split-wave64 mode. GPU readback matched for the carry and borrow edge cases, multiword chains with divergent EXEC, and V_MAD_U64_U32 carry and aliasing. The separate translation test compiled all four wave configurations with DXC. Tested commit 40fc19d

Windows 11 build 26300, Ryzen 7 9800X3D, NVIDIA driver 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11, debug. cargo test --offline --locked -p xcl --test gpu_recomp_carry_borrow -- --test-threads=1 --nocapture reported 4 passed, 0 failed, 0 ignored, and no reported skips.

Not tested

Execution on native 64-lane hardware, the full workspace suite, and retail titles.

AI use

Codex with GPT-6.2 Sol ran the tests and drafted this report.

**@⁠thehollowedone** on GitHub · 2026-11-24 01:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/519#issuecomment-7118994092) **Tested** The focused integration suite passed on the RTX 3080 Ti in native wave32 and split-wave64 mode. GPU readback matched for the carry and borrow edge cases, multiword chains with divergent EXEC, and `V_MAD_U64_U32` carry and aliasing. The separate translation test compiled all four wave configurations with DXC. [Tested commit 40fc19d](https://github.com/ivall/xcl/commit/40fc19d046050f4e9a31d56ec2738138a0656b7c) Windows 11 build 26300, Ryzen 7 9800X3D, NVIDIA driver 621.35, Rust 1.99.1 MSVC, DXC 1.8.2502.11, debug. `cargo test --offline --locked -p xcl --test gpu_recomp_carry_borrow -- --test-threads=1 --nocapture` reported 4 passed, 0 failed, 0 ignored, and no reported skips. **Not tested** Execution on native 64-lane hardware, the full workspace suite, and retail titles. **AI use** Codex with GPT-6.2 Sol ran the tests and drafted this report.
Author
Owner

@⁠PHeitor1 on GitHub · 2026-11-24 01:26 UTC · original

Tested 40fc19d merged onto main 508a0c7.

RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X, Windows 11 Pro 26300 (native, Graphics Tools + XGameRuntime installed), rustc 1.100.0 MSVC, debug, cargo test --workspace --no-fail-fast -- --test-threads=4, no XCL_SAMPLE_*.

Pass: 684 passed, 0 failed, 41 ignored. SKIPPED: only the 2 no wave64 tests. The 3 tests in gpu_recomp_carry_borrow pass on native wave32: carry_borrow_translate_and_compile_with_dxc, gpu_carry_borrow_single_ops_and_edge_cases and gpu_v_mad_u64_u32_carry_and_aliasing.

Run and written with Claude Code (Claude Opus 5.5).

**@⁠PHeitor1** on GitHub · 2026-11-24 01:26 UTC · [original](https://github.com/xcl-dev/xcl/pull/519#issuecomment-7119100002) Tested `40fc19d` merged onto `main` `508a0c7`. RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X, Windows 11 Pro 26300 (native, Graphics Tools + XGameRuntime installed), rustc 1.100.0 MSVC, debug, `cargo test --workspace --no-fail-fast -- --test-threads=4`, no `XCL_SAMPLE_*`. **Pass:** 684 passed, 0 failed, 41 ignored. SKIPPED: only the 2 `no wave64` tests. The 3 tests in `gpu_recomp_carry_borrow` pass on native wave32: `carry_borrow_translate_and_compile_with_dxc`, `gpu_carry_borrow_single_ops_and_edge_cases` and `gpu_v_mad_u64_u32_carry_and_aliasing`. _Run and written with Claude Code (Claude Opus 5.5)._
Author
Owner

@⁠ghost on GitHub · 2026-11-24 01:32 UTC · original

RDNA4 pass, plus an RDNA2 data point: on a Steam Deck under Proton, the three GPU tests hang. That's the same as #478's GPU tests there.

RDNA4, native Windows: 40fc19d merged onto main 508a0c7 (clean merge). AMD Radeon RX 9060 XT (RDNA4), driver 32.0.32029.2010; Ryzen 7 5800X3D; Windows 11 Pro 26200; Rust 1.100.0 x86_64-pc-windows-msvc; DXC 1.9.2602.17; debug build.

  • .\scripts\test.ps1: 684 passed, 0 failed, 41 ignored.
  • XCL_REQUIRE_GPU=wave64,mesh cargo test -p xcl --test gpu_recomp_carry_borrow: 4 passed in 0.39 s.

RDNA2, Steam Deck (Van Gogh, RADV Mesa 26.2.0-devel), SteamOS 3.8.28: the same Windows test binary, run with Proton 11.0-2e's wine and vkd3d-proton (WINEDLLOVERRIDES=d3d12,d3d12core,dxgi=n, VKD3D_CONFIG=ignore_shared_fence), DXC 1.9.2602.17 via XCL_DXC_DIR, each test alone (--exact --test-threads=1):

  • carry_borrow_translate_and_compile_with_dxc: passes.
  • gpu_carry_borrow_single_ops_and_edge_cases, gpu_multiword_chains_in_place_and_divergent_exec, gpu_v_mad_u64_u32_carry_and_aliasing: each still running when killed at 75 s.

In the same setup, main's lib GPU tests (e.g. gpu_typed_buffer_loads_and_stores, gpu_dispatch_matches_native_wave64_reference) pass in under a second. This PR and #478 both run their GPU tests from a crates/xcl/tests/gpu_recomp_*.rs integration test, and both hang there. So it may be something about that path under vkd3d-proton rather than these instructions. I couldn't confirm it with main's own GPU integration test (gpu_compute_e2e): that one stops earlier on a vkd3d-proton assertion (iface->lpVtbl == &d3d12_fence_vtbl). RDNA2 through vkd3d-proton isn't native Windows, so take this as a lead, not a verdict.

AI use

  • Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.
**@⁠ghost** on GitHub · 2026-11-24 01:32 UTC · [original](https://github.com/xcl-dev/xcl/pull/519#issuecomment-7119206303) RDNA4 pass, plus an RDNA2 data point: on a Steam Deck under Proton, **the three GPU tests hang**. That's the same as #478's GPU tests there. **RDNA4, native Windows**: `40fc19d` merged onto `main` `508a0c7` (clean merge). AMD Radeon RX 9060 XT (RDNA4), driver 32.0.32029.2010; Ryzen 7 5800X3D; Windows 11 Pro 26200; Rust 1.100.0 `x86_64-pc-windows-msvc`; DXC 1.9.2602.17; debug build. - `.\scripts\test.ps1`: 684 passed, 0 failed, 41 ignored. - `XCL_REQUIRE_GPU=wave64,mesh cargo test -p xcl --test gpu_recomp_carry_borrow`: 4 passed in 0.39 s. **RDNA2, Steam Deck (Van Gogh, RADV Mesa 26.2.0-devel), SteamOS 3.8.28**: the same Windows test binary, run with Proton 11.0-2e's `wine` and vkd3d-proton (`WINEDLLOVERRIDES=d3d12,d3d12core,dxgi=n`, `VKD3D_CONFIG=ignore_shared_fence`), DXC 1.9.2602.17 via `XCL_DXC_DIR`, each test alone (`--exact --test-threads=1`): - `carry_borrow_translate_and_compile_with_dxc`: passes. - `gpu_carry_borrow_single_ops_and_edge_cases`, `gpu_multiword_chains_in_place_and_divergent_exec`, `gpu_v_mad_u64_u32_carry_and_aliasing`: each still running when killed at 75 s. In the same setup, `main`'s lib GPU tests (e.g. `gpu_typed_buffer_loads_and_stores`, `gpu_dispatch_matches_native_wave64_reference`) pass in under a second. This PR and #478 both run their GPU tests from a `crates/xcl/tests/gpu_recomp_*.rs` integration test, and both hang there. So it may be something about that path under vkd3d-proton rather than these instructions. I couldn't confirm it with `main`'s own GPU integration test (`gpu_compute_e2e`): that one stops earlier on a vkd3d-proton assertion (`iface->lpVtbl == &d3d12_fence_vtbl`). RDNA2 through vkd3d-proton isn't native Windows, so take this as a lead, not a verdict. **AI use** - Claude Code (Claude Opus 5.5) ran the commands and wrote this report from the logs; I checked it before posting.
Author
Owner

@⁠ghost on GitHub · 2026-11-24 01:58 UTC · original

Follow-up: joeypercia's native-Windows RDNA2 run on #478 passes, so the Steam Deck hang above is the Proton / vkd3d-proton path, not RDNA2 or this PR. This PR's RDNA4 pass stands. The Deck result only matters for running under Proton/Wine.

AI use

  • Claude Code (Claude Opus 5.5) wrote this note; I checked it before posting.
**@⁠ghost** on GitHub · 2026-11-24 01:58 UTC · [original](https://github.com/xcl-dev/xcl/pull/519#issuecomment-7119638354) Follow-up: joeypercia's native-Windows RDNA2 run on #478 passes, so the Steam Deck hang above is the Proton / vkd3d-proton path, not RDNA2 or this PR. This PR's RDNA4 pass stands. The Deck result only matters for running under Proton/Wine. **AI use** - Claude Code (Claude Opus 5.5) wrote this note; I checked it before posting.
Author
Owner

@⁠ghost on GitHub · 2026-11-24 06:00 UTC · original

Correction to my Steam Deck result above: the hangs came from how I launched the tests over SSH, not from Proton, vkd3d-proton or this PR. With an X display the three GPU tests pass on the Deck.

Tested (head 40fc19d, the same Windows test binary setup as above: Proton 11.0 wine, vkd3d-proton, each test alone with --exact --test-threads=1, 75 s timeout)

  • Without DISPLAY and XAUTHORITY, as in my earlier runs: gpu_carry_borrow_single_ops_and_edge_cases, gpu_multiword_chains_in_place_and_divergent_exec and gpu_v_mad_u64_u32_carry_and_aliasing hang, 5 of 5 runs.
  • With DISPLAY=:0 and the desktop session's XAUTHORITY: all three pass, in 0.83–0.94 s. DISPLAY alone or XDG_RUNTIME_DIR alone still hangs.

Not tested

  • Why main's lib GPU tests passed without a display in my earlier runs while these integration tests hang. I don't know what differs.

So the RDNA2-under-Proton data point for this PR is a pass. The same applies to #478 (note there).

AI use

  • Claude Code (Claude Opus 5.5) ran the commands and wrote this correction from the logs; I checked it before posting.
**@⁠ghost** on GitHub · 2026-11-24 06:00 UTC · [original](https://github.com/xcl-dev/xcl/pull/519#issuecomment-7123476022) Correction to my Steam Deck result above: the hangs came from how I launched the tests over SSH, not from Proton, vkd3d-proton or this PR. With an X display the three GPU tests pass on the Deck. **Tested** (head `40fc19d`, the same Windows test binary setup as above: Proton 11.0 `wine`, vkd3d-proton, each test alone with `--exact --test-threads=1`, 75 s timeout) - Without `DISPLAY` and `XAUTHORITY`, as in my earlier runs: `gpu_carry_borrow_single_ops_and_edge_cases`, `gpu_multiword_chains_in_place_and_divergent_exec` and `gpu_v_mad_u64_u32_carry_and_aliasing` hang, 5 of 5 runs. - With `DISPLAY=:0` and the desktop session's `XAUTHORITY`: all three **pass**, in 0.83–0.94 s. `DISPLAY` alone or `XDG_RUNTIME_DIR` alone still hangs. **Not tested** - Why `main`'s lib GPU tests passed without a display in my earlier runs while these integration tests hang. I don't know what differs. So the RDNA2-under-Proton data point for this PR is a pass. The same applies to #478 (note there). **AI use** - Claude Code (Claude Opus 5.5) ran the commands and wrote this correction from the logs; I checked it before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 13:53 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 13:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/519#issuecomment-7164443700) 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/519/head:github-bot/gh-519'
git switch 'github-bot/gh-519'

Merge

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