Mesa (master): broadcom/compiler: use a helper function to decide on TMU spilling

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 17 08:20:10 UTC 2021


Module: Mesa
Branch: master
Commit: df6c19c1fd88ef840be4c01e5de73d11570a849e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=df6c19c1fd88ef840be4c01e5de73d11570a849e

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Tue Feb 16 10:05:14 2021 +0100

broadcom/compiler: use a helper function to decide on TMU spilling

As we add more compiler optimizations that can increase register pressure
we may decide to disallow TMU spilling in more cases so it is probably
better to move this to its own helper function.

Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9077>

---

 src/broadcom/compiler/vir_register_allocate.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/broadcom/compiler/vir_register_allocate.c b/src/broadcom/compiler/vir_register_allocate.c
index 869df9efaba..efa86444e76 100644
--- a/src/broadcom/compiler/vir_register_allocate.c
+++ b/src/broadcom/compiler/vir_register_allocate.c
@@ -502,6 +502,17 @@ get_spill_batch_size(struct v3d_compile *c)
    return 20;
 }
 
+/* Don't emit spills using the TMU until we've dropped thread count first. Also,
+ * don't spill if we have enabled any other optimization that can lead to
+ * higher register pressure, such as TMU pipelining, we rather recompile without
+ * the optimization in that case.
+ */
+static inline bool
+tmu_spilling_allowed(struct v3d_compile *c, int thread_index)
+{
+        return thread_index == 0 && c->disable_tmu_pipelining;
+}
+
 #define CLASS_BIT_PHYS			(1 << 0)
 #define CLASS_BIT_ACC			(1 << 1)
 #define CLASS_BIT_R5			(1 << 4)
@@ -746,13 +757,7 @@ v3d_register_allocate(struct v3d_compile *c, bool *spilled)
                         if (i > 0 && !is_uniform)
                                 break;
 
-                        /* Don't emit spills using the TMU until we've dropped
-                         * thread count first. Also, don't spill if we have
-                         * enabled TMU pipelining, as that can make TMU spilling
-                         * pretty terrible.
-                         */
-                        if (is_uniform ||
-                            (thread_index == 0 && c->disable_tmu_pipelining)) {
+                        if (is_uniform || tmu_spilling_allowed(c, thread_index)) {
                                 v3d_spill_reg(c, map[node].temp);
 
                                 /* Ask the outer loop to call back in. */



More information about the mesa-commit mailing list