Recompiler tests: GPU checks for v_max3_u16, v_min3_u16 and v_med3_u16 #733
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/738"
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 13hourstilliland on 2026-11-24T04:21:35Z.
Adds a GPU test for three RDNA2 instructions that
emit.rstranslates but no test runs:v_max3_u16,v_min3_u16andv_med3_u16. Test only, no runtime change.What is in it
gpu_valu_16_bit_unsigned_min3_max3_med3incrates/xcl/src/gpu/recomp/tests.rs, aftergpu_grouped_loads_bounds_and_inactive_lanes(away from the lines open PRs add to): one kernel with all 3 instructions, run as wave64 where the adapter has it and as wave32 everywhere (gpu_waves), 32 rounds of operands per lane: u16 edges (0, 1, 2, 0x00F1, 0x7FFE, 0x7FFF, 0x8000, 0x8001, 0xFFFE, 0xFFFF) and random halves, always with non-zero bits in each source's high half, each lane compared with the RDNA2 definition computed on the CPU (sort the three low halves). Only the low 16 bits of the result are compared: the AMD machine-readable RDNA2 spec (VOP3OP_SELfield) saysop_sel[3] = 0zeroes the high half, while LLVM'sGCNSubtarget::zeroesHigh16BitsOfDestsays gfx10 preserves it, so the high half is left unchecked.91f9a5e(the base of this branch): with the reference changed (reference withv_med3_u16returning the minimum:wave32, 984 wrong (V_MED3_U16: 984), no other instruction) the test fails; with max3 with the inner op as min, min3 with the inner op as max, and med3 with the third operand replaced by the second applied toemit.rsall at once it fails and names every instruction (wave32, 1940 wrong (V_MAX3_U16: 659, V_MIN3_U16: 635, V_MED3_U16: 646), 635 to 659 wrong per instruction). Those edits are not in the PR.Tested
stable-x86_64-pc-windows-gnu(MinGW linker), DXC 1.9.2609.5, debug build, commit3f812638b5(on main91f9a5e9f0)cargo test --workspace --no-fail-fast -- --test-threads=4, run in the interactive desktop session: 693 passed, 0 failed, 41 ignored (lib: 653 passed, 0 failed, 21 ignored;e2e3 of 3;gpu_valu_16_bit_unsigned_min3_max3_med3ok).main91f9a5e9f0on the same machine: 692 passed, 0 failed, 41 ignored (lib: 652 passed, 0 failed, 21 ignored)SKIPPED(no wave64 on this GPU):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardwareNot tested
stable-x86_64-pc-windows-msvc): built with the GNU toolchain only.crates/xcl/srcruntime file changes).AI use
Imported from ivall/xcl. Originally posted by MesshM on 2026-11-24T04:39:53Z.
Test run of
3f812638b55811d96d57047b6629d699828aab15on AMD RDNA4. I merged it onto currentmain64b3f35locally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 702 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 661 passed, 0 failed, 21 ignoredSKIPPED;gpu_valu_16_bit_unsigned_min3_max3_med3passes.Review: med3 is the middle of the three sorted values and only D[15:0] is compared, as the ISA defines. Overlap: #638's description says #445 has the 16-bit min3 / max3 / med3; if #445 covers the unsigned forms too, one of the two is enough.
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 ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T04:46:49Z.
An NVIDIA run, since the report above is on RDNA4 (native wave64). Tested exact head
3f81263(on its base91f9a5e).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4: 693 passed, 0 failed, 41 ignored. SKIPPED (no wave64):gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware.gpu::recomp::tests::gpu_valu_16_bit_unsigned_min3_max3_med3 ... ok.Not tested
AI use
Imported from ivall/xcl. Originally posted by ItsMrDubey on 2026-11-24T04:57:23Z.
Test report for
3f812638b55811d96d57047b6629d699828aab15(this PR's head)Tested
stable-x86_64-pc-windows-msvc), debug; DXC 1.9.2602.17 from Windows SDK 10.0.2610016 test binaries: 692 passed, 1 failed, 41 ignored. Same machine,
main64b3f3559: 700 passed, 1 failed, 41 ignored.This PR's tests:
gpu::recomp::tests::gpu_valu_16_bit_unsigned_min3_max3_med3: okFailures:
hle::kernelx::tests::xmem_virtual_query_marks_cpu_readable_memoryfails on this machine on every run, on this PR's head and onmain64b3f3559alike (5 of 5 reruns onmain), so it is not from this PR. #650 fixes it here.16 test binaries instead of
main's 17 because this branch predatestests/sparse_reinit.rs; nothing crashed.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.
Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-24T05:59:36Z.
Native RDNA2 check of the untouched destination half
The PR description notes the ambiguity over the upper 16 bits. On the RX 6800M (
gfx1031), nativev_min3_u16,v_max3_u16andv_med3_u16all preserved the untouched destination half.Tested
30.0.13002.13003, AMD OpenCL3302.6 (PAL,LC).0xA55AC33C. It wrote the low half with defaultop_sel, and a separate instruction wrote the high half withop_sel:[0,0,0,1]. The three source low halves supplied the u16 operands. Their high halves were nonzero.0xA55Afor low writes and0xC33Cfor high writes. Four work-items per case agreed.For inputs
0x0000,0xFFFFand0x7FF8, the native median results were0xA55A7FF8for the default write and0x7FF8C33Cfor the high-half write.Not tested
The PR's translated GPU test and other GPU generations. This measures the three native RDNA2 instructions.
AI use
OpenAI Codex (GPT-6 family, exact model variant unavailable) wrote and ran the probe and drafted this report.
upstream-sync referenced this pull request2026-11-24 19:06:45 +00:00
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T06:03:13Z.
Empirical test report (
3f812638)Verified PR #738 at
3f812638b55811d96d57047b6629d699828aab15.Hardware / environment
XCL_ADAPTER=A770. Windows build 26200 on x64 (AuthenticAMD family 23, model 113).rustc 1.100.0 (0ef1bc386 2026-11-09), Cargo unoptimized test profile with debug info and incremental compilation disabled.dxc.exe --versionreported DXC 1.9.2609.5 (01b62ad47). The fixture logged dxcompiler and dxil 1.9.2609.5 at runtime.Commands and results
cargo test -p xcl --lib --no-runexited 0 outside the GPU lock.Ran the emitted library test executable (
$testExe) underInvoke-ArcTest.ps1withXCL_ADAPTER=A770andRUST_TEST_NOCAPTURE=1:Exit code 0. The captured libtest summary showed 1 passed, 0 failed, 0 ignored, with 673 filtered out and 0.73 s elapsed. The log contained 0
SKIPPEDmarkers.Observed behavior
The GPU fixture compared the low 16 bits from
v_max3_u16,v_min3_u16, andv_med3_u16against a Rust reference that sorts the three unsigned inputs. It completed 32 rounds per wave mode selected by the fixture with no mismatches. Inputs included boundary and pseudorandom values with nonzero upper halves. The passing fixture did not log the selected wave modes.Not tested
The full GPU workspace suite and game smoke runs were omitted. This fixture checks only the low 16 bits of each destination.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr738-focused.logand published.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T11:29:35Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: 1038 passed, 1 failed in one parallel run; the failing test passes on a single-threaded rerun (1039/0). 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:18:41Z.
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 brainhay5 on 2026-11-30T08:11:25Z.
merge-check claim
head:
3f812638b5Imported from ivall/xcl. Originally posted by brainhay5 on 2026-11-30T08:19:43Z.
merge-check
base:
d52ff48caahead:
3f812638b5merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2876 passed, 2 failed, 51 ignored; 29 SKIPPED lines
failing: test_title_runs_and_game_folder_is_untouched
review: automated overnight check — diff inspected for safety only (no build/CI/toolchain/script changes, no process/network/runtime-loading code); no duplicate search performed; no line-by-line code review.
performance: not assessed beyond the suite.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 610.88 (32.0.16.1088); Ryzen 7 5800X3D, 64 GB; Windows 11 22631; OpenCode agent, DeepSeek V4.1 Flash 1017
correction: this check first reported the PR as "not yet" because of a test failure that is not the PR's. The base-comparison step failed to run (test names contain a double colon, not a legal Windows filename), so an empty read was mistaken for "passes on base".
gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16fails on based52ff48cby itself (verified separately with the same command: "assertion failed: 2D D16 resinfo clobbered v2/v3"). Verdict corrected. Apologies for the noise.Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T09:53:48Z.
merge-check claim
head:
3f812638b5Imported from ivall/xcl. Originally posted by BBareth on 2026-11-30T10:01:27Z.
merge-check
base:
9dfbe3ea66head:
3f812638b5merge: clean
build: cargo build --workspace -> ok
tests: cargo test --workspace --no-fail-fast -- --test-threads=4 -> 2886 passed, 1 failed, 51 ignored; failing: gpu::dxil::msaa_tests::gpu_direct_image_get_resinfo_d16, which fails on the base alone too (base: 2885 passed, 1 failed, 51 ignored, 28 SKIPPED lines). 28 SKIPPED lines, as on the base. The new test
gpu_valu_16_bit_unsigned_min3_max3_med3passed; on this card it runs the wave32 form only (no wave64).review: no blocking finding; test-only, one file, read in full. One GPU test of
v_max3_u16,v_min3_u16andv_med3_u16against a CPU sort of the low halves, 32 dispatches of random operands mixed with edge values, with non-zero bits in every source's high half. Only the low 16 bits of the result are compared; the comment explains why (AMD's spec and LLVM disagree on the high half), which leaves the high half unpinned on purpose. Not a duplicate that I could find (#737 covers the f32 fma forms).performance: none; tests only.
verdict: safe to merge
hardware / tool and model: RTX 5070 Ti 16 GB, driver 621.24 (32.0.16.2124); i7-12700K; Windows 11 26200. Claude Code, Claude Fable 5.2 read the diff, ran the build and the suite and wrote this check.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:02:34Z.
Triage (#1607) – head
3f81263Partial overlap: #1576 (opened later) also checks V_MIN3_U16 / V_MAX3_U16 / V_MED3_U16 on the GPU, inside a much larger test of bit ops, SAD and packed 16-bit ops. This PR is the narrower check, with garbage in the high halves of the sources and randomized edges. No test of these three instructions is on main.
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.
Imported from ivall/xcl. Originally posted by stijn-boer on 2026-12-02T18:44:46Z.
merge-check
base:
c53e969602head:
3f812638b5verdict: safe to merge
Windows / AMD RDNA4 — unsigned 16-bit VALU min/max/median checks on
3f81263Clean merge onto
main(merge commit753768a287ec76bdff4e6bc18db145ae8b666cf1).git diff --checkwas clean.Setup
AMD Radeon RX 9060 XT (32.0.32029.2010), Ryzen 7 5700X, Windows 10 21H2 build 19044.6332, Rust 1.100.0 debug, Agility 1.620.2, DXC 1.9.2609.5.
Tested
cargo test -p xcl --lib gpu_valu_16_bit_unsigned_min3_max3_med3 -- --test-threads=1 --show-output --nocapture— 1 passed, 0 failed, 0 ignored, 0 skip notices.Diff review
The diff adds only the GPU test. It checks unsigned 16-bit min3, max3, and med3 against a CPU reference, with nonzero source high halves. The assertions cover the destination low half.
Not tested
The full workspace suite, retail smoke, or another GPU vendor in this run.
AI use
Codex (GPT-6) merged the PR, reviewed the test diff, ran the test, and drafted this report.
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.