intel/fs/gen12: Add codegen support for the SYNC instruction.
authorFrancisco Jerez <currojerez@riseup.net>
Wed, 4 Sep 2019 00:51:17 +0000 (17:51 -0700)
committerFrancisco Jerez <currojerez@riseup.net>
Fri, 11 Oct 2019 19:24:16 +0000 (12:24 -0700)
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/compiler/brw_eu.h
src/intel/compiler/brw_eu_defines.h
src/intel/compiler/brw_eu_emit.c
src/intel/compiler/brw_fs_generator.cpp

index 8476d090dd5c81597e5f87919d63c31fbc6ab151..654246d7fddb395207ac8f0537ed2d07e54a1e1b 100644 (file)
@@ -1080,6 +1080,8 @@ void brw_NOP(struct brw_codegen *p);
 
 void brw_WAIT(struct brw_codegen *p);
 
+void brw_SYNC(struct brw_codegen *p, enum tgl_sync_function func);
+
 /* Special case: there is never a destination, execution size will be
  * taken from src0:
  */
index 7252e0cb4b15790145212c65fb1b9ede76aaaa50..21bf8a9992399ad4995062f508712c3782cfdafa 100644 (file)
@@ -1004,6 +1004,14 @@ enum PACKED brw_width {
    BRW_WIDTH_16 = 4,
 };
 
+enum tgl_sync_function {
+   TGL_SYNC_NOP = 0x0,
+   TGL_SYNC_ALLRD = 0x2,
+   TGL_SYNC_ALLWR = 0x3,
+   TGL_SYNC_BAR = 0xe,
+   TGL_SYNC_HOST = 0xf
+};
+
 /**
  * Message target: Shared Function ID for where to SEND a message.
  *
index 7bbc5d30b983deae9bbdf303a2043645e87d3402..e5d212bdba4a9a1268b2b7197f2516e7c22e9975 100644 (file)
@@ -1271,9 +1271,11 @@ void brw_NOP(struct brw_codegen *p)
    brw_inst_set_opcode(p->devinfo, insn, BRW_OPCODE_NOP);
 }
 
-
-
-
+void brw_SYNC(struct brw_codegen *p, enum tgl_sync_function func)
+{
+   brw_inst *insn = next_insn(p, BRW_OPCODE_SYNC);
+   brw_inst_set_cond_modifier(p->devinfo, insn, func);
+}
 
 /***********************************************************************
  * Comparisons, if/else/endif
index 2f6309750bd471339dc40806bca296e344b41936..f19255f52d488abfda602d1162db4eef6382cd87 100644 (file)
@@ -1755,6 +1755,10 @@ fs_generator::generate_code(const cfg_t *cfg, int dispatch_width,
       assert(inst->mlen <= BRW_MAX_MSG_LENGTH);
 
       switch (inst->opcode) {
+      case BRW_OPCODE_SYNC:
+         assert(src[0].file == BRW_IMMEDIATE_VALUE);
+         brw_SYNC(p, tgl_sync_function(src[0].ud));
+         break;
       case BRW_OPCODE_MOV:
         brw_MOV(p, dst, src[0]);
         break;