Mesa (master): vc4: Emit max number of temps in the shader-db output.

Eric Anholt anholt at kemper.freedesktop.org
Sat Feb 25 01:03:56 UTC 2017


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

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Feb 24 14:18:39 2017 -0800

vc4: Emit max number of temps in the shader-db output.

We need to be paying attention to optimization's impact on this -- even if
we reduce instruction count, increasing max temps in general is likely to
cause us to fail to register allocate on some shaders, which means that
those won't run at all.

---

 src/gallium/drivers/vc4/vc4_qir_live_variables.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/src/gallium/drivers/vc4/vc4_qir_live_variables.c b/src/gallium/drivers/vc4/vc4_qir_live_variables.c
index 330e1c8..7108b3e 100644
--- a/src/gallium/drivers/vc4/vc4_qir_live_variables.c
+++ b/src/gallium/drivers/vc4/vc4_qir_live_variables.c
@@ -327,4 +327,27 @@ qir_calculate_live_intervals(struct vc4_compile *c)
                 ;
 
         qir_compute_start_end(c, c->num_temps);
+
+        if (vc4_debug & VC4_DEBUG_SHADERDB) {
+                int last_ip = 0;
+                for (int i = 0; i < c->num_temps; i++)
+                        last_ip = MAX2(last_ip, c->temp_end[i]);
+
+                int reg_pressure = 0;
+                int max_reg_pressure = 0;
+                for (int i = 0; i < last_ip; i++) {
+                        for (int j = 0; j < c->num_temps; j++) {
+                                if (c->temp_start[j] == i)
+                                        reg_pressure++;
+                                if (c->temp_end[j] == i)
+                                        reg_pressure--;
+                        }
+                        max_reg_pressure = MAX2(max_reg_pressure, reg_pressure);
+                }
+
+                fprintf(stderr, "SHADER-DB: %s prog %d/%d: %d max temps\n",
+                        qir_get_stage_name(c->stage),
+                        c->program_id, c->variant_id,
+                        max_reg_pressure);
+        }
 }




More information about the mesa-commit mailing list