Tests: 3-operand bitwise, shift, bitfield, and popcount ops on the GPU #703

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

@⁠lordon1a on GitHub · 2026-11-24 03:51 UTC · original
lordon1a:tests/gpu-bitwise-shift-bfm-ops → main · +80 −0 · 1 files · 1 commits · open

Adds a per-instruction GPU test (gpu_bitwise_shift_bfm_and_bcnt_ops) covering 11 RDNA2 integer bitwise, shift-add, bitfield, and popcount instructions that previously had no GPU test coverage: v_add_lshl_u32, v_lshl_or_b32, v_and_or_b32, v_or3_b32, v_xor3_b32, v_xad_u32, v_bfm_b32, v_bfi_b32, v_bcnt_u32_b32, v_xnor_b32, and v_ashrrev_i32, checked across 16 edge cases (shift/width counts mod 32 including 0, 1, 31, 32, 63; negative sign-bit fill; wrapping accumulation) against exact CPU bit arithmetic.

What is in it

  • crates/xcl/src/gpu/recomp/tests.rs: adds gpu_bitwise_shift_bfm_and_bcnt_ops (test-only; no runtime code changed).

Tested

  • Hardware: NVIDIA GeForce RTX 3070 Ti Laptop GPU (driver 616.64, wave32, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200), rustc 1.100.0 (x86_64-pc-windows-gnullvm), debug build, DXC 1.9.2609.5 (01b62ad4)
  • cargo test -p xcl --lib gpu_bitwise_shift_bfm_and_bcnt_ops -- --nocapture: 1 passed, 0 failed, 0 ignored (0.60s)
  • cargo test --workspace -- --test-threads=1: 702 passed, 0 failed, 41 ignored
  • SKIPPED GPU tests (expected on wave32-only NVIDIA hardware):
    • gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64
    • gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64

Not tested

  • AMD / wave64, Intel GPU, MSVC toolchain, retail title (test-only diff; no runtime code modified)

AI use

  • Antigravity (Google DeepMind agent) — wrote the test, ran the local GPU and workspace test suites, and opened this PR.
