summaryrefslogtreecommitdiffstats
path: root/src/compiler/Makefile.sources
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2019-05-20 11:22:12 -0700
committerIan Romanick <[email protected]>2019-05-31 08:47:03 -0700
commit3ee2e84c608a022d2b83fb6c7f4fa5b8a33fa10c (patch)
treea8195a365bb33e80a6d47661f7eacc7aab93ea51 /src/compiler/Makefile.sources
parent336eab063009ebc96c3625ef1b7cffb2501448ce (diff)
nir: Rematerialize compare instructions
On some architectures, Boolean values used to control conditional branches or condtional selection must be propagated into a flag. This generally means that a stored Boolean value must be compared with zero. Rather than force the generation of extra compares with zero, re-emit the original comparison instruction. This can save register pressure by not needing to store the Boolean value. There are several possible ares for future improvement to this pass: 1. Be more conservative. If both sources to the comparison instruction are non-constants, it may be better for register pressure to emit the extra compare. The current shader-db results on Intel GPUs (next commit) lead me to believe that this is not currently a problem. 2. Be less conservative. Currently the pass requires that all users of the comparison match the pattern. The idea is that after the pass is complete, no instruction will use the resulting Boolean value. The only uses will be of the flag value. It may be beneficial to relax this requirement in some cases. 3. Be less conservative. Also try to rematerialize comparisons used for discard_if intrinsics. After changing the way the Intel compiler generates cod e for discard_if (see MR!935), I tried implementing this already. The changes were pretty small. Instructions were helped in 19 shaders, but, overall, cycles were hurt. A commit "nir: Rematerialize comparisons for nir_intrinsic_discard_if too" is on my fd.o cgit. 4. Copy the preceeding ALU instruction. If the comparison is a comparison with zero, and it is the only user of a particular ALU instruction (e.g., (a+b) != 0.0), it may be a further improvment to also copy the preceeding ALU instruction. On Intel GPUs, this may enable cmod propagation to make additional progress. v2: Use much simpler method to get the prev_block for an if-statement. Suggested by Tim. Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/compiler/Makefile.sources')
-rw-r--r--src/compiler/Makefile.sources1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/compiler/Makefile.sources b/src/compiler/Makefile.sources
index 1b6dc25f1ed..0708b256feb 100644
--- a/src/compiler/Makefile.sources
+++ b/src/compiler/Makefile.sources
@@ -306,6 +306,7 @@ NIR_FILES = \
nir/nir_opt_move_comparisons.c \
nir/nir_opt_move_load_ubo.c \
nir/nir_opt_peephole_select.c \
+ nir/nir_opt_rematerialize_compares.c \
nir/nir_opt_remove_phis.c \
nir/nir_opt_shrink_load.c \
nir/nir_opt_trivial_continues.c \