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

Author: Mike Blumenkrantz <[email protected]>
Date:   Fri Feb 10 09:01:48 2023 -0500

zink: sync LTO compiles for GPL pipelines on shader free

this avoids invalid access

affects:
KHR-Single-GL46.arrays_of_arrays_gl.InteractionStorageBuffers2

Fixes: 41ffb15de56 ("zink: implement async gfx precompile")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21246>

---

 src/gallium/drivers/zink/zink_compiler.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/gallium/drivers/zink/zink_compiler.c 
b/src/gallium/drivers/zink/zink_compiler.c
index 73b87f1f1f2..15db3e85dac 100644
--- a/src/gallium/drivers/zink/zink_compiler.c
+++ b/src/gallium/drivers/zink/zink_compiler.c
@@ -4502,6 +4502,16 @@ zink_shader_free(struct zink_screen *screen, struct 
zink_shader *shader)
          simple_mtx_unlock(&prog->ctx->program_lock[idx]);
          util_queue_fence_wait(&prog->base.cache_fence);
 
+         for (unsigned r = 0; r < ARRAY_SIZE(prog->pipelines); r++) {
+            for (int i = 0; i < ARRAY_SIZE(prog->pipelines[0]); ++i) {
+               hash_table_foreach(&prog->pipelines[r][i], entry) {
+                  struct zink_gfx_pipeline_cache_entry *pc_entry = entry->data;
+
+                  util_queue_fence_wait(&pc_entry->fence);
+               }
+            }
+         }
+
          while (util_dynarray_contains(&shader->pipeline_libs, struct 
zink_gfx_lib_cache*)) {
             struct zink_gfx_lib_cache *libs = 
util_dynarray_pop(&shader->pipeline_libs, struct zink_gfx_lib_cache*);
             if (!libs->removed) {

Reply via email to