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

Author: Iago Toral Quiroga <[email protected]>
Date:   Mon Jan  9 08:13:06 2023 +0100

v3d: add a debug option to optimize shader compile times

Particularly, this makes compilation stop as soon as we get a
valid shader and doesn't try to optimize spilling by trying
fallback strategies.

Might come in handy to reduce CTS execution time, for example,
dEQP-VK.ssbo.layout.random.8bit.all_per_block_buffers.6 goes from
43m46.715s down to 15m15.068s.

Reviewed-by: Alejandro PiƱeiro <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20601>

---

 src/broadcom/common/v3d_debug.c | 2 ++
 src/broadcom/common/v3d_debug.h | 1 +
 src/broadcom/compiler/vir.c     | 3 ++-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/broadcom/common/v3d_debug.c b/src/broadcom/common/v3d_debug.c
index 254106784a7..caa2f305f1d 100644
--- a/src/broadcom/common/v3d_debug.c
+++ b/src/broadcom/common/v3d_debug.c
@@ -98,6 +98,8 @@ static const struct debug_named_value debug_control[] = {
 #endif
         { "no_merge_jobs", V3D_DEBUG_NO_MERGE_JOBS,
           "Don't try to merge subpasses in the same job even if they share 
framebuffer configuration (v3dv only)" },
+        { "opt_compile_time", V3D_DEBUG_OPT_COMPILE_TIME,
+          "Don't try to reduce shader spilling, might improve compile times 
with expensive shaders." },
         DEBUG_NAMED_VALUE_END
 };
 
diff --git a/src/broadcom/common/v3d_debug.h b/src/broadcom/common/v3d_debug.h
index df186605560..e5e6a6356cb 100644
--- a/src/broadcom/common/v3d_debug.h
+++ b/src/broadcom/common/v3d_debug.h
@@ -68,6 +68,7 @@ extern uint32_t v3d_mesa_debug;
 #define V3D_DEBUG_DOUBLE_BUFFER     (1 << 22)
 #define V3D_DEBUG_CACHE             (1 << 23)
 #define V3D_DEBUG_NO_MERGE_JOBS     (1 << 24)
+#define V3D_DEBUG_OPT_COMPILE_TIME  (1 << 25)
 
 #define V3D_DEBUG_SHADERS           (V3D_DEBUG_TGSI | V3D_DEBUG_NIR | \
                                      V3D_DEBUG_VIR | V3D_DEBUG_QPU | \
diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c
index 8f199dd341f..94550904ef1 100644
--- a/src/broadcom/compiler/vir.c
+++ b/src/broadcom/compiler/vir.c
@@ -1853,7 +1853,8 @@ uint64_t *v3d_compile(const struct v3d_compiler *compiler,
                  */
                 if (c->compilation_result == V3D_COMPILATION_SUCCEEDED) {
                         if (c->spills == 0 ||
-                            strategies[strat].min_threads == 4) {
+                            strategies[strat].min_threads == 4 ||
+                            V3D_DBG(OPT_COMPILE_TIME)) {
                                 best_c = c;
                                 break;
                         } else if (c->spills + c->fills <

Reply via email to