feat(shader): accept every SDWA selector, clamp and omod on v_ldexp_f16 #666
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/666"
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 adriadam10 on 2026-10-05T13:00:32Z.
What
v_ldexp_f16was the only VOP2 f16 op left out of #511: any SDWA selector,clamporomodthrew (VOP2 SDWA modifier is not supported for opcode/output modifiers are not supported). It now takes theFloat16SDWA profile from #511:src0_sel/src1_sel(withsext) and everydst_selwithUNUSED_PAD,UNUSED_SEXTorUNUSED_PRESERVE;clamp, applied by #664'sclampF16Bits; with a byte selector it throwsVOP2 SDWA clamp with byte selectors is not implemented, like the other f16 ops in #511;omod, which the hardware ignores on this op (below).Neg/abs on src1 (the integer exponent) still throw. That check used to run only for full-width SDWA; it now runs for every selector, so
-v5withsrc1_sel:BYTE_0doesn't get through. For every other op the result is the same as before: their rules already refuse those modifiers, or the ops are float ops that accept them.No translator change: the selected fields go through
applyBitSourceModifiersandwriteRawU32as in #511, andvLdexpF16already reads the exponent as the low 16 bits of src1, sign-extended.Stacked on #511 (first commit) and #664 (second commit). This PR is only the third commit.
Behaviour measured on HW (RDNA2, gfx1035)
96 random SDWA forms (all selectors,
sexton both sources, neg/abs on src0, clamp with word/dword selectors) × 1024 rows, with f16 denormals preserved and flushed (DENORM16=3and0): the model matches all 196,608 results. The model:WORD_1withoutsextand the top bit set.clamp→ [+0, 1.0], NaN → +0, -0 → +0;omod(mul:2, mul:4, div:2) on 3 forms × 1024 rows: the result is the same as with no omod, in both denormal modes.Tested
New execution test
agc_driver_sdwa_ldexp_f16_tests: 16 SDWA forms × 32 rows with expected values from the hardware, two withomod, five withclamp. A cell is checked when its result is the same with f16 denormals preserved and flushed (NaN results are chosen on the bits, so they are checked too). It also checks that clamp with a byte selector in src0, src1 or dst, and neg/abs on src1, still throw.It passes on RADV, local lavapipe and CI's lavapipe (Ubuntu Mesa 25.2.8, 1 s cold). It fails without each part of the change (5 mutations): without the SDWA profile, clamp or omod it throws; with the src1 modifier check only at full width the refusal check fails; with
clampF16Bitsremoved fromvLdexpF16(#664) the clamp rows fail.Full Release ctest passes except
agc_driver_pixel_helper_lanes,agc_driver_pixel_ldsandagc_driver_pixel_lds_lane_slots, which also fail onmainon local RADV (wave32 lane 32 on RADV's 64-wide subgroup).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-05T17:08:14Z.
Rebased on main, restacked on #511 and the rebased #664 (no conflict in this PR's own commit). SdwaLdexpF16, SdwaFloatSelectors, Float16Modifiers, Float16TernaryClamp and Vop3LegacySourceModifiers pass on RADV and lavapipe.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-05T18:18:32Z.
Rebased on main after #511 merged (its commit dropped from this branch, the rest unchanged). The SDWA, float16 and ternary clamp execution tests pass on RADV and on CI's lavapipe.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-05T18:31:56Z.
Rebased on main (#511 merged) and on the rebased #664;
agc_driver_sdwa_ldexp_f16passes again. Now only #664's commit + this one.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T19:45:40Z.
Thanks for the rebase. #507 has since renamed
usesSignedSaturateClamptousesIntegerSaturateClamp, so ab58ce709 conflicts again on the same return line insupportsNativeVop3Clamp. Once #664 is rebased (I suggested the resolution there), rebasing this on it should only need main's name on that line. I tested that combination:agc_driver_sdwa_ldexp_f16fails on main's code, passes with the change, and passes 20 times in a row. It has to land after #664, since withoutclampF16Bitsa clamp onv_ldexp_f16would be accepted and dropped.Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T20:07:58Z.
Sorry, please ignore my rebase note above: this branch is already on top of #507 (and #664), and I was looking at an older head. It merges cleanly with main as it is, and still needs to land after #664.