<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Nov 1, 2017 at 12:09 PM, Jason Ekstrand <span dir="ltr"><<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Thu, Oct 12, 2017 at 11:38 AM, Jose Maria Casanova Crespo <span dir="ltr"><<a href="mailto:jmcasanova@igalia.com" target="_blank">jmcasanova@igalia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
 src/intel/compiler/brw_eu.h                    |  7 +++++<br>
 src/intel/compiler/brw_eu_def<wbr>ines.h            |  2 ++<br>
 src/intel/compiler/brw_eu_emi<wbr>t.c               | 41 ++++++++++++++++++++++++++<br>
 src/intel/compiler/brw_fs.<wbr>cpp                  | 10 +++++++<br>
 src/intel/compiler/brw_fs_cop<wbr>y_propagation.cpp |  2 ++<br>
 src/intel/compiler/brw_fs_gen<wbr>erator.cpp        |  5 ++++<br>
 src/intel/compiler/brw_fs_sur<wbr>face_builder.cpp  | 12 ++++++++<br>
 src/intel/compiler/brw_fs_sur<wbr>face_builder.h    |  5 ++++<br>
 src/intel/compiler/brw_<wbr>shader.cpp              |  6 ++++<br>
 9 files changed, 90 insertions(+)<br>
<br>
diff --git a/src/intel/compiler/brw_eu.h b/src/intel/compiler/brw_eu.h<br>
index b44ca0f518..ca1ff21a83 100644<br>
--- a/src/intel/compiler/brw_eu.h<br>
+++ b/src/intel/compiler/brw_eu.h<br>
@@ -476,6 +476,13 @@ brw_typed_surface_write(struct brw_codegen *p,<br>
                         unsigned num_channels);<br>
<br>
 void<br>
+brw_byte_scattered_read(struc<wbr>t brw_codegen *p,<br>
+                        struct brw_reg dst,<br>
+                        struct brw_reg payload,<br>
+                        struct brw_reg surface,<br>
+                        unsigned msg_length);<br>
+<br>
+void<br>
 brw_byte_scattered_write(stru<wbr>ct brw_codegen *p,<br>
                          struct brw_reg payload,<br>
                          struct brw_reg surface,<br>
diff --git a/src/intel/compiler/brw_eu_de<wbr>fines.h b/src/intel/compiler/brw_eu_de<wbr>fines.h<br>
index 9aac385ba7..c5dc5fd5fb 100644<br>
--- a/src/intel/compiler/brw_eu_de<wbr>fines.h<br>
+++ b/src/intel/compiler/brw_eu_de<wbr>fines.h<br>
@@ -397,6 +397,8 @@ enum opcode {<br>
     * opcode, but instead of taking a single payload blog they expect their<br>
     * arguments separately as individual sources, like untyped write/read.<br>
     */<br>
+   SHADER_OPCODE_BYTE_SCATTERED_<wbr>READ,<br>
+   SHADER_OPCODE_BYTE_SCATTERED_<wbr>READ_LOGICAL,<br>
    SHADER_OPCODE_BYTE_SCATTERED_W<wbr>RITE,<br>
    SHADER_OPCODE_BYTE_SCATTERED_W<wbr>RITE_LOGICAL,<br>
<br>
diff --git a/src/intel/compiler/brw_eu_em<wbr>it.c b/src/intel/compiler/brw_eu_em<wbr>it.c<br>
index 84d85be653..8c83d8b500 100644<br>
--- a/src/intel/compiler/brw_eu_em<wbr>it.c<br>
+++ b/src/intel/compiler/brw_eu_em<wbr>it.c<br>
@@ -2929,6 +2929,47 @@ brw_untyped_surface_write(stru<wbr>ct brw_codegen *p,<br>
       p, insn, num_channels);<br>
 }<br>
<br>
+<br>
+<br>
+static void<br>
+brw_set_dp_byte_scattered_rea<wbr>d_message(struct brw_codegen *p,<br>
+                                       struct brw_inst *insn)<br>
+{<br>
+<br>
+   const struct gen_device_info *devinfo = p->devinfo;<br>
+   /* Set mask of 32-bit channels to drop. */<br>
+   unsigned msg_control = GEN7_BYTE_SCATTERED_DATA_SIZE_<wbr>WORD << 2;<br></blockquote></div></div></div></div></div></blockquote><div><br></div><div>As I commented before, I don't think we want to make this assumption.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+   if (brw_inst_access_mode(devinfo, p->current) == BRW_ALIGN_1) {<br>
+      if (brw_inst_exec_size(devinfo, p->current) == BRW_EXECUTE_16)<br>
+         msg_control |= 1; /* SIMD16 mode */<br>
+      else<br>
+         msg_control |= 2; /* SIMD8 mode */<br></blockquote><div><br></div></div></div><div>Is this really supposed to be 2?  From my reading of the BDW docs, it looks like you want 1 and 0.  2 gives you 0 in the SIMD mode bit (which indicates SIMD8) and a 1 in a reserved MBZ bit.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+   }<br></blockquote><div><br></div><div>I think we probably want an else unreachable here.  Also, we want that for scattered_write.<br></div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+   brw_inst_set_dp_msg_type(devi<wbr>nfo, insn,<br>
+                            (devinfo->gen >= 8 || devinfo->is_haswell ?<br>
+                             HSW_DATAPORT_DC_PORT0_BYTE_SC<wbr>ATTERED_READ :<br>
+                             GEN7_DATAPORT_DC_BYTE_SCATTER<wbr>ED_READ));<br>
+   brw_inst_set_dp_msg_control(d<wbr>evinfo, insn, msg_control);<br>
+}<br>
+<br>
+void<br>
+brw_byte_scattered_read(struc<wbr>t brw_codegen *p,<br>
+                        struct brw_reg dst,<br>
+                        struct brw_reg payload,<br>
+                        struct brw_reg surface,<br>
+                        unsigned msg_length)<br>
+{<br>
+   const unsigned sfid =  GEN7_SFID_DATAPORT_DATA_CACHE;<br>
+   struct brw_inst *insn = brw_send_indirect_scattered_me<wbr>ssage(<br>
+      p, sfid, dst, payload, surface, msg_length,<br>
+      brw_surface_payload_size(p, 1, true, true),<br>
+      false);<br>
+<br>
+   brw_set_dp_byte_scattered_rea<wbr>d_message(p, insn);<br></blockquote><div><br></div></span><div>Again, I think we can inline this<br></div><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+}<br>
+<br>
 static void<br>
 brw_set_dp_byte_scattered_wri<wbr>te(struct brw_codegen *p,<br>
                                 struct brw_inst *insn)<br>
