Mesa (main): nir/lower_task_shader: insert barrier before/after shared memory read/write
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 22 11:27:36 UTC 2022
Module: Mesa
Branch: main
Commit: 49b8fffeed9dc9b6002d69cf16edffe059112daf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=49b8fffeed9dc9b6002d69cf16edffe059112daf
Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date: Mon Jun 20 15:41:38 2022 +0200
nir/lower_task_shader: insert barrier before/after shared memory read/write
Fixes: 8aff8d3dd42 ("nir: Add common task shader lowering to make the backend's job easier.")
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17143>
---
src/compiler/nir/nir_lower_task_shader.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/compiler/nir/nir_lower_task_shader.c b/src/compiler/nir/nir_lower_task_shader.c
index e242c0d1171..6d7040828fe 100644
--- a/src/compiler/nir/nir_lower_task_shader.c
+++ b/src/compiler/nir/nir_lower_task_shader.c
@@ -88,10 +88,23 @@ append_launch_mesh_workgroups_to_nv_task(nir_builder *b,
nir_ssa_def *zero = nir_imm_int(b, 0);
nir_store_shared(b, zero, zero, .base = s->task_count_shared_addr);
+ nir_scoped_barrier(b,
+ .execution_scope = NIR_SCOPE_WORKGROUP,
+ .memory_scope = NIR_SCOPE_WORKGROUP,
+ .memory_semantics = NIR_MEMORY_RELEASE,
+ .memory_modes = nir_var_mem_shared);
+
/* At the end of the shader, read the task count from shared memory
* and emit launch_mesh_workgroups.
*/
b->cursor = nir_after_cf_list(&b->impl->body);
+
+ nir_scoped_barrier(b,
+ .execution_scope = NIR_SCOPE_WORKGROUP,
+ .memory_scope = NIR_SCOPE_WORKGROUP,
+ .memory_semantics = NIR_MEMORY_ACQUIRE,
+ .memory_modes = nir_var_mem_shared);
+
nir_ssa_def *task_count =
nir_load_shared(b, 1, 32, zero, .base = s->task_count_shared_addr);
More information about the mesa-commit
mailing list