agx: Insert jmp_exec_none instructions
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Wed, 30 Aug 2023 20:03:46 +0000 (16:03 -0400)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sun, 1 Oct 2023 16:32:11 +0000 (12:32 -0400)
commitd83d24e96af1dd82360fce5361c9fef25d3e657c
tree570979996284a8eb9407926c053978adf152dcbe
parent79c4d4213c2ad4eeec284c991946cc4b5f0956b5
agx: Insert jmp_exec_none instructions

With the exception of the backwards branch for loops, all the control flow we
insert during instruction selection just predicates instructions rather than
actually jumping around. That means, for example, we execute both sides of the
if even for a uniform condition! That's inefficient. The solution is insert
jmp_exec_none instructions after control flow in order to skip unexecuted
regions, which is much faster than predicating them out. However, jmp_exec_none
is costly in itself, so we need to use a heuristic to determine when it's
actually beneficial.

This uses a very simple heuristic for this purpose. However, it is a massive
performance speed-up for Dolphin uber shaders: 39fps -> 67fps at 2x resolution.
Nearly a doubling of performance!

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
src/asahi/compiler/agx_compile.c
src/asahi/compiler/agx_compiler.h
src/asahi/compiler/agx_opt_jmp_none.c [new file with mode: 0644]
src/asahi/compiler/meson.build