diff --git a/src/intel/compiler/brw_fs.cp<wbr>p b/src/intel/compiler/brw_fs.cp<wbr>p<br>
index e4a94ff053..bd0d32b741 100644<br>
--- a/src/intel/compiler/brw_fs.cp<wbr>p<br>
+++ b/src/intel/compiler/brw_fs.cp<wbr>p<br>
@@ -251,6 +251,7 @@ fs_inst::is_send_from_grf() const<br>
    case SHADER_OPCODE_UNTYPED_SURFACE_<wbr>READ:<br>
    case SHADER_OPCODE_UNTYPED_SURFACE_<wbr>WRITE:<br>
    case SHADER_OPCODE_BYTE_SCATTERED_W<wbr>RITE:<br>
+   case SHADER_OPCODE_BYTE_SCATTERED_R<wbr>EAD:<br>
    case SHADER_OPCODE_TYPED_ATOMIC:<br>
    case SHADER_OPCODE_TYPED_SURFACE_RE<wbr>AD:<br>
    case SHADER_OPCODE_TYPED_SURFACE_WR<wbr>ITE:<br>
@@ -733,6 +734,7 @@ fs_inst::components_read(unsig<wbr>ned i) const<br>
<br>
    case SHADER_OPCODE_UNTYPED_SURFACE_<wbr>READ_LOGICAL:<br>
    case SHADER_OPCODE_TYPED_SURFACE_RE<wbr>AD_LOGICAL:<br>
+   case SHADER_OPCODE_BYTE_SCATTERED_R<wbr>EAD_LOGICAL:<br>
       assert(src[3].file == IMM);<br>
       /* Surface coordinates. */<br>
       if (i == 0)<br>
@@ -800,6 +802,7 @@ fs_inst::size_read(int arg) const<br>
    case SHADER_OPCODE_TYPED_SURFACE_WR<wbr>ITE:<br>
    case FS_OPCODE_INTERPOLATE_AT_PER_S<wbr>LOT_OFFSET:<br>
    case SHADER_OPCODE_BYTE_SCATTERED_W<wbr>RITE:<br>
+   case SHADER_OPCODE_BYTE_SCATTERED_R<wbr>EAD:<br>
       if (arg == 0)<br>
          return mlen * REG_SIZE;<br>
       break;<br>
