Skip to content

Tests: VOP1 bit scans, bit reversal and not on the GPU - #736

Open
marquezinii wants to merge 1 commit into
xcl-dev:mainfrom
marquezinii:tests/vop1-bit-scans
Open

marquezinii wants to merge 1 commit into
xcl-dev:mainfrom
marquezinii:tests/vop1-bit-scans

Conversation

@marquezinii

Copy link
Copy Markdown
Contributor

v_ffbh_u32, v_ffbl_b32, v_ffbh_i32, v_bfrev_b32 and v_not_b32 are translated by emit.rs but no test runs them, and no open PR covers them (#445, #638, #703 and #699 take the other untested integer ops). This adds one GPU test for the five. Test only: nothing outside tests.rs changes.

What is in it

  • gpu_vop1_bit_scans_and_reverse (crates/xcl/src/gpu/recomp/tests.rs): one kernel run through gpu_waves. Inputs are 20 edge words (0, 1, -1, -2, the sign bit alone and with bit 0, 0x7FFFFFFF, 0xBFFFFFFF, 0xC0000000, …) followed by LCG words, half of them with their low bits cleared so the scans from the bottom see long zero runs. Each result is compared with the ISA pseudo-code written as the loops it describes, not the closed forms emit.rs uses. Besides VGPR sources it covers an SGPR source, the inline constant 0 and a literal.

Tested

  • NVIDIA GeForce RTX 5070 (wave32 only), driver 621.24; Windows 11 Pro 26300; rustc 1.99.1 stable-x86_64-pc-windows-msvc, debug; DXC 1.9.2602.17 (Windows SDK 10.0.26100.0)
  • cargo test --workspace -- --test-threads=1 on this branch: 702 passed, 0 failed, 41 ignored
  • cargo test --workspace -- --test-threads=4: the first run on main f4ce27c was 701 passed, 0 failed, 41 ignored. After that, every run of the same command failed 3 tests, with this branch and with main alike: placed_title_textures_share_vram_and_preserve_pixels ("cubemap extra_pages must be reused at same va"), then transitions_apply_when_their_list_is_submitted and d32s8_targets_take_their_own_size_of_video_memory on the poisoned lock it leaves. They pass alone and single-threaded. This looks like the interaction in Tests: gpu_sparse_vram_descriptors_buffers_and_xmem fails beside the title-texture tests since #288 #343 / Tests: check cubemap tile reuse independently of idle page reclamation #447, not this change.
  • SKIPPED GPU tests: gpu_geometry_wave32_prefix_count_over_a_mask and gpu_wave32_program_in_wave64_hardware (no wave64)
  • The test fails when the emitter is broken. With each of these edits made to emit.rs by hand (and reverted) it reported wrong results: v_ffbh_u32 without its zero case (33), ffbh_i without the sign inversion (48), v_bfrev_b32 as a plain move (61). Removing the zero case of v_ffbl_b32 does not fail it, because HLSL's firstbitlow(0) is already 0xFFFFFFFF.

Regression run
Not needed: the PR changes only crates/xcl/src/gpu/recomp/tests.rs.

Not tested

  • AMD / Intel GPUs and the wave64 run: the RTX 5070 has 32-lane waves only, so gpu_waves ran the kernel as wave32
  • VOP3 forms and operand modifiers: all five are VOP1 here

AI use

  • Claude Code (Claude Opus 5.5) wrote the test and this description, and ran the tests and the emitter-break checks on the machine above.

v_ffbh_u32, v_ffbl_b32, v_ffbh_i32, v_bfrev_b32 and v_not_b32 are
translated but no test ran them. The new test compares each with the
ISA's pseudo-code (the loops, not the closed forms emit.rs uses) on 20
edge words and LCG words, as wave64 and wave32, with VGPR, SGPR,
inline-constant and literal sources.
@MesshM

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

Test run of 490d605cf249e5097cb27daff72987b491a95180 on AMD RDNA4. I merged it onto current main 64b3f35 locally (clean merge) and tested that tree.

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), 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; gpu_vop1_bit_scans_and_reverse passes, as wave64 and wave32 (both native here).

Review: The references match the ISA: the bit scans return −1 (0xFFFFFFFF) for 0, v_ffbh_i32 also for −1, and v_bfrev_b32 / v_not_b32 are plain bit operations. I found nothing to change.

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.

@ItsMrDubey

Copy link
Copy Markdown

Test report for 490d605cf249e5097cb27daff72987b491a95180 (this PR's head)

Tested

  • NVIDIA GeForce RTX 4070 Ti 12 GB (Ada), driver 617.14; Intel Core i9-10900K, 32 GB RAM; Windows 11 Pro build 26300
  • Rust 1.88.0 (stable-x86_64-pc-windows-msvc), debug; DXC 1.9.2602.17 from Windows SDK 10.0.26100
cargo build --workspace
cargo test --workspace --no-fail-fast -- --test-threads=4

17 test binaries: 701 passed, 1 failed, 41 ignored. Same machine, main 64b3f3559: 700 passed, 1 failed, 41 ignored.

This PR's tests:

  • gpu::recomp::tests::gpu_vop1_bit_scans_and_reverse: ok

Failures:

SKIPPED (no wave64 on this GPU): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.

AI use: Claude Code (Claude Opus 5.5) ran the builds and tests and wrote this report from their output.

@JJAutoCompare

Copy link
Copy Markdown

Empirical test report (490d605)

PR #736, commit 490d605cf249e5097cb27daff72987b491a95180.

Hardware / environment

  • Intel Arc A770 selected with XCL_ADAPTER=A770. Windows x64 build 26200, AMD64 Family 23 Model 113 Stepping 0. GPU driver version was not recorded.
  • rustc 1.100.0 (0ef1bc386 2026-11-09), host x86_64-pc-windows-msvc. DXC and DXIL 1.9.2609.5 (DXC commit 01b62ad4). Cargo test profile unoptimized, with debug info and incremental compilation disabled.

Commands and results

  • cargo test -p xcl --lib --no-run completed outside the GPU lock (exit 0).
  • xcl-00e28da3621caf64.exe gpu::recomp::tests::gpu_vop1_bit_scans_and_reverse --exact --nocapture --test-threads=1 ran inside Invoke-ArcTest.ps1 with RUST_TEST_NOCAPTURE=1 (exit 0).
  • 1 passed, 0 failed, 0 ignored, 0 skipped, 681 filtered out. Libtest reported 0.17s for the focused run.

Observed behavior

  • The fixture finished after loading DXC. Its per-lane GPU readback assertions passed for v_ffbh_u32, v_ffbl_b32, v_ffbh_i32, v_bfrev_b32, and v_not_b32.
  • The fixture checks vector-register inputs drawn from 20 edge words and deterministic generated words. It also checks selected operations with a scalar register, inline zero, and a literal. The code always runs the wave32 program when the GPU and DXC are ready, and adds a wave64 case if the adapter reports support. The log has no per-wave result.

Not tested

The full GPU workspace suite and game smoke runs were omitted. This report covers one fixture on one adapter.

AI use

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

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

6 participants