Repository navigation
feat(shader): accept every SDWA selector on VOP2 float ops - #511
Conversation
|
Thanks, the selector handling is right: my own model (selected field, One thing before it can go in. As you say in the body, f16 results ignore |
21bed75 to
a911e79
Compare
|
Thanks, went with keeping the refusal:
|
|
Thanks, the refusal is in the right place. The first commit is #509's commit, patch-identical to #509's head, so this lands after #509.
I'll run it through my PPSA21564 check with #509 next and merge both if it's clean. |
|
Rebased on current |
a911e79 to
6183940
Compare
Co-Authored-By: Claude <noreply@anthropic.com>
|
Rebased on current |
6183940 to
7e90590
Compare
|
Ran PPSA21564 with this rebase on my integration branch (VOP2 float SDWA is in nearly every shader there): 4 runs, renders the same, no frame rate change. Ready to merge from my side. |
What
VOP2 SDWA on float ops threw for most selector combinations:
v_add_f32,v_sub_f32andv_mul_f32only accepted DWORD selectors.v_add/sub/subrev/mul_f16andv_min/max_f16accepted word selectors but threw on byte selectors (source or destination).v_subrev_f32,v_min_f32,v_max_f32andv_mul_legacy_f32had no SDWA rule, so any non-DWORD selector threwVOP2 SDWA modifier is not supported for opcode.All of them now take every
src0_sel/src1_sel(withsext, neg and abs) and everydst_selwithUNUSED_PAD,UNUSED_SEXTorUNUSED_PRESERVE, likev_cvt_pkrtz_f16_f32already did. The three float profiles in the decoder are merged into one. The translator needed no change: the selected source field goes throughapplyBitSourceModifiersbefore neg/abs, and the result goes throughwriteRawU32, which places it in the destination field.The reserved
dst_unusedvalue 3 still throws.v_ldexp_f16is not in this PR: its second source is an integer.Stacked on #509 (first commit), which merges the integer profiles in the same table.
Behaviour measured on HW (RDNA2, gfx1035)
I ran 78 random forms (all 13 ops, every selector,
sext, neg, abs and clamp) on 1024 rows each, with f32 denormals preserved and flushed (DENORM=3and0). The Python model matches every result that isn't NaN. The model:sextis honoured on float ops, although llvm-mc doesn't accept the syntax there. Its only visible effect is that a byte or word field with its top bit set becomes a quiet NaN.v_min/max_f32then return the other operand. Byte selectors on f32 and f16 ops give denormals or zero, so most of those results depend on the denormal mode.Tested
New execution test
agc_driver_sdwa_float_selectors_tests: 16 forms × 32 rows with expected values from the hardware. A cell is checked only when its result is not NaN and is the same with denormals preserved or flushed. Vulkan lets drivers choose NaN payloads and flush denormals. There are 8 to 30 checked rows per form. Thesextcases are checked throughv_min/max_f32andv_min/max_f16, which choose the NaN operand on the bits.It passes on RADV, local lavapipe and CI's lavapipe (Ubuntu Mesa 25.2.8). It fails without each part of the change (4 mutations):
v_max_f32, it throws again;sexton the sources, or treatingUNUSED_SEXTasUNUSED_PAD, gives wrong values.The full Release ctest passes except
agc_driver_pixel_helper_lanes, which also fails onmainon local RADV.f16 results still ignore
clampon the word and DWORD formsmainalready accepted. #323 fixes that. The byte-selector f16 forms this PR adds still throw whenclampis set (VOP2 SDWA clamp with byte selectors is not implemented), so no new form gives an unclamped result; the test checks that refusal on all six f16 ops (byte selector on the destination, src0 or src1), and it fails if the refusal is dropped or only looks at the destination.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)