zink: add a driver workaround to disable background compiles
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Thu, 20 Apr 2023 19:49:00 +0000 (15:49 -0400)
committerMarge Bot <emma+marge@anholt.net>
Mon, 24 Apr 2023 15:37:30 +0000 (15:37 +0000)
it's stupid to do optimized background compiles if the driver is going
to create the exact same pipeline, so add a workaround to disable
this behavior

should improve ci runtimes on lavapipe by some amount

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22613>

src/gallium/drivers/zink/zink_program.c
src/gallium/drivers/zink/zink_screen.c
src/gallium/drivers/zink/zink_types.h

index 5abca2f..be7b361 100644 (file)
@@ -786,7 +786,10 @@ optimized_compile_job(void *data, void *gdata, int thread_index)
 void
 zink_gfx_program_compile_queue(struct zink_context *ctx, struct zink_gfx_pipeline_cache_entry *pc_entry)
 {
-   util_queue_add_job(&zink_screen(ctx->base.screen)->cache_get_thread, pc_entry, &pc_entry->fence, optimized_compile_job, NULL, 0);
+   struct zink_screen *screen = zink_screen(ctx->base.screen);
+   if (screen->driver_workarounds.disable_optimized_compile)
+      return;
+   util_queue_add_job(&screen->cache_get_thread, pc_entry, &pc_entry->fence, optimized_compile_job, NULL, 0);
 }
 
 static void
index dec19dc..f736452 100644 (file)
@@ -2582,6 +2582,15 @@ init_driver_workarounds(struct zink_screen *screen)
    default:
       break;
    }
+
+   /* these drivers have no difference between unoptimized and optimized shader compilation */
+   switch (screen->info.driver_props.driverID) {
+   case VK_DRIVER_ID_MESA_LLVMPIPE:
+      screen->driver_workarounds.disable_optimized_compile = true;
+      break;
+   default:
+      break;
+   }
 }
 
 static struct disk_cache *
index e182efd..a528e30 100644 (file)
@@ -1458,6 +1458,7 @@ struct zink_screen {
        */
       bool broken_cache_semantics;
       bool implicit_sync;
+      bool disable_optimized_compile;
       bool always_feedback_loop;
       bool always_feedback_loop_zs;
       bool needs_sanitised_layer;