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

Author: Sagar Ghuge <[email protected]>
Date:   Thu May 20 23:48:47 2021 -0700

intel/compiler: Add Wa_14014063774 for slm_fence

Before SLM fence compiler needs to insert SYNC.ALLWR in order to avoid
the SLM data race.

Signed-off-by: Sagar Ghuge <[email protected]>
Reviewed-by: Francisco Jerez <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22050>

---

 src/intel/compiler/brw_fs_nir.cpp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/intel/compiler/brw_fs_nir.cpp 
b/src/intel/compiler/brw_fs_nir.cpp
index 36d822eb747..89efccaad37 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -4424,6 +4424,16 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, 
nir_intrinsic_instr *instr
 
          if (slm_fence) {
             assert(opcode == SHADER_OPCODE_MEMORY_FENCE);
+            if (intel_needs_workaround(devinfo, 14014063774)) {
+               /* Wa_14014063774
+                *
+                * Before SLM fence compiler needs to insert SYNC.ALLWR in order
+                * to avoid the SLM data race.
+                */
+               ubld.exec_all().group(1, 0).emit(
+                  BRW_OPCODE_SYNC, ubld.null_reg_ud(),
+                  brw_imm_ud(TGL_SYNC_ALLWR));
+            }
             fence_regs[fence_regs_count++] =
                emit_fence(ubld, opcode, GFX12_SFID_SLM, desc,
                           true /* commit_enable */,

Reply via email to