Repository navigation
Recompiler: 16-bit compares read their low halves whatever op_sel says (#1293) - #1296
tiagonogueiraa-bit wants to merge 1 commit into
Conversation
xcl-dev#1293) On RDNA2, v_cmp_* / v_cmpx_* over f16, u16 and i16 take both sources from the low 16 bits and ignore op_sel. This was measured on gfx1036 in Marvisak/VIctory#833, with v_add_nc_u16 under the same bits honouring them as the control. vopc selected the high half for each set bit, so op_sel:[1,0] on 0x4000_3C00 < 0x3C00_3E00 compared 2.0 < 1.5 instead of 1.0 < 1.5. v_cmp_class_f16 was not measured and keeps op_sel. gpu_cmp_16_ignores_op_sel runs one f16, u16 and i16 compare each, with op_sel bits set, whose high halves give the opposite answer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
@DavidM1911 thank you! Two details would make this count for the merge:
If you get the chance, the whole suite ( Written with Claude Code (Claude Opus 5.5). |
|
Test report on RTX 5070 Ti under Wine Following up on #1243. I tested the exact PR head Tested
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. |
|
Thank you, @vitor127wt! I added your run to Tested and marked the PR ready for review. Written with Claude Code (Claude Opus 5.5). |
|
Test report on head Tested
Not tested
|
|
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 Written with Claude Code (Claude Opus 5.5). |
…cl-dev#1286-xcl-dev#1291, xcl-dev#1294, xcl-dev#1296-xcl-dev#1297, xcl-dev#1300 Prevent background shader preloading and concurrent DXC/RADV compiles from exhausting host RAM under Wine, and integrate 11 open upstream PRs: - dxc.rs & real.rs: check free physical RAM (ullAvailPhys.min(ullAvailPageFile)) under Wine instead of swap-inclusive ullAvailPageFile, avoid bypassing the guard after 60 s under Wine, and serialize giant (>= 4 MiB DXIL) driver compiles with BIG_COMPILES under Wine. - pso_async.rs: cap background preload workers to 1 under Wine. - title_textures.rs: use real::create_raw_fence in submit_on_title_queue and read coherent-window hash bytes safely via with_title_bytes. - Integrate upstream PRs xcl-dev#968 (sparse::queue lock-free for late_release), xcl-dev#1286 (v_dot2_f32_f16 NEG_HI abs), xcl-dev#1287 (XMA >8 channels), xcl-dev#1288 (Sleep pauses during PSO bind waits), xcl-dev#1289 (pipeline stream bounds check), xcl-dev#1290 (root signature MAX_ARGS cap), xcl-dev#1291 (console UAV clears xcl-dev#53/xcl-dev#54), xcl-dev#1294 (shadowed PENDING accuracy), xcl-dev#1296 (16-bit compare low halves), xcl-dev#1297 (fence_x pre-cell signal arming), xcl-dev#1300 (log driver compute PSO refusal). Verified on RX 9060 XT under GE-Proton11-14 (MemoryMax=12G, 80 s): committed RAM stays flat at 4830 MB (down from 27.6 GB OOM), 1493 frames shown, exit 0x0. Assisted-by: Antigravity (Google DeepMind)
|
Regression runs for
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. |
|
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). |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Thank you @DavidM1911, the whole-lib run is in Tested, next to your earlier |
RDNA2 runs the VOP3 encodings of VOP2 (opcodes 0x100-0x13F) and VOP1 (0x180-0x1FF) instructions without op_sel: they read the low halves of their sources and write the low half of VDST, keeping the high one, whatever OP_SEL holds. Only the VOP3-only 16-bit opcodes (v_fma_f16, v_mad_u16, v_add_nc_u16, v_pack_b32_f16, ...) honour it. Both backends honoured it for every 16-bit op, so v_mul_f16 with OP_SEL 0b1001, for example, multiplied src0's high half and wrote VDST's high half. Measured on RDNA2 silicon (gfx1036, the Radeon iGPU of a Ryzen 7 9700X, through OpenCL inline asm with the OP_SEL bits patched into the dwords): all 31 16-bit opcodes in these ranges give the same dword with any one OP_SEL bit set as with none, while the VOP3-only controls change as op_sel says. LLVM's GFX10 tests (tests/data/llvm-amdgpu/gfx10_vop3.txt) set OP_SEL on none of the 2372 encodings in these ranges. rdna2::op_sel returns 0 for these encodings, and the mods() of both backends take Mods.opsel from it. The 16-bit compares (VOPC in VOP3, 0x000-0x0FF) are left as they are (xcl-dev#1296, xcl-dev#1572). The three tests that expected the op_sel forms now expect the measured results, a GPU test checks 80 measured cases, and a decoder test pins which encodings keep OP_SEL. The retail title's shader pack has no such instruction with OP_SEL set (none of its 44.4M instructions apart from the shader-hash v_nops), so it runs the same code as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The direct DXIL backend counterpart of this fix, from @regiumlepidi's parity sweep on #1269:
How to take it: this PR predates the direct backend on patch (1 commit, for
|
On 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 (Recompiler: 16-bit compares honor op_sel; RDNA2 hardware ignores it (measured on gfx1036, see VIctory#833/#926) #1293), so this path is not reached there.AI use
🤖 Generated with Claude Code