fix(shader): flush v_mac_legacy_f32 denormals as measured on gfx1010 #1290
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1290"
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 SirDarky on 2026-10-07T22:30:03Z.
What
v_mac_legacy_f32(VOP2 0x06, and its VOP3 form 0x106) measured the same as VOP3 0x140 on gfx1010 (#1281): the product is rounded before the add, f32 denormal sources, product and result are flushed to a zero of the same sign in every f32 denormal mode and both IEEE modes, and a zero factor gives a +0 product. NaN results follow the same rule on the bits. Before this change,mainrounded the product but left denormals and NaN bits to the driver, and TechnicalDebt listed it as not covered.It now shares
vFmaLegacyF32withv_mad_legacy_f32, with the accumulator as the addend.f32DenormalFlushForreturns 3 forVMacLegacyF32too.vMulLegacyF32loses itsaccumulatepath, since onlyv_mul_legacy_f32uses it now. That instruction is unchanged and still follows theFLOAT_MODEmodel.The new
MacLegacy.cppexecution test runs four encodings (VOP2, VOP3-src0, VOP3|src0| -|src1|, VOP2 with inline0) on the 32 rows ofFmaLegacy.cpp. It pins the measured results and compares NaN bits exactly.Float16Misc.cppskips its legacy columns for denormal rows, so it did not cover this. TechnicalDebt: the legacy-mad entry, the NaN line and the f32-denormal line now includev_mac_legacy_f32.Source of the semantics: measured on hardware, an AMD Radeon RX 5700 XT (gfx1010), with
tools/hw-oracle/template.sunchanged. It was assembled by the AMD Windows driver'samd_comgr_2.dlland launched through itsamdhip64_6.dllinstead oforacle.cand ROCr, as in #1281. 32 rows × 4 encodings, wave32 and wave64, IEEE 0 and 1, f32 denormal modes 0 to 3: all 16 combinations agree, except the signaling NaN rows, which are quieted only with IEEE=1. The raw output is thevop2_0x06part of the attachment in #1281.Tested
Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), AMD Radeon RX 5700 XT, CI configure flags, full
ctest --output-on-failure --timeout 120onmainc963432dplus #1281 and this change: 570 of 574 pass.agc_driver_pixel_interlock,agc_driver_sdwa_float_selectorsandagc_driver_sdwa_ldexp_f16fail on unmodifiedmainon this GPU (see #1281).video_out_flip_controlsexited with 0xc0000374 once; rerun six times, it was skipped five times and crashed once, so it is intermittent and unrelated.agc_driver_mac_legacy,agc_driver_fma_legacy,agc_driver_float16_misc,agc_driver_dpp_no_formandvector_mad_legacypass. With the translation from #1281 alone,agc_driver_mac_legacyfails (lane 26 (0x00000001, 0x3f800000, 0x80000000) v_mac_legacy_f32_e64 -src0 is 0x80000000, expected 0x00000000).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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-10T08:06:12Z.
#1281 is merged, so this now conflicts in
FloatInstructions.cpp,VectorInstructions.cppandTechnicalDebt.md. Please rebase onto main so only thev_mac_legacy_f32commit is left.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T09:05:29Z.
Rebased onto main as requested by @oneandonlydean: dropped the already merged #1281 commit, resolved the conflicts in
FloatInstructions.cppandTechnicalDebt.md, only thev_mac_legacy_f32commit is left.Checked: build and the Agc/AgcDriver ctest scope on the rebased tree (
agc_driver_mac_legacy,agc_driver_fma_legacy,vector_mad_legacypass), andagc_driver_mac_legacyfails without the translation change. The hardware numbers are the author's gfx1010 measurements (not reproducible on our RDNA2 oracle); merging on green CI.