@@ -4527,6 +4530,12 @@ fs_visitor::lower_logical_send<wbr>s()<br>
                                     ibld.sample_mask_reg());<br>
          break;<br>
<br>
+      case SHADER_OPCODE_BYTE_SCATTERED_R<wbr>EAD_LOGICAL:<br>
+         lower_surface_logical_send(ib<wbr>ld, inst,<br>
+                                    SHADER_OPCODE_BYTE_SCATTERED_R<wbr>EAD,<br>
+                                    fs_reg());<br>
+         break;<br>
+<br>
       case SHADER_OPCODE_BYTE_SCATTERED_W<wbr>RITE_LOGICAL:<br>
          lower_surface_logical_send(ibl<wbr>d, inst,<br>
                                     SHADER_OPCODE_BYTE_SCATTERED_<wbr>WRITE,<br>
@@ -5018,6 +5027,7 @@ get_lowered_simd_width(const struct gen_device_info *devinfo,<br>
    case SHADER_OPCODE_UNTYPED_SURFACE_<wbr>READ_LOGICAL:<br>
    case SHADER_OPCODE_UNTYPED_SURFACE_<wbr>WRITE_LOGICAL:<br>
    case SHADER_OPCODE_BYTE_SCATTERED_W<wbr>RITE_LOGICAL:<br>
+   case SHADER_OPCODE_BYTE_SCATTERED_R<wbr>EAD_LOGICAL:<br>
       return MIN2(16, inst->exec_size);<br>
<br>
    case SHADER_OPCODE_URB_READ_SIMD8:<br>
diff --git a/src/intel/compiler/brw_fs_co<wbr>py_propagation.cpp b/src/intel/compiler/brw_fs_co<wbr>py_propagation.cpp<br>
index fcf4706b7a..d4d01d783c 100644<br>
--- a/src/intel/compiler/brw_fs_co<wbr>py_propagation.cpp<br>
+++ b/src/intel/compiler/brw_fs_co<wbr>py_propagation.cpp<br>
@@ -656,6 +656,7 @@ fs_visitor::try_constant_propa<wbr>gate(fs_inst *inst, acp_entry *entry)<br>
       case SHADER_OPCODE_TYPED_SURFACE_RE<wbr>AD:<br>
       case SHADER_OPCODE_TYPED_SURFACE_WR<wbr>ITE:<br>
       case SHADER_OPCODE_BYTE_SCATTERED_W<wbr>RITE:<br>
+      case SHADER_OPCODE_BYTE_SCATTERED_R<wbr>EAD:<br>
          /* We only propagate into the surface argument of the<br>
           * instruction. Everything else goes through LOAD_PAYLOAD.<br>
           */<br>
@@ -696,6 +697,7 @@ fs_visitor::try_constant_propa<wbr>gate(fs_inst *inst, acp_entry *entry)<br>
       case SHADER_OPCODE_TYPED_SURFACE_RE<wbr>AD_LOGICAL:<br>
       case SHADER_OPCODE_TYPED_SURFACE_WR<wbr>ITE_LOGICAL:<br>
       case SHADER_OPCODE_BYTE_SCATTERED_W<wbr>RITE_LOGICAL:<br>
+      case SHADER_OPCODE_BYTE_SCATTERED_R<wbr>EAD_LOGICAL:<br>
          inst->src[i] = val;<br>
          progress = true;<br>
          break;<br>
diff --git a/src/intel/compiler/brw_fs_ge<wbr>nerator.cpp b/src/intel/compiler/brw_fs_ge<wbr>nerator.cpp<br>
index 414da81287..c644524501 100644<br>
--- a/src/intel/compiler/brw_fs_ge<wbr>nerator.cpp<br>
+++ b/src/intel/compiler/brw_fs_ge<wbr>nerator.cpp<br>
@@ -2053,6 +2053,11 @@ fs_generator::generate_code(co<wbr>nst cfg_t *cfg, int dispatch_width)<br>
                                    inst->mlen, src[2].ud);<br>
          break;<br>
<br>
+      case SHADER_OPCODE_BYTE_SCATTERED_R<wbr>EAD:<br>
+         assert(src[2].file == BRW_IMMEDIATE_VALUE);<br>
+         brw_byte_scattered_read(p, dst, src[0], src[1], inst->mlen);<br>
+         break;<br>
+<br>
       case SHADER_OPCODE_BYTE_SCATTERED_W<wbr>RITE:<br>
          assert(src[2].file == BRW_IMMEDIATE_VALUE);<br>
          brw_byte_scattered_write(p, src[0], src[1], inst->mlen);<br>
diff --git a/src/intel/compiler/brw_fs_su<wbr>rface_builder.cpp b/src/intel/compiler/brw_fs_su<wbr>rface_builder.cpp<br>
index 5f529e9489..2b5c21fe46 100644<br>
--- a/src/intel/compiler/brw_fs_su<wbr>rface_builder.cpp<br>
+++ b/src/intel/compiler/brw_fs_su<wbr>rface_builder.cpp<br>
@@ -1207,5 +1207,17 @@ namespace brw {<br>
                    addr, src, surface, dims, size, 0, pred);<br>
       }<br>
