summaryrefslogtreecommitdiff
path: root/src/broadcom/compiler/v3d_compiler.h
diff options
context:
space:
mode:
authorIago Toral Quiroga <itoral@igalia.com>2021-02-16 09:07:04 +0100
committerIago Toral Quiroga <itoral@igalia.com>2021-02-17 09:01:01 +0100
commit14af7b30855745b3b3aca7bc33a4507b73467a88 (patch)
tree2298673957c5355818983e987df1a9d2840b3251 /src/broadcom/compiler/v3d_compiler.h
parent8dd54778fa0f2b27f453df56c2f62c17dfadd7e4 (diff)
broadcom/compiler: don't emit redundant ldunif
If we emit a new uniform and that uniform has already been emitted in the same block we can just reuse that. There is a balancing game here between reducing ldunif instructions and not increasing register pressure too much though, so we put a limit to how far back we are willing to look for a previous definition of the uniform. Based on shader-db results, 20 instructions produces best results. total instructions in shared programs: 14928266 -> 14907432 (-0.14%) instructions in affected programs: 6431841 -> 6411007 (-0.32%) helped: 15270 HURT: 10772 Instructions are helped. total uniforms in shared programs: 3944672 -> 3840276 (-2.65%) uniforms in affected programs: 1827184 -> 1722788 (-5.71%) helped: 30423 HURT: 845 Uniforms are helped. total inst-and-stalls in shared programs: 14957813 -> 14936873 (-0.14%) inst-and-stalls in affected programs: 6475349 -> 6454409 (-0.32%) helped: 15287 HURT: 10852 Inst-and-stalls are helped. v2 (Eric): - consider ldunifrf too - check that no other instruction writes to the register Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com> Reviewed-by: Eric Anholt <eric@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9077>
Diffstat (limited to 'src/broadcom/compiler/v3d_compiler.h')
-rw-r--r--src/broadcom/compiler/v3d_compiler.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h
index e4f7ab49e98..4bec511346a 100644
--- a/src/broadcom/compiler/v3d_compiler.h
+++ b/src/broadcom/compiler/v3d_compiler.h
@@ -643,6 +643,13 @@ struct v3d_compile {
*/
bool disable_tmu_pipelining;
+ /* Emits ldunif for each new uniform, even if the uniform was already
+ * emitted in the same block. Useful to compile shaders with high
+ * register pressure or to disable the optimization during uniform
+ * spills.
+ */
+ bool disable_ldunif_opt;
+
/* State for whether we're executing on each channel currently. 0 if
* yes, otherwise a block number + 1 that the channel jumped to.
*/