Repository navigation
Recompiler: wave32 src_vccz / src_execz and SDWA f16 inline constants - #191
Conversation
- Use wave-size-aware mask_zero() for src_vccz (251), src_execz (252), and s_cbranch_* in code32/code64/sopp so wave32 checks only vcc_lo/exec_lo (xcl-dev#105). - Handle 32-bit saveexec/wrexec before read64/sreg(127) so wave32 / _b32 forms accept 32-bit scalar sources such as m0 or src_vccz. - Forward src_f16 into SDWA S0/S1 code32 decoding, skip registering VSRC1 as a VGPR in SDWA before checking S1, and pass src_f16=false for v_cvt_f16_u16 / v_cvt_f16_i16 (xcl-dev#105). - Add HLSL and GPU regression tests covering wave32/wave64 src_vccz/src_execz, s_and_saveexec_b32, and SDWA f16 inline constants.
…09) applied xcl-dev#192: XGTextureAddressComputer xcl-dev#10 as GetResourceTiling, read from the console library's code - replaces the local version, which was not checked against it. xcl-dev#191: recompiler wave32 src_vccz / src_execz and SDWA f16 inline constants. Their authors' work, applied as it is. 200 s run through the title's menus: no change in the picture, no regression. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
Independent Windows + RTX 5080 GPU verification of Build & Tests
Code check
(AI-assisted) |
|
Tested #191
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, |
|
Linux / Wine / Turing run of Setup: Ubuntu 24.04, GeForce RTX 2060 (Turing, 32-lane waves), NVIDIA 595.91.07. Wine 11.21 Staging (wow64). vkd3d-proton The 4 new tests, at the PR head and on a control:
Both GPU tests ran on the RTX 2060: the device was found and neither test skipped. The whole
The 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: Code: I read the diff and agree with the review above. One note for anyone checking the hardware later: Not covered: native 64-lane hardware (AMD); this GPU runs only 32-lane waves; Windows; the e2e and integration test binaries; any title. |
In `Lw::sources` (`dxil/lower_valu.rs`), the initial operand loop skipped `SRC0` for non-plain variants but did not skip `VSRC1` for `Variant::Sdwa` (unlike HLSL `recomp/emit.rs` after merged PR xcl-dev#191). Before the SDWA match arm replaced `u[1]` using `S1` + `VSRC1`, the initial loop called `self.read` -> `self.vreg(vsrc1)` on the raw 8-bit `VSRC1` encoding. When `S1 == 1` (scalar SGPR or inline constant such as `242` = `1.0f` or `138` = `10`), that polluted `self.init.touched` with bogus VGPRs (`v242`, `v138`, `v4`) and inflated `top_vgpr()`, bloating any `v_movrel*` / `v_swaprel_b32` select chains in the shader. Skip `VSRC1` for `Variant::Sdwa` in the initial operand loop (parity with `xcl-dev#191`) and add DXIL disassembly + RTX 4060 GPU regression tests. Part of xcl-dev#1269 Assisted-by: Google Antigravity (Gemini 4 Neon)
In crates/xcl/src/gpu/dxil/lower.rs, Lw::salu unconditionally called read64 on _b64 saveexec/wrexec forms even in wave32 (!self.wave64) and unconditionally read sreg(127) (EXEC_HI) before branching on (!self.wave64 || name.ends_with("_b32")). On 32-bit-only source encodings such as m0 (SSRC0 = 124), wave32 S_AND_SAVEEXEC_B64 failed translation with Err("...: op"), and on SGPR sources it spuriously touched s[n+1] and EXEC_HI (s127).
Move source reads and EXEC_HI handling inside the wave32/_b32 vs wave64 _b64 branches to mirror HLSL (#191), and add unit/disassembly and wave32 RTX 4060 GPU regression tests in lower.rs.
Part of #1269
Assisted-by: Google Antigravity (Gemini 4 Neon)
Addresses 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).