vc4: Avoid making temporaries for assignments to NIR registers

Graphics / Mesa 3D Graphics Library / Mesa - Eric Anholt [anholt.net] - 21 October 2016 16:12 UTC

Getting stores to NIR regs to not generate new MOVs is tricky, since the result we're trying to store into the NIR reg may have been from a conditional update of a temp, or a series of packed writes. The easiest solution seems to be to require that nir_store_dest()'s arg comes from an SSA temp.

This causes us to put in a few more temporary MOVs in the NIR SSA dest case, but copy propagation successfully cleans those up.

The shader-db change is modest:

total instructions in shared programs: 93774 -> 93598 (-0.19%) instructions in affected programs: 14760 -> 14584 (-1.19%) total estimated cycles in shared programs: 212135 -> 211946 (-0.09%) estimated cycles in affected programs: 27005 -> 26816 (-0.70%)

but I was seeing patterns in some register-allocation failures in DEQP tests that looked like the extra MOVs would increase maximum register pressure in loops. Some debug code indicates that that's not the case, though I'm still a bit confused by that result.

8ff4182 vc4: Avoid making temporaries for assignments to NIR registers.
src/gallium/drivers/vc4/vc4_program.c | 114 +++++++++++++++++++++++----------
1 file changed, 79 insertions(+), 35 deletions(-)

Upstream: cgit.freedesktop.org


  • Share