ir3: Re-fuse ffmas after nir_lower_imul cleanup breaks them.
authorEmma Anholt <emma@anholt.net>
Mon, 3 Oct 2022 23:49:15 +0000 (16:49 -0700)
committerMarge Bot <emma+marge@anholt.net>
Thu, 10 Nov 2022 19:37:50 +0000 (19:37 +0000)
commit062d4d83e1570583fe24537d488f607db7781cce
treece7af60fd3e6986875cca9ab664f22ef24faed25
parenta39113b616099a7bcce9e62337731f040c7cad64
ir3: Re-fuse ffmas after nir_lower_imul cleanup breaks them.

The nir_opt_algebraic() call to clean up nir_lower_imul's split up mul
operations (stuff like "the top 16 bits were 0, no need to mul and add
that part") would trigger the options->fuse_ffma_* early ffma splitting,
so you need to call nir_opt_algebraic_late() again after that (which, in
turn, requires a DCE).

Gets us a lot more ffmas in Aztec Ruins high under zink/angle, but doesn't
seem to change perf.

shader-db highlights:

total instructions in shared programs: 11574843 -> 10999629 (-4.97%)
instructions in affected programs: 3308870 -> 2733656 (-17.38%)

total dwords in shared programs: 24344722 -> 23230122 (-4.58%)
dwords in affected programs: 6569568 -> 5454968 (-16.97%)

total full in shared programs: 762616 -> 762224 (-0.05%)
full in affected programs: 15505 -> 15113 (-2.53%)

total stp in shared programs: 4046 -> 4050 (0.10%)
stp in affected programs: 3372 -> 3376 (0.12%)

total ldp in shared programs: 2166 -> 2170 (0.18%)
ldp in affected programs: 1716 -> 1720 (0.23%)

total (ss) in shared programs: 219541 -> 216261 (-1.49%)
(ss) in affected programs: 23227 -> 19947 (-14.12%)

total (sy) in shared programs: 101633 -> 101927 (0.29%)
(sy) in affected programs: 8611 -> 8905 (3.41%)

total waves in shared programs: 1501942 -> 1501772 (-0.01%)
waves in affected programs: 1880 -> 1710 (-9.04%)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18946>
src/freedreno/ir3/ir3_context.c