fix(recompiler): accept byte source selectors on v_cvt_f16_u16 SDWA #2838
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2838"
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 boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T16:24:20Z.
What
Fixes #2747. The VOP1 SDWA rule for
VCvtF16U16now accepts byte source selectors. The existing source path zero-extends the selected byte before conversion; the test checks all four byte lanes, including word destinations with preserved bits.This carries forward the author-attributed fix from #2695, which was closed during the intake pause.
Tested
main: builtagc_driver_sdwa_cvt_f16_u16_tests; the test ran on llvmpipe (LLVM 15.0.6) and passed (1/1). All four byte selectors were exercised.upstream/main, the same test failed with the reported unsupported selector (dst selector 4,unused 2,source selector 3); restoring the rule made it pass.tools/check_conventions.py --base upstream/mainandgit diff --checkpassed.write_watch_threadstimeout. Follow-up #2846 now passes the repeated write-watch job on Intel and arm64; the original failed run remains in this PR's check history.Checklist
main; no open PR implements this opcode fixImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-10T16:34:56Z.
The macOS Intel
write_watch_threadsfailure in this PR is covered by the separate test reliability follow-up #2846. Its full repeated write-watch job now passes on both macOS Intel and arm64. The current failure on this PR is from its earlier run; GitHub would not rerun that workflow. The shader changes and their Linux Vulkan regression test are unaffected.Imported from boykopovar/AnyPS5. Originally posted by fma-rc on 2026-10-10T16:43:08Z.
Hardware measurement for this, since the PR's expected values come from a host-side model: on RDNA2 the byte selects behave as the PR assumes, and the recompiler with this PR gives the same bits.
Setup: PR head
ef5221a1merged ontomain57f96fd2. Arch Linux, GCC 16.2.1, Release. Hardware rows fromtools/hw-oracleon a Radeon 610M (gfx1036, RDNA2), DX10_CLAMP=1, f32 denormals flushed, f16 denormals kept, round to nearest; IEEE=0 and IEEE=1, wave32 and wave64 all give the same bits. Recompiler runs on an RTX 5080 (615.78.08) and on the Radeon 610M (RADV, Mesa 26.1.4).Measured: input
v4 = b | (b^0x55)<<8 | (b^0xaa)<<16 | (b^0xff)<<24for all 256 values ofb, so every byte lane sees every value; destinations preloaded with0xabcd1234.dst_sel:WORD_0 dst_unused:UNUSED_PRESERVE src0_sel:BYTE_3abcd5bf8abcd5bf0abcd5800abcd57f0abcd0000dst_sel:DWORD src0_sel:BYTE_00000000000003c00000057f00000580000005bf8dst_sel:WORD_1 dst_unused:UNUSED_PRESERVE src0_sel:BYTE_15550123455401234514012345aa8123459501234dst_sel:DWORD src0_sel:BYTE_2000059500000595800005aa80000514000005550dst_sel:DWORD src0_sel:BYTE_0,sext(v4)0000000000003c00000057f000007bfc00007c00dst_sel:DWORD src0_sel:BYTE_3,sext(v4)00007c0000007c0000007bfc000057f000000000dst_sel:WORD_0 dst_unused:UNUSED_PAD src0_sel:BYTE_100005550000055400000514000005aa800005950dst_sel:WORD_1 dst_unused:UNUSED_SEXT src0_sel:BYTE_259500000595800005aa800005140000055500000The first four rows are the four encodings in this PR's test. The byte is zero-extended (255 gives
0x5bf8, 255.0), and a sign-extended byte is converted as the u16 it becomes (0xff80gives0x7bfc,0xffffrounds to0x7c00).agc_driver_sdwa_cvt_f16_u16_testsNot measured: the SDWA clamp bit, source selectors
WORD_0/WORD_1(not changed here), and round modes other than nearest (every byte value is exact in f16; only the sign-extended rows round).AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T23:07:01Z.
Checked the decoder rule against the hardware oracle (4 encodings of the test × all 256 byte values, 0 differences); the new test passes and fails without the rule change. Matches @fma-rc's measurements on RDNA2 and the RTX 5080; merging.
The red
write-watch (macos-15-intel)job is the unrelatedwrite_watch_threadstimeout (#2846); it passes on arm64 and I re-ran it.