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

Author: Qiang Yu <[email protected]>
Date:   Mon Sep  4 14:11:31 2023 +0800

radeonsi: stop llvm context creation when use aco

Reviewed-by: Marek Olšák <[email protected]>
Signed-off-by: Qiang Yu <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25632>

---

 src/gallium/drivers/radeonsi/si_compute.c         |  2 +-
 src/gallium/drivers/radeonsi/si_pipe.c            | 20 +++++++++++---------
 src/gallium/drivers/radeonsi/si_state_shaders.cpp |  6 +++---
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_compute.c 
b/src/gallium/drivers/radeonsi/si_compute.c
index ce3e29235cb..ea3d960959e 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -100,7 +100,7 @@ static void si_create_compute_state_async(void *job, void 
*gdata, int thread_ind
    assert(thread_index < ARRAY_SIZE(sscreen->compiler));
    compiler = &sscreen->compiler[thread_index];
 
-   if (!*compiler)
+   if (!sscreen->use_aco && !*compiler)
       *compiler = si_create_llvm_compiler(sscreen);
 
    assert(program->ir_type == PIPE_SHADER_IR_NIR);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
b/src/gallium/drivers/radeonsi/si_pipe.c
index f44151616e0..4e968fbdbf2 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -1205,15 +1205,17 @@ static struct pipe_screen 
*radeonsi_screen_create_impl(struct radeon_winsys *ws,
       return NULL;
    }
 
-   /* Initialize just one compiler instance to check for errors. The other 
compiler instances are
-    * initialized on demand.
-    */
-   sscreen->compiler[0] = si_create_llvm_compiler(sscreen);
-   if (!sscreen->compiler[0]) {
-      /* The callee prints the error message. */
-      FREE(sscreen->nir_options);
-      FREE(sscreen);
-      return NULL;
+   if (!sscreen->use_aco) {
+      /* Initialize just one compiler instance to check for errors. The other 
compiler instances
+       * are initialized on demand.
+       */
+      sscreen->compiler[0] = si_create_llvm_compiler(sscreen);
+      if (!sscreen->compiler[0]) {
+         /* The callee prints the error message. */
+         FREE(sscreen->nir_options);
+         FREE(sscreen);
+         return NULL;
+      }
    }
 
    util_idalloc_mt_init_tc(&sscreen->buffer_ids);
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.cpp 
b/src/gallium/drivers/radeonsi/si_state_shaders.cpp
index 14f9ef17ecb..a832bd7101b 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.cpp
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.cpp
@@ -2482,7 +2482,7 @@ static void si_build_shader_variant(struct si_shader 
*shader, int thread_index,
       compiler = &shader->compiler_ctx_state.compiler;
    }
 
-   if (!*compiler)
+   if (!sscreen->use_aco && !*compiler)
       *compiler = si_create_llvm_compiler(sscreen);
 
    if (unlikely(!si_create_shader_variant(sscreen, *compiler, shader, debug))) 
{
@@ -2698,7 +2698,7 @@ current_not_ready:
 
    util_queue_fence_init(&shader->ready);
 
-   if (!sctx->compiler)
+   if (!sscreen->use_aco && !sctx->compiler)
       sctx->compiler = si_create_llvm_compiler(sctx->screen);
 
    shader->selector = sel;
@@ -2908,7 +2908,7 @@ static void si_init_shader_selector_async(void *job, void 
*gdata, int thread_ind
    assert(thread_index < (int)ARRAY_SIZE(sscreen->compiler));
    compiler = &sscreen->compiler[thread_index];
 
-   if (!*compiler)
+   if (!sscreen->use_aco && !*compiler)
       *compiler = si_create_llvm_compiler(sscreen);
 
    /* Serialize NIR to save memory. Monolithic shader variants

Reply via email to