Recompiler tests: GPU checks for VOP3 bit-field, perm, align and min3/max3/med3 #440
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/445"
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 AC-Storm-YT on 2026-11-24T00:22:56Z.
Eleven 32-bit VOP3 integer instructions the recompiler translates had no test:
v_bfi_b32,v_bfm_b32,v_perm_b32,v_alignbit_b32,v_alignbyte_b32andv_min3/v_max3/v_med3foru32andi32. This adds one GPU test for them. Test only: nothing outsidetests.rschanges.What is in it
gpu_vop3_integer_bit_and_minmax3(crates/xcl/src/gpu/recomp/tests.rs): one kernel with all eleven instructions, run as wave64 and wave32 (gpu_waves), 32 dispatches of operand triples from a fixed LCG – edge values (0, 1, 31, 32, 33,0x7FFFFFFF,0x80000000,0xFFFFFFFF, everyv_perm_b32selector kind: bytes 0..7, the sign selectors 8..11, 12 and 13+) mixed with arbitrary words. Each result is compared bit for bit with the instruction's RDNA2 definition computed on the CPU (not with the emitted HLSL).Tested
stable-x86_64-pc-windows-msvc, debug; DXC 1.8.2502.11cargo test --workspace -- --test-threads=4on this branch's head: 677 passed, 0 failed, 41 ignored. No SKIPPED tests.emit.rsby hand (and reverted), it reported wrong results for that instruction –v_med3_i32compared unsigned (1407 results),v_perm_b32selector 8 readings0(37),v_alignbyte_b32shifting by 4 bits a byte (1215),v_bfm_b32with the wrong zero-width case (488),v_max3_u32ignoringsrc2(629).Regression run
Not needed: the PR changes only
crates/xcl/src/gpu/recomp/tests.rs.Not tested
AI use
Imported from ivall/xcl. Originally posted by PHeitor1 on 2026-11-24T00:44:27Z.
Tested
77eab20merged ontomain2997c9a.RTX 5060 Ti 8 GB (Blackwell, 32-lane waves), NVIDIA 621.24, Ryzen 5 5600X, Windows 11 Pro 26300 (native, Graphics Tools + XGameRuntime installed, so the debug-layer tests run), rustc 1.100.0 MSVC, debug,
cargo test --workspace --no-fail-fast -- --test-threads=4, noXCL_SAMPLE_*.Pass: 677 passed, 0 failed, 41 ignored. SKIPPED: only the 2
no wave64tests (gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware).gpu_vop3_integer_bit_and_minmax3runs on the GPU and passes. Build clean.Run and written with Claude Code (Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by CryingLaughing on 2026-11-24T01:01:03Z.
The exact PR head
77eab20adfdb2472c77a747db16c3e9e6e7fabb4passed on an RTX 4080. This adds Ada wave32 coverage alongside the RDNA4 and Blackwell runs above.Tested
XCL_ADAPTER=4080, synthetic fixtures, allXCL_SAMPLE_*variables unset.cargo test -p xcl --lib --locked -j 4 gpu_vop3_integer_bit_and_minmax3 -- --show-outputpassed 1/1 on native wave32. The fixture checks 11 instructions across 32 waves of 32 lane inputs against Rust results.cargo build --workspace --locked -j 4passed.cargo test --workspace --locked -j 4 -- --test-threads=4 --show-outputreported 677 passed, 0 failed, 41 ignored. That includes four explicit capability skips and opt-in game-data tests that returned early.SKIPPEDfor native wave64:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware.SKIPPEDfor D3D12 debug-layer availability:test_title_draws_with_a_root_signature_under_the_debug_layeranduploads_start_from_each_subresources_state.Not tested
AI use
Imported from ivall/xcl. Originally posted by 13hourstilliland on 2026-11-24T01:35:03Z.
Adding an Ampere 8 GB (RTX 3070, 32-lane waves) run on the exact PR head
77eab20.Tested
77eab20adfdb2472c77a747db16c3e9e6e7fabb4(PR #445 head), clean worktreestable-x86_64-pc-windows-gnu, not MSVC); DXC 1.9.2609.5 (01b62ad4) viaXCL_DXC_DIR; debug build; noXCL_SAMPLE_*setcargo test -p xcl --lib -- gpu_vop3_integer_bit_and_minmax3 --show-outputcargo test --workspace --no-fail-fast -- --test-threads=4 --show-output(interactive desktop session)xcllib: 637 passed, 0 failed, 21 ignored;e2e: 3/0)SKIPPED(4, not coverage):no wave64(2):gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask,gpu::recomp::tests::gpu_wave32_program_in_wave64_hardwareno D3D12 debug layer(2):test_title_draws_with_a_root_signature_under_the_debug_layer,uploads_start_from_each_subresources_stateNot tested
scripts/smoke.ps1, D3D12 debug-layer testsAI use
gemini-4-neon: ran the commands and wrote this report from the logs; the human reviewed it.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T14:15:41Z.
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 github-actions[bot] on 2026-11-28T20:17:34Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by AC-Storm-YT on 2026-11-29T20:54:46Z.
Rebased onto main. It still adds GPU tests for v_bfi_b32, v_bfm_b32, v_perm_b32, v_alignbit_b32, v_alignbyte_b32 and v_min3/v_max3/v_med3 (u32 and i32), which are translated but had no test; it only waits for a maintainer.
Imported from ivall/xcl. Originally posted by relativespace2K on 2026-11-30T03:16:51Z.
merge-check
base:
53e85fb1head:
ccd516e14bmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2789 passed, 6 failed, 49 ignored; failing: gpu::dxil::compact_tests::gpu_compact_form_with_micro_blocks_and_literal_table_runs_as_the_plain_form, gpu::recomp::pso::shader_cache_tests::console_mesh_caches_hlsl_compute_pass_in_memory_and_on_disk, hle::d3d12x::standin::tests::concurrent_shell_miss_reuses_winner_and_releases_loser_pipeline, ram_budget::tests::windows_takes_a_working_set_maximum_and_lifts_it, and two_pass_driver_cache_reuses_both_passes_and_recovers_corrupt_blobs (in
--test gpu_two_pass_cache_e2e, so 5 failing tests give 6 failures). The same five fail on base53e85fb1alone (2788 passed, 6 failed, 49 ignored there), so none comes from this PR; its new GPU test passed and is not among the SKIPPED lines, so it ran on the RX 6800 XT in both wave sizes. 13 SKIPPED lines, all environmental: no D3D12 debug layer / d3d12SDKLayers.dll, no heap windows, no GPU_UPLOAD, per-lane f16/f32 forms refused.review: no blocking finding; one file, every line read. The references are computed on the CPU from the ISA's definitions and not from the translator:
v_perm_b32's selector decode covers bytes 0..7, the 16- and 32-bit sign replicas (8..11), the zero byte (12) and the all-ones byte (13 and above); the funnel shift builds the 64-bit pair the same way;med3is the ordinary median written asmax(a,b).min(min(a,b).max(c)), which is the definition and not a guess. The operand mix deliberately reaches the sign bit, shift counts of 0, 31 and past 31, and it runs over every lane of a wave in both wave32 and wave64, with the failures de-duplicated so the message names one bad triple per case. No duplicate: #1057, #1206 and #1576 cover neighbouring instruction groups; none of them runs these eleven.performance: none: tests only.
verdict: safe to merge
hardware / tool and model: AMD Radeon RX 6800 XT 16 GB (RDNA2, wave64), driver 32.0.21045.29003; Ryzen 5 5600, 32 GB RAM; Windows 10 IoT Enterprise LTSC 2024, 10.0.26100 build 26100.9974; Rust 1.100.0; DXC 1.9.2602.17; debug build. DeepSeek Harness coding agent, model DeepSeek V4.1 Flash.
Imported from ivall/xcl. Originally posted by tiagonleal on 2026-11-30T09:23:09Z.
merge-check
base:
9dfbe3ea66head:
ccd516e14bmerge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -j 8 -- --test-threads=4 -> 2886 passed, 1 failed, 51 ignored; SKIPPED: 24 lines, the same as on the base; failing:
gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails the same way on the base alone (2885 passed, 1 failed, 51 ignored; fixed by #3513). The new testgpu::recomp::tests::gpu_vop3_integer_bit_and_minmax3runs on this card as wave32 only (no wave64 here) and passes, in the suite, alone, and alone withXCL_DIRECT_DXIL=0(HLSL path). It really compares GPU results here: with the expected V_BFI_B32 value changed on purpose, it fails with lines such asV_BFI_B32(0x00000000, 0x00000000, 0x0000001f) = 0x0000001f, want 0x0000001e.review: whole diff read (+88/-0,
gpu/recomp/tests.rs). I checked each expected value against the RDNA2 definitions. V_BFI_B32 is (S0 & S1) | (~S0 & S2). V_BFM_B32 is ((1 << S0[4:0]) - 1) << S1[4:0]. V_PERM_B32 takes the bytes of {S0, S1} with S1 low; selectors 8 to 11 give the sign of S1[15], S1[31], S0[15] and S0[31]; 12 gives 0x00 and 13 and above give 0xFF. V_ALIGNBIT_B32 is {S0, S1} >> S2[4:0] and V_ALIGNBYTE_B32 is {S0, S1} >> 8 * S2[1:0]. The med3 helper takes the min of max(a, b) and max(min(a, b), c), which is the median. The signed variants work on sign-extended values. All of them match. Without a GPU,gpu_waves()returns an empty list and the test passes without aSKIPPEDline. Partial overlap only:integer_programs_on_the_gpu(gpu/recomp/lower.rs, the program at about lines 3084-3097 on this base) already runs V_BFI, V_BFM, V_ALIGNBIT, V_ALIGNBYTE, V_MIN3_U32, V_MAX3_I32 and both V_MED3 on one operand set. V_PERM_B32, V_MAX3_U32 and V_MIN3_I32, and the edge operands (sign bit, shift counts 0, 31 and above 31, every perm selector kind), are new here.performance: test-only change; no smoke run.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB (617.42, wave32), Ryzen 7 9800X3D, 32 GB, Windows 11 26300, rustc 1.100.0 / Claude Code (Claude Opus 5.5 ran the build, suite and test runs, checked the expected values against the ISA and the merged source and wrote this)
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T03:08:39Z.
Triage (#1607) – head
ccd516eOverlaps with other test-only PRs in
gpu/recomp/tests.rs: #1576 also checks all 11 of these ops (plus ffbh/bcnt/SAD/LERP/16-bit min3) on fixed inputs; #1057 (alignbit/alignbyte/perm), #1226 (bfi/bfm/perm and bit scans) and #1199 (min3/max3/med3 i32/u32/i16) cover subsets. None of them makes this exact change, and this one is the earliest and the only one that runs randomized edge operands on both wave sizes.The CPU references in
check_vop3_integer_bit_and_minmax3match the RDNA2 definitions (v_perm_b32 selectors 8-11 take bits 15/31 of S1 then S0, 12 is 0x00, 13+ is 0xFF; bfm/alignbit mask the counts to 5 bits, alignbyte to 2). No problems found in the diff.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.