fix(shader): translate v_fma_mix_f32 as a fused multiply-add #1878
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1878"
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-08T22:40:18Z.
What
v_fma_mix_f32(VOP3P 0x20) decodes toVFmaF32but was translated as a separately rounded multiply-add (FPMad32).roundsProductSeparatelyonly looks at the opcode id, and 0x20 is alsov_madmk_f32's VOP2 id. VOP3P instructions now never take the separately rounded path.On RDNA2 (gfx1035), measured with the HW oracle,
v_fma_mix_f32with f32 sources is fused. It gives the same bits asv_fma_f32, whilev_mul_f32followed byv_add_f32differs:v_fma_mix_f32v_fma_f320x3f800001,0x3f7ffffe,0xbf8000000xa88000000xa88000000x000000000x3fa00001,0x40400001,0xc07000010x34e000010x34e000010x35000000v_fma_mixlo_f16/v_fma_mixhi_f16already usedFPFma32.This also makes the f32 denormal flush from #1850 apply to
v_fma_mix_f32, as its TechnicalDebt line already says: the flush classification also skips the separately rounded forms.Tested
Linux (CachyOS, GCC), full Release ctest 493/493.
vector_fused_multiply_addnow also decodes and translatesv_fma_mix_f32with f32 sources and withop_sel_hi:[1,0,1], and requires oneFPFma32and noFPMad32. It fails without the fix. That test pins the IR routing rather than values, like its existing VOP2 cases, because a value test can't tell fused from split: Vulkan lets a driver splitFmainto a multiply and an add.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 Deftera186 on 2026-10-09T02:19:02Z.
This duplicates #1445, opened 16 hours earlier with the same fix (
roundsProductSeparatelyskipping VOP3P) on the same branch name. pr-overlap missed it becausetools/pr_overlap.pyonly lists the 200 newest open PRs (gh pr list -L 200). At the 22:42 UTC run, 326 newer PRs were open, so #1445 was never compared. Merging both heads on that run's base (42e91486) conflicts inVectorInstructions.cpp, so the pair would have been reported otherwise. #1325 removes that cap.