**@⁠lordon1a** on GitHub · 2026-11-24 03:51 UTC · [original](https://github.com/xcl-dev/xcl/pull/703) `lordon1a:tests/gpu-bitwise-shift-bfm-ops` → `main` · +80 −0 · 1 files · 1 commits · open Adds a per-instruction GPU test (`gpu_bitwise_shift_bfm_and_bcnt_ops`) covering 11 RDNA2 integer bitwise, shift-add, bitfield, and popcount instructions that previously had no GPU test coverage: `v_add_lshl_u32`, `v_lshl_or_b32`, `v_and_or_b32`, `v_or3_b32`, `v_xor3_b32`, `v_xad_u32`, `v_bfm_b32`, `v_bfi_b32`, `v_bcnt_u32_b32`, `v_xnor_b32`, and `v_ashrrev_i32`, checked across 16 edge cases (shift/width counts mod 32 including 0, 1, 31, 32, 63; negative sign-bit fill; wrapping accumulation) against exact CPU bit arithmetic. **What is in it** - `crates/xcl/src/gpu/recomp/tests.rs`: adds `gpu_bitwise_shift_bfm_and_bcnt_ops` (test-only; no runtime code changed). **Tested** - Hardware: NVIDIA GeForce RTX 3070 Ti Laptop GPU (driver `616.64`, wave32, SM 6.6), Intel i7-12700H, Windows 11 Home 26H2 (build 26200), `rustc 1.100.0` (`x86_64-pc-windows-gnullvm`), debug build, DXC `1.9.2609.5` (`01b62ad4`) - `cargo test -p xcl --lib gpu_bitwise_shift_bfm_and_bcnt_ops -- --nocapture`: **1 passed, 0 failed, 0 ignored** (`0.60s`) - `cargo test --workspace -- --test-threads=1`: **702 passed, 0 failed, 41 ignored** - `SKIPPED` GPU tests (expected on wave32-only NVIDIA hardware): - `gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64` - `gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64` **Not tested** - AMD / wave64, Intel GPU, MSVC toolchain, retail title (test-only diff; no runtime code modified) **AI use** - Antigravity (Google DeepMind agent) — wrote the test, ran the local GPU and workspace test suites, and opened this PR.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:29:58 +00:00
Author
Owner

@⁠lordon1a on GitHub · 2026-11-24 04:04 UTC · original

Thanks for catching the overlap with #545 and #445 @⁠joeypercia — my title search missed them. Happy to close or narrow this down to just \ _ashrrev_i32\ / \ _bcnt_u32_b32\ / \ _xnor_b32\ if those land first. (AI use: Antigravity)

**@⁠lordon1a** on GitHub · 2026-11-24 04:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/703#issuecomment-7121681862) Thanks for catching the overlap with #545 and #445 @⁠joeypercia — my title search missed them. Happy to close or narrow this down to just \ _ashrrev_i32\ / \ _bcnt_u32_b32\ / \ _xnor_b32\ if those land first. (AI use: Antigravity)
Author
Owner

@⁠mastrr9 on GitHub · 2026-11-24 04:05 UTC · original

Code audit + Windows MSVC / NVIDIA RTX 5080 GPU test run on f29597a271ba9de4a576aaa2b6a1f306836f9b78:

Review

  • CPU reference math for all 11 RDNA2 ops (v_add_lshl_u32, v_lshl_or_b32, v_and_or_b32, v_or3_b32, v_xor3_b32, v_xad_u32, v_bfm_b32, v_bfi_b32, v_bcnt_u32_b32, v_xnor_b32, v_ashrrev_i32) checks out, including shift-count masking mod 32 and v_bfm_b32 width-0 behavior.
  • (Small notes: this and #699 insert at the same line in tests.rs:7194, so whichever merges second will need a trivial rebase; also CONTRIBUTING.md asks to name the exact model in AI use, e.g. Antigravity (Gemini 4 Neon).)

Tested

  • Hardware / OS / toolchain: NVIDIA GeForce RTX 5080 (driver 617.42), AMD Ryzen 7 9800X3D, Windows 11 25H2 (build 26200.9711), rustc 1.100.0 (MSVC), debug build.
  • cargo build --workspace && cargo test --workspace -- --test-threads=4: 702 passed, 0 failed, 41 ignored.
  • New GPU test gpu::recomp::tests::gpu_bitwise_shift_bfm_and_bcnt_ops: passed on RTX 5080.
  • SKIPPED GPU/D3D12 tests: gpu_geometry_wave32_prefix_count_over_a_mask / gpu_wave32_program_in_wave64_hardware (no wave64), plus 2 D3D12 debug-layer tests (no d3d12SDKLayers.dll).

Not tested

  • AMD / wave64 / Intel GPUs; retail title (test-only PR).

AI use: code review and GPU test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above.

**@⁠mastrr9** on GitHub · 2026-11-24 04:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/703#issuecomment-7121701668) Code audit + Windows MSVC / NVIDIA RTX 5080 GPU test run on `f29597a271ba9de4a576aaa2b6a1f306836f9b78`: ### Review - CPU reference math for all 11 RDNA2 ops (`v_add_lshl_u32`, `v_lshl_or_b32`, `v_and_or_b32`, `v_or3_b32`, `v_xor3_b32`, `v_xad_u32`, `v_bfm_b32`, `v_bfi_b32`, `v_bcnt_u32_b32`, `v_xnor_b32`, `v_ashrrev_i32`) checks out, including shift-count masking mod 32 and `v_bfm_b32` width-0 behavior. - *(Small notes: this and #699 insert at the same line in `tests.rs:7194`, so whichever merges second will need a trivial rebase; also `CONTRIBUTING.md` asks to name the exact model in **AI use**, e.g. `Antigravity (Gemini 4 Neon)`.)* ### Tested - Hardware / OS / toolchain: NVIDIA GeForce RTX 5080 (driver 617.42), AMD Ryzen 7 9800X3D, Windows 11 25H2 (build 26200.9711), `rustc 1.100.0` (MSVC), debug build. - `cargo build --workspace && cargo test --workspace -- --test-threads=4`: **702 passed, 0 failed, 41 ignored**. - New GPU test `gpu::recomp::tests::gpu_bitwise_shift_bfm_and_bcnt_ops`: **passed on RTX 5080**. - `SKIPPED` GPU/D3D12 tests: `gpu_geometry_wave32_prefix_count_over_a_mask` / `gpu_wave32_program_in_wave64_hardware` (`no wave64`), plus 2 D3D12 debug-layer tests (`no d3d12SDKLayers.dll`). ### Not tested - AMD / wave64 / Intel GPUs; retail title (test-only PR). *AI use: code review and GPU test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above.*
Author
Owner

@⁠joeypercia on GitHub · 2026-11-24 04:03 UTC · original · edited 2026-11-24 04:05 UTC

Overlap note for review: this test covers all six instructions of #545 (open, earlier: v_add_lshl_u32, v_and_or_b32, v_lshl_or_b32, v_or3_b32, v_xad_u32, v_xor3_b32), and v_bfi_b32 / v_bfm_b32, which #445 covers. New here: v_ashrrev_i32, v_bcnt_u32_b32, v_xnor_b32. The overlapping parts may want to be folded into one PR.

(Found by comparing the V_* names each PR's test adds; not a test run.) Written with Claude Code (Claude Opus 5.5).

AMD run (the Not tested item): f29597a merged onto main f4ce27c (clean merge).

  • AMD Radeon iGPU (Ryzen 7 7800X3D, RDNA2, native wave64), driver 26.11.2 (32.0.21045.29003); RTX 4070 Ti (616.56, wave32); Windows 11 Pro 26200; Rust 1.100.0 MSVC; DXC 1.8.2502.11; debug
  • gpu_bitwise_shift_bfm_and_bcnt_ops: passes on the RDNA2 iGPU (native wave64; the split form on the RTX 4070 Ti) and on the RTX 4070 Ti; no SKIPPED
  • Not run: the full suite on this merge (the change only adds this test), release build

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

**@⁠joeypercia** on GitHub · 2026-11-24 04:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/703#issuecomment-7121660696) · edited 2026-11-24 04:05 UTC Overlap note for review: this test covers all six instructions of #545 (open, earlier: `v_add_lshl_u32`, `v_and_or_b32`, `v_lshl_or_b32`, `v_or3_b32`, `v_xad_u32`, `v_xor3_b32`), and `v_bfi_b32` / `v_bfm_b32`, which #445 covers. New here: `v_ashrrev_i32`, `v_bcnt_u32_b32`, `v_xnor_b32`. The overlapping parts may want to be folded into one PR. (Found by comparing the `V_*` names each PR's test adds; not a test run.) Written with Claude Code (Claude Opus 5.5). --- **AMD run** (the **Not tested** item): `f29597a` merged onto `main` `f4ce27c` (clean merge). - AMD Radeon iGPU (Ryzen 7 7800X3D, RDNA2, native wave64), driver 26.11.2 (32.0.21045.29003); RTX 4070 Ti (616.56, wave32); Windows 11 Pro 26200; Rust 1.100.0 MSVC; DXC 1.8.2502.11; debug - `gpu_bitwise_shift_bfm_and_bcnt_ops`: passes on the RDNA2 iGPU (native wave64; the split form on the RTX 4070 Ti) and on the RTX 4070 Ti; no `SKIPPED` - Not run: the full suite on this merge (the change only adds this test), release build Run and report by Claude Code (Claude Opus 5.5).
Author
Owner

@⁠joeypercia on GitHub · 2026-11-24 04:06 UTC · original

Thanks @⁠lordon1a. Same thought as on #699: narrowing now to v_ashrrev_i32 / v_bcnt_u32_b32 / v_xnor_b32 would let it merge independently of #545 and #445. Your call.

Written with Claude Code (Claude Opus 5.5).

**@⁠joeypercia** on GitHub · 2026-11-24 04:06 UTC · [original](https://github.com/xcl-dev/xcl/pull/703#issuecomment-7121711779) Thanks @⁠lordon1a. Same thought as on #699: narrowing now to `v_ashrrev_i32` / `v_bcnt_u32_b32` / `v_xnor_b32` would let it merge independently of #545 and #445. Your call. Written with Claude Code (Claude Opus 5.5).
Author
Owner

@⁠MesshM on GitHub · 2026-11-24 04:08 UTC · original

Test run of f29597a271ba9de4a576aaa2b6a1f306836f9b78 on AMD RDNA4. I merged it onto current main f4ce27c locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 702 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 661 passed, 0 failed, 21 ignored
  • 0 SKIPPED; the new GPU test passes in the suite.

Review: Test-only; its references follow the RDNA2 definitions I spot-checked (three-operand bitwise ops, shifts with the count's low bits, bitfield extract / insert, popcount).

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

**@⁠MesshM** on GitHub · 2026-11-24 04:08 UTC · [original](https://github.com/xcl-dev/xcl/pull/703#issuecomment-7121736279) Test run of `f29597a271ba9de4a576aaa2b6a1f306836f9b78` on AMD RDNA4. I merged it onto current `main` `f4ce27c` locally (clean merge) and tested that tree. **Tested** - AMD Radeon RX 9060 XT 16 GB (RDNA4, native wave64), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 `stable-x86_64-pc-windows-msvc`, debug - `cargo build --workspace` + `cargo test --workspace -- --test-threads=4` on the merge: **702 passed, 0 failed, 41 ignored**, exit code 0; `xcl` lib tests 661 passed, 0 failed, 21 ignored - **0 `SKIPPED`**; the new GPU test passes in the suite. **Review:** Test-only; its references follow the RDNA2 definitions I spot-checked (three-operand bitwise ops, shifts with the count's low bits, bitfield extract / insert, popcount). **Not tested:** no retail title or regression run (I have no unpacked game), no `XCL_SAMPLE_*` tests, release build; the PR's head on its old base was not run, only its merge onto `main`. Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Author
Owner

@⁠JJAutoCompare on GitHub · 2026-11-25 06:10 UTC · original

Empirical test report (f29597a2)

Verified f29597a271ba9de4a576aaa2b6a1f306836f9b78 from PR #703. The diff adds one unit-test fixture in crates/xcl/src/gpu/recomp/tests.rs.

Hardware / environment

  • Intel Arc A770 selected with XCL_ADAPTER=A770 on Windows x64, build 26200.
  • rustc 1.100.0 (0ef1bc386 2026-11-09). DXC reported 1.9.2609.5 (01b62ad47). The test log reports dxcompiler and dxil version 1.9.2609.5.
  • Cargo's unoptimized test profile ran with debug info and incremental compilation disabled.

Commands and results

  • cargo test -p xcl --lib --no-run exited 0 before acquiring the GPU lock. Cargo emitted one deprecation warning for AtomicU32::fetch_update in the XGameRuntime module.

  • With RUST_TEST_NOCAPTURE=1, ran the built binary under Invoke-ArcTest.ps1 using the exact filter. The wrapper acquired and released the Arc A770 lock.

    xcl-00e28da3621caf64.exe gpu::recomp::tests::gpu_bitwise_shift_bfm_and_bcnt_ops --exact --nocapture --test-threads=1
    
  • The focused run exited 0 in 0.22s. Libtest reported 1 passed, 0 failed, 0 ignored and 681 filtered out. A case-sensitive scan found 0 lines beginning with SKIPPED .

Observed behavior

The fixture compared GPU results for 11 instructions across 16 input tuples with exact CPU bit arithmetic. All 176 comparisons matched. The inputs exercise shift and width masking modulo 32, sign extension in arithmetic right shift, wrapping additions, bitfield mask and insert operations, and popcount accumulation.

Not tested

The full GPU workspace suite and game smoke runs were omitted. The focused fixture ran on the Arc A770.

AI use

Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr703-focused.log and published.

**@⁠JJAutoCompare** on GitHub · 2026-11-25 06:10 UTC · [original](https://github.com/xcl-dev/xcl/pull/703#issuecomment-7154521568) ### Empirical test report (f29597a2) Verified `f29597a271ba9de4a576aaa2b6a1f306836f9b78` from PR #703. The diff adds one unit-test fixture in `crates/xcl/src/gpu/recomp/tests.rs`. **Hardware / environment** - Intel Arc A770 selected with `XCL_ADAPTER=A770` on Windows x64, build 26200. - `rustc 1.100.0 (0ef1bc386 2026-11-09)`. DXC reported `1.9.2609.5 (01b62ad47)`. The test log reports dxcompiler and dxil version 1.9.2609.5. - Cargo's unoptimized test profile ran with debug info and incremental compilation disabled. **Commands and results** - `cargo test -p xcl --lib --no-run` exited 0 before acquiring the GPU lock. Cargo emitted one deprecation warning for `AtomicU32::fetch_update` in the XGameRuntime module. - With `RUST_TEST_NOCAPTURE=1`, ran the built binary under `Invoke-ArcTest.ps1` using the exact filter. The wrapper acquired and released the Arc A770 lock. ```text xcl-00e28da3621caf64.exe gpu::recomp::tests::gpu_bitwise_shift_bfm_and_bcnt_ops --exact --nocapture --test-threads=1 ``` - The focused run exited 0 in 0.22s. Libtest reported 1 passed, 0 failed, 0 ignored and 681 filtered out. A case-sensitive scan found 0 lines beginning with `SKIPPED `. **Observed behavior** The fixture compared GPU results for 11 instructions across 16 input tuples with exact CPU bit arithmetic. All 176 comparisons matched. The inputs exercise shift and width masking modulo 32, sign extension in arithmetic right shift, wrapping additions, bitfield mask and insert operations, and popcount accumulation. **Not tested** The full GPU workspace suite and game smoke runs were omitted. The focused fixture ran on the Arc A770. **AI use** Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr703-focused.log and published.
Author
Owner

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

Merge

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