[Mesa-dev] [PATCH v7 33/35] nvir/nir: add memory barriers

Karol Herbst kherbst at redhat.com
Mon Apr 16 13:26:13 UTC 2018


v5: add more barrier intrinsics

Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
 .../drivers/nouveau/codegen/nv50_ir_from_nir.cpp      | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
index 15d77256a06..e5d85940ca7 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_nir.cpp
@@ -506,6 +506,14 @@ Converter::getSubOp(nir_intrinsic_op op)
    CASE_OP_INTR_ATOM(and, AND);
    CASE_OP_INTR_ATOM(comp_swap, CAS);
    CASE_OP_INTR_ATOM(exchange, EXCH);
+   case nir_intrinsic_group_memory_barrier:
+   case nir_intrinsic_memory_barrier:
+   case nir_intrinsic_memory_barrier_atomic_counter:
+   case nir_intrinsic_memory_barrier_buffer:
+   case nir_intrinsic_memory_barrier_image:
+      return NV50_IR_SUBOP_MEMBAR(M, GL);
+   case nir_intrinsic_memory_barrier_shared:
+      return NV50_IR_SUBOP_MEMBAR(M, CTA);
    CASE_OP_INTR_ATOM(or, OR);
    case nir_intrinsic_image_var_atomic_max:
    CASE_OP_INTR_ATOM_S(imax, MAX);
@@ -2312,6 +2320,17 @@ Converter::visit(nir_intrinsic_instr *insn)
       bar->subOp = NV50_IR_SUBOP_BAR_SYNC;
       break;
    }
+   case nir_intrinsic_group_memory_barrier:
+   case nir_intrinsic_memory_barrier:
+   case nir_intrinsic_memory_barrier_atomic_counter:
+   case nir_intrinsic_memory_barrier_buffer:
+   case nir_intrinsic_memory_barrier_image:
+   case nir_intrinsic_memory_barrier_shared: {
+      Instruction *bar = mkOp(OP_MEMBAR, TYPE_NONE, NULL);
+      bar->fixed = 1;
+      bar->subOp = getSubOp(op);
+      break;
+   }
    default:
       ERROR("unknown nir_intrinsic_op %s\n", nir_intrinsic_infos[op].name);
       return false;
-- 
2.14.3



More information about the mesa-dev mailing list