Repository navigation
compute: lower op_sel on VOP3 v_fma_f16 in direct compute - #3234
Conversation
Source op_sel bits 0-2 read the high half [31:16] of a VGPR source; op_sel bit 3 writes the binary16 result to D[31:16] and keeps D[15:0]. Without bit 3 the result still goes to D[15:0] with D[31:16] kept. op_sel on an SGPR or constant source, with clamp, on v_fmac_f16, DPP and SDWA stay refused. New test native_fma_f16_opsel (IR and hardware) covers the six source and destination selections against tests/f16_packed_model.py, with a sentinel in the kept half, plus three refusal controls.
R0Y00
left a comment
There was a problem hiding this comment.
Independent review of 728b5fe integrated over main 7364e6a, tree a63cbe956636157d3cab71a4d025619540f81bc0. The VOP3 selector reads the requested VGPR halves before abs/neg and preserves the other destination half. The three refusal cases still reject selected non-VGPR operands, DPP on FMAC and clamp on the new op_sel path. The replay checks 14 exact result words across two groups and all guards.
Debug and Release /O2 each passed all nine tested entries, including the existing packed F16 and slot-67 wave-size checks. Windows 11 26200.9974, RTX 4060 Laptop driver 32.0.16.1656. No skips. Main has since added #3229's runtime-only output diagnostics and its fixture, outside the compiler and standalone replay inputs tested here.
ctest --preset dev --no-tests=error --output-on-failure -j 1 -R '^native_(fma_f16_.*|packed_f16_inline_(ir|controls|compute_hardware)|slot67_wave_size_hardware)$'
Fixes #3233. Part of #2935. Target branch
main.Change (
src/gfx1013_direct_compute.inl, the binary16 FMA lowering inDirectCompute::float_alu): VOP3v_fma_f16acceptsop_sel.op_sel: "the last value controls destination", 0 selects the low bits and 1 the high bits). That page does not say what happens to the other destination half. Keeping it mirrors whatmainalready does for the low-half write. I have not measured it on console hardware.op_selon an SGPR or constant source, with the new message "unsupported v_fma_f16 high-half op_sel on non-VGPR source";op_selwith clamp;v_fmac_f16withop_sel;tests/native_fma_f16_check.py: the one refusal control that used a VGPR source selection now uses an inline-constant source, which stays refused.Tests. The setup was Windows 11 with an NVIDIA GeForce RTX 5080 and DXC from the Windows SDK 10.0.26100, on
main14d56502plus this commit.native_fma_f16_opsel_irandnative_fma_f16_opsel_hardware(wave32 request, groups 0 and 1, EXEC set before the per-lane setup) cover the seven forms found in the captured requests.0xABCD1234, so a wrong destination half also changes the kept half.tests/f16_packed_model.py:0xABCD4980,0xABCD4880,0xABCD4A80,0x4E001234,0x4D001234,0x4CC01234and0x45001234.v_fmac_f16DPP, and clamp withop_sel.main'snative_compute_ir_dump, the new test fails with "unsupported v_fma_f16 high-half op_sel".-R "native_fma_f16|native_f16|native_sdwa_f16|native_packed|native_cvt_f16|native_direct_container".Measured with
compile_dxil --jobs 8 gfx1013-direct-cs@36 --requests, onmain14d56502and with this commit.AI-assisted.