intel/compiler: Implement WaClearTDRRegBeforeEOTForNonPS.
authorRafael Antognolli <rafael.antognolli@intel.com>
Fri, 6 Oct 2017 18:41:54 +0000 (11:41 -0700)
committerRafael Antognolli <rafael.antognolli@intel.com>
Fri, 1 Dec 2017 19:27:27 +0000 (11:27 -0800)
The bspec describes:

   "WA: Clear tdr register before send EOT in all non-PS shader kernels

   mov(8) tdr0:ud 0x0:ud {NoMask}"

Signed-off-by: Rafael Antognolli <rafael.antognolli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/intel/compiler/brw_fs_generator.cpp
src/intel/compiler/brw_reg.h

index 28790c86a64179b3e082069abab531fe9367723c..4f90ec9dfff6c8de5f3ecd5e06e1a3257adaea6d 100644 (file)
@@ -573,6 +573,19 @@ fs_generator::generate_urb_write(fs_inst *inst, struct brw_reg payload)
 {
    brw_inst *insn;
 
+    /* WaClearTDRRegBeforeEOTForNonPS.
+     *
+     *   WA: Clear tdr register before send EOT in all non-PS shader kernels
+     *
+     *   mov(8) tdr0:ud 0x0:ud {NoMask}"
+     */
+   if (inst->eot && p->devinfo->gen == 10) {
+      brw_push_insn_state(p);
+      brw_set_default_mask_control(p, BRW_MASK_DISABLE);
+      brw_MOV(p, brw_tdr_reg(), brw_imm_uw(0));
+      brw_pop_insn_state(p);
+   }
+
    insn = brw_next_insn(p, BRW_OPCODE_SEND);
 
    brw_set_dest(p, insn, brw_null_reg());
index ec1045b612a4d807a168e86aea95ab9bf39bbfa7..a039c6f676c78be967dbde947182220d68feac71 100644 (file)
@@ -774,6 +774,12 @@ brw_address_reg(unsigned subnr)
    return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE, BRW_ARF_ADDRESS, subnr);
 }
 
+static inline struct brw_reg
+brw_tdr_reg(void)
+{
+   return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE, BRW_ARF_TDR, 0);
+}
+
 /* If/else instructions break in align16 mode if writemask & swizzle
  * aren't xyzw.  This goes against the convention for other scalar
  * regs: