Recompiler: 16-bit compares read their low halves whatever op_sel says (#1293) #1296
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!1296
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1296"
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?
@tiagonogueiraa-bit on GitHub · 2026-11-24 14:27 UTC · original
tiagonogueiraa-bit:vopc16-opsel→main· +34 −1 · 2 files · 1 commits · openOn RDNA2, 16-bit compares (
v_cmp_*/v_cmpx_*over f16, u16, i16) take both sources from the low halves and ignoreop_sel. This was measured on gfx1036 in Marvisak/VIctory#833.vopchonouredop_sel, soop_sel:[1,0]on0x4000_3C00 < 0x3C00_3E00compared 2.0 < 1.5 instead of 1.0 < 1.5.v_cmp_class_f16was not measured and keepsop_sel, as the issue suggests. Fixes #1293.What is in it
crates/xcl/src/gpu/recomp/emit.rs(vopc): the 16-bit halves come from the low 16 bits except forclass.crates/xcl/src/gpu/recomp/tests.rs:gpu_cmp_16_ignores_op_sel, one f16, u16 and i16 compare each, withop_selset and high halves that give the opposite answer.Tested
cargo check -p xcl --lib --tests --target x86_64-pc-windows-msvcpasses with no errors (C stubbed, not linked).gpu::recompfrommainand from this branch and ran the emitted HLSL as C++ on one lane with the test's registers. Onmainall four compares are false, so the test fails. With this change all four are true.8b247b0:gpu_cmp_16_ignores_op_selpasses in the workspace suite and run on its own. The suite's failures under Wine are also failures on the base930e8b4. (report)main):cargo test -p xcl --lib recomp, 190 passed, 0 failed, 18 ignored. (report)Later, the whole lib with
--test-threads=1: all passed, 0 failed, 21 ignored. (report)scripts/test.ps1752 passed, 0 failed, 41 ignored, noSKIPPED. With theemit.rschange reverted,gpu_cmp_16_ignores_op_selfails atwave64 v_cmp_lt_f16 op_sel:[1,0]. (report)Regression run
By @IvyNotFound:
scripts/smoke.ps1 -Seconds 60,XCL_PRESS_A_AT=15, unedited, from the report.main:
PR:
Not tested
op_selset (#1293), so this path is not reached there.AI use
🤖 Generated with Claude Code
@DavidM1911 on GitHub · 2026-11-24 14:33 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:Thanks!
@tiagonogueiraa-bit on GitHub · 2026-11-24 14:34 UTC · original
@DavidM1911 thank you! Two details would make this count for the merge:
8b247b0. Whichmaincommit was it merged with?gpu::recomp::tests::gpu_cmp_16_ignores_op_selactually ran on the GPU rather than printingSKIPPED. Runningcargo test -p xcl --lib gpu_cmp_16_ignores_op_sel -- --nocaptureshows it.If you get the chance, the whole suite (
cargo test --workspace -- --test-threads=4, with its counts) is what CONTRIBUTING asks for.Written with Claude Code (Claude Opus 5.5).
@vitor127wt on GitHub · 2026-11-24 14:57 UTC · original
Test report on RTX 5070 Ti under Wine
Following up on #1243. I tested the exact PR head
8b247b0f1068fcca07b0752a46ffea160f83b46din a separate checkout and build directory.gpu::recomp::tests::gpu_cmp_16_ignores_op_selpassed in the workspace suite and in an isolated rerun with--exact gpu::recomp::tests::gpu_cmp_16_ignores_op_sel --nocapture --test-threads=1(1 passed, 0 failed, 0 ignored, 0 skipped). The test log confirmed the RTX 5070 Ti and DXC were in use.Tested
7.3.5-2-cachyos, Wine 11.22, DXVKv2.7.1-498-ga6764047e587178, vkd3d-proton 3.1.0 from Proton-CachyOS (0bb64c56c8f0dcc), DXC 1.9.2609.5. Rust 1.100.0 and cargo-xwin 0.24.1, Windows MSVC debug target.cargo xwin build --offline --locked --target x86_64-pc-windows-msvc --workspacesucceeded.cargo xwin test --offline --locked --target x86_64-pc-windows-msvc --workspace --no-fail-fast -- --test-threads=4ran under Wine and reported 686 passed, 66 failed, 41 ignored (exit 101). Four capability skips are included in the harness's passed count and listed below.930e8b49c1c2ec683d22c724a398b39111cd0e56reported 683 passed, 68 failed, 41 ignored, with the same four skips. All 66 failure names from the PR also appeared on the base. The two additional base failures weregpu_nonfused_mad_and_mac_prevent_fma_contraction(device removed) andnever_picks_xcl_itself(file copy error). The baseline build used an on-disk target directory after a linker error on tmpfs.Not tested
Native Windows, AMD hardware and retail-title smoke runs. Retail sample environment variables were unset.
AI use
Codex (GPT-6, exact variant unavailable) cross-built and ran the tests, compared the failure lists and drafted this report.
@tiagonogueiraa-bit on GitHub · 2026-11-24 14:59 UTC · original
Thank you, @vitor127wt! I added your run to Tested and marked the PR ready for review.
Written with Claude Code (Claude Opus 5.5).
@ySKELLETONX on GitHub · 2026-11-24 15:10 UTC · original
Test report on head
8b247b0(asked for in #1243). AI-written (Claude Code, Claude Opus 5.5) from real runs; checked by me.Tested
scripts/test.ps1(cargo test --workspace -- --test-threads=4): 752 passed, 0 failed, 41 ignored; noSKIPPEDlinesgpu::recomp::tests::gpu_cmp_16_ignores_op_sel: okemit.rschange reverted (test kept, base930e8b4):gpu_cmp_16_ignores_op_selfails at tests.rs:7195 (wave64 v_cmp_lt_f16 op_sel:[1,0]), so the test catches the change.Not tested
@tiagonogueiraa-bit on GitHub · 2026-11-24 15:13 UTC · original
Thank you, @ySKELLETONX: the native Windows suite plus the revert check is what this PR was missing. It's in Tested now. The only thing left is an
xcl-smokepair (mainand8b247b0, same title and time) from anyone who has a title.Written with Claude Code (Claude Opus 5.5).
@IvyNotFound on GitHub · 2026-11-24 15:23 UTC · original
Regression runs for
8b247b0on Windows, thexcl-smokepair this PR still needs. Same retail title, same 60 s, unedited, made withscripts/smoke.ps1 -Seconds 60andXCL_PRESS_A_AT=15. The PR head as is (base930e8b4) andmain930e8b4, clean trees, one after the other.main:
this PR:
Not tested: the suite at this head (see the other reports here); AMD.
AI use: Claude Code, Claude Opus 5.5 ran the runs and wrote this comment.
@tiagonogueiraa-bit on GitHub · 2026-11-24 15:25 UTC · original
Thank you, @IvyNotFound! Both blocks are under Regression run exactly as posted, with credit. With them the PR has everything CONTRIBUTING asks for.
Written with Claude Code (Claude Opus 5.5).
@DavidM1911 on GitHub · 2026-11-24 16:02 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib -- --test-threads=1: all passed, 0 failed, 21 ignored. (Parallel runs intermittently abort with 0xc0000005 — same harness flake seen on unmodifiedmain.)Thanks!
@tiagonogueiraa-bit on GitHub · 2026-11-24 20:14 UTC · original
Thank you @DavidM1911, the whole-lib run is in Tested, next to your earlier
recompone.@milesah3ad on GitHub · 2026-11-25 01:01 UTC · original
The direct DXIL backend counterpart of this fix, from @regiumlepidi's parity sweep on #1269:
gpu_cmp_16_ignores_op_selpass withXCL_DIRECT_DXIL=1with the patch below. Without it they fail on the direct path.vopcingpu/dxil/lower_valu.rstook each 16-bit source from the halfop_selnamed, sov_cmp_lt_f16 op_sel:[1,0]compared the high half (your test:(0, 0)against(0xFFFFFFFF, 0)). The patch appliesop_seltoclassonly, as your HLSL change does. (#1214 / #1980 changeclass's src1 handling in the same function, so whichever lands second may need a small rebase.)How to take it: this PR predates the direct backend on
main, so rebase it ontomainfirst (your commit rebases cleanly onto7994cd1), thengit amthe patch below. Feel free to fold it into your PR with aCo-Authored-By: milesah3ad <[email protected]>line. I didn't open a separate PR, so this doesn't add another review.patch (1 commit, for
git am)Tested
main7994cd1plus this patch:gpu_cmp_16_ignores_op_selpass with and withoutXCL_DIRECT_DXIL=1.cargo test -p xcl --lib --no-fail-fast -- --test-threads=4onmain7994cd1with #587, #686, #1159 and #1296 all merged and the four direct patches applied: 948 passed, 4 failed, 25 ignored, the same in both settings. The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0..3, which fail the same way on plainmainhere (944 passed, 4 failed). The +4 are the PRs' own tests.Not tested: wave64 hardware (the wave64 cases SKIP here), AMD, any title, the full workspace suite (lib only).
AI use: Claude Code (Claude Opus 5.5) wrote the fix and ran the tests on the machine above. I checked the results.
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.