Recompiler: wave32 src_vccz / src_execz and SDWA f16 inline constants #191
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!191
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/191/head"
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?
@RandomGithub12309 on GitHub · 2026-11-23 20:01 UTC · original
RandomGithub12309:fix/recomp-wave32-vccz-sdwa-f16→main· +174 −39 · 2 files · 1 commits · merged 2026-11-23 20:51 UTCAddresses two unfixed operand-decoding gaps noted in #105:
src_vccz(251),src_execz(252), and 32-bitsaveexec/wrexec:Em::mask_zerosocode32,code64, andsopp(s_cbranch_vccz/vccnz/execz/execnz) check onlyvcc_lo/exec_lowhen!self.opt.wave64instead of(lo | hi) == 0u(in wave32vcc_hiis a general-purpose SGPR).251and252handling incode64.!self.opt.wave64 || name.ends_with("_b32")beforeread64/sreg(127)insalusaveexec/wrexec, allowing 32-bit scalar sources such asm0orsrc_vccz.f16inline constants andVSRC1:src_f16intocode32for SDWAS0 == 1andS1 == 1instead of hardcodingfalse(which emitted binary32 constants whose low 16 bits were wrong, e.g.0x3F800000->0.0h).VSRC1inVariant::SdwainsideEm::sourcesso scalarS1 == 1operands do not register bogus VGPRs.src_f16 = falseinvalu16for integer-sourcev_cvt_f16_u16andv_cvt_f16_i16.Verification
wave32_src_vccz_execz_and_saveexec_b32_hlsl,sdwa_f16_inline_constants_hlsl,gpu_wave32_and_wave64_src_vccz_execz,gpu_sdwa_f16_inline_constants); verified all 4 failed onmain(956a476) before the fix and pass after..\scripts\test.ps1on Windows 11 x64 with an NVIDIA GeForce RTX 5050 Laptop GPU (540 passed; 0 failedinxcllib tests, 2 wave64-only GPU tests skipped; all e2e/oracle test targets passed;XCL_SAMPLE_*env vars not set).@mastrr9 on GitHub · 2026-11-23 20:27 UTC · original
Independent Windows + RTX 5080 GPU verification of
62e0e2596(merge-base956a476bf) on NVIDIA GeForce RTX 5080 (Blackwell desktop, driver617.42, D3D12 SM 6.6 + mesh shaders, 32-wide waves, Windows 11, Ryzen 7 9800X3D, Rust1.100.0, DXC1.9.2602.17, noXCL_SAMPLE_*, no game files):Build & Tests
cargo build --workspace && cargo test --workspace -- --test-threads=4: 573 passed, 0 failed, 39 ignored (git diff --checkclean; 2 expectedno wave64skips).wave32_src_vccz_execz_and_saveexec_b32_hlsl,sdwa_f16_inline_constants_hlsl,gpu_wave32_and_wave64_src_vccz_execz, andgpu_sdwa_f16_inline_constants.Code check
mask_zero(lo)cleanly unifiessrc_vccz(251),src_execz(252), ands_cbranch_vccz/execzso wave32 testslo == 0uonly (and_b32saveexec/wrexecno longer readss127).sources()forwardingsrc_f16tocode32()for scalar inline constants while excludingv_cvt_f16_u16/v_cvt_f16_i16invalu16()looks exact. No issues found.(AI-assisted)
@WarmMilkCodes on GitHub · 2026-11-23 20:35 UTC · original
Tested #191
62e0e25merged onto main956a476on AMD Radeon RX 6600 XT (RDNA2), driver 32.0.21045.29003, Windows 11 23H2 (22631.6199): passcargo test --workspace --no-fail-fast -- --test-threads=4, noXCL_SAMPLE_*data:No new failures vs main. The PR's 4 new tests pass on RDNA2 (native 64-wide subgroups available, so the wave64 paths run unsplit here). The one failure on both,
gpu_wave64_ps_whole_wave_reductions, is the 32-lane PS case on this card (#155).@Kalmarv on GitHub · 2026-11-23 20:39 UTC · original
Linux / Wine / Turing run of
62e0e2596(merge-base956a476, the currentmain, so PR head = merge result). This adds an older GPU generation and a different D3D12 path, vkd3d-proton → dxil-spirv → NVIDIA Vulkan, to the Windows RTX 5050/5080 runs above.Setup: Ubuntu 24.04, GeForce RTX 2060 (Turing, 32-lane waves), NVIDIA 595.91.07. Wine 11.21 Staging (wow64). vkd3d-proton
master30b0eb9 with the vtable-identity checks relaxed as in #175. DXVK 3.1.1dxgi. XCL cross-built forx86_64-pc-windows-gnu(mingw-w64 13), release. DXC 1.7.2308. No game files, noXCL_SAMPLE_*.The 4 new tests, at the PR head and on a control:
main'semit.rswith this PR'stests.rs.main+ new testswave32_src_vccz_execz_and_saveexec_b32_hlsls_and_saveexec_b32: opunsupported)sdwa_f16_inline_constants_hlslgpu_wave32_and_wave64_src_vccz_execzs_and_saveexec_b32: op)gpu_sdwa_f16_inline_constantsv_add_f16_sdwa 1.0 + 2.0gives0x4000(the f32 constant's low half, 0.0h, + 2.0) instead of0x4200Both GPU tests ran on the RTX 2060: the device was found and neither test skipped.
The whole
gpu::recomp::testsgroup, as a regression check (--test-threads=1):main+ new testsThe 4-test difference is exactly the table above. The other 5 fail identically on both, so they come from this stack, not the PR. All 5 read title or process memory through the memory windows and get zeros:
gpu_memory_windows_above_4_gib,gpu_unified_memory_arena,gpu_mesh_mode_reads_memory_windows,gpu_sparse_vram_descriptors_buffers_and_xmem,gpu_bvh64_intersect_ray_across_memory_windows_and_grazing.Code: I read the diff and agree with the review above. One note for anyone checking the hardware later:
v_cvt_f16_u16/v_cvt_f16_i16with a float inline constant now take the f32 pattern's low 16 bits (0x3F800000 & 0xFFFF= 0 for 1.0). That matches how LLVM treats 16-bit integer operands as far as I know, but I haven't verified it on AMD hardware, and NVIDIA can't show it.Not covered: native 64-lane hardware (AMD); this GPU runs only 32-lane waves; Windows; the e2e and integration test binaries; any title.
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175@ivall on GitHub · 2026-11-23 20:52 UTC · original
Merged (main
2abc562). Checked on an RX 9070 (RDNA4) with the 11 PRs merged together on main38b05b7:cargo build --workspace && cargo test --workspace -- --test-threads=4- 547 unit tests passed, 0 failed (19 ignored); the integration and e2e tests passed too.