nir_to_tgsi: Enable fdot_replicates flag.
authorEmma Anholt <emma@anholt.net>
Tue, 14 Dec 2021 22:35:03 +0000 (14:35 -0800)
committerMarge Bot <emma+marge@anholt.net>
Fri, 7 Jan 2022 09:58:24 +0000 (09:58 +0000)
commit558a6006299544ee5f77843f094015c62558f4ad
treef288886e9a2c3bdb2ed6c4ce2d1632335b8382fe
parent85d7d520b993579ebebaa1c279e7d93015223d8f
nir_to_tgsi: Enable fdot_replicates flag.

That's how the TGSI math opcodes work.

This lets lower_vec_to_regs coalesce the DP output into the .yzw channels,
giving an impressive shader-db win on softpipe:

total instructions in shared programs: 2929840 -> 2794036 (-4.64%)
instructions in affected programs: 1651438 -> 1515634 (-8.22%)
total temps in shared programs: 372730 -> 332744 (-10.73%)
temps in affected programs: 118151 -> 78165 (-33.84%)

and a minor one on r300:

total instructions in shared programs: 51238 -> 51149 (-0.17%)
instructions in affected programs: 2621 -> 2532 (-3.40%)
total vinst in shared programs: 15655 -> 15618 (-0.24%)
vinst in affected programs: 468 -> 431 (-7.91%)
total temps in shared programs: 9838 -> 9828 (-0.10%)
temps in affected programs: 59 -> 49 (-16.95%)

and a bigger one on i915g:
total instructions in shared programs: 398064 -> 395901 (-0.54%)
instructions in affected programs: 29271 -> 27108 (-7.39%)
total tex_indirect in shared programs: 12261 -> 12233 (-0.23%)
tex_indirect in affected programs: 98 -> 70 (-28.57%)
LOST:   0
GAINED: 5

The r300 change is less impressive because it does some backend copy-prop,
but also because intermediate storage of DPs now takes a vec4 instead of a
scalar.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14200>
src/compiler/nir/nir_builder_opcodes_h.py
src/gallium/auxiliary/nir/nir_to_tgsi.c
src/gallium/drivers/i915/i915_screen.c
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/softpipe/sp_screen.c