<br>
+   fs_reg<br>
+      emit_byte_scattered_read(const fs_builder &bld,<br>
+                               const fs_reg &surface, const fs_reg &addr,<br>
+                               unsigned dims, unsigned size,<br>
+                               brw_predicate pred)<br>
+      {<br>
+         using namespace surface_access;<br>
+<br>
+         return emit_send(bld, SHADER_OPCODE_BYTE_SCATTERED_R<wbr>EAD_LOGICAL,<br>
+                          addr, fs_reg(), surface, dims, size, size, pred);<br>
+      }<br>
+<br>
    }<br>
 }<br>
diff --git a/src/intel/compiler/brw_fs_su<wbr>rface_builder.h b/src/intel/compiler/brw_fs_su<wbr>rface_builder.h<br>
index 913ffaee72..4e62433c64 100644<br>
--- a/src/intel/compiler/brw_fs_su<wbr>rface_builder.h<br>
+++ b/src/intel/compiler/brw_fs_su<wbr>rface_builder.h<br>
@@ -91,6 +91,11 @@ namespace brw {<br>
                                 const fs_reg &addr, const fs_reg &src,<br>
                                 unsigned dims, unsigned size,<br>
                                 brw_predicate pred = BRW_PREDICATE_NONE);<br>
+      fs_reg<br>
+      emit_byte_scattered_read(const fs_builder &bld,<br>
+                               const fs_reg &surface, const fs_reg &addr,<br>
+                               unsigned dims, unsigned size,<br>
+                               brw_predicate pred = BRW_PREDICATE_NONE);<br>
<br>
    }<br>
 }<br>
diff --git a/src/intel/compiler/brw_shade<wbr>r.cpp b/src/intel/compiler/brw_shade<wbr>r.cpp<br>
index ebaf586df4..69df84ec73 100644<br>
--- a/src/intel/compiler/brw_shade<wbr>r.cpp<br>
+++ b/src/intel/compiler/brw_shade<wbr>r.cpp<br>
@@ -297,6 +297,10 @@ brw_instruction_name(const struct gen_device_info *devinfo, enum opcode op)<br>
    case SHADER_OPCODE_MEMORY_FENCE:<br>
       return "memory_fence";<br>
<br>
+   case SHADER_OPCODE_BYTE_SCATTERED_R<wbr>EAD:<br>
+      return "byte_scattered_read";<br>
+   case SHADER_OPCODE_BYTE_SCATTERED_R<wbr>EAD_LOGICAL:<br>
+      return "byte_scattered_read_logical";<br>
    case SHADER_OPCODE_BYTE_SCATTERED_W<wbr>RITE:<br>
       return "byte_scattered_write";<br>
    case SHADER_OPCODE_BYTE_SCATTERED_W<wbr>RITE_LOGICAL:<br>
@@ -1029,6 +1033,8 @@ backend_instruction::is_volati<wbr>le() const<br>
    case SHADER_OPCODE_UNTYPED_SURFACE_<wbr>READ_LOGICAL:<br>
    case SHADER_OPCODE_TYPED_SURFACE_RE<wbr>AD:<br>
    case SHADER_OPCODE_TYPED_SURFACE_RE<wbr>AD_LOGICAL:<br>
+   case SHADER_OPCODE_BYTE_SCATTERED_R<wbr>EAD:<br>
+   case SHADER_OPCODE_BYTE_SCATTERED_R<wbr>EAD_LOGICAL:<br>
    case SHADER_OPCODE_URB_READ_SIMD8:<br>
    case SHADER_OPCODE_URB_READ_SIMD8_P<wbr>ER_SLOT:<br>
    case VEC4_OPCODE_URB_READ:<br>
<span class="m_-764564240844529312HOEnZb"><font color="#888888">--<br>
2.13.6<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div></div>