<div dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Jan 15, 2019 at 7:54 AM Iago Toral Quiroga <<a href="mailto:itoral@igalia.com">itoral@igalia.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">From the Skylake PRM, Extended Math Function:<br>
<br>
  "The execution size must be no more than 8 when half-floats<br>
   are used in source or destination operand."<br>
<br>
Earlier generations do not support Extended Math with half-float.<br>
<br>
v2:<br>
 - Rewrite the code to make it more readable (Jason).<br>
<br>
v3:<br>
 - Use if-ladders or just if+return exclusively (Topi).<br>
<br>
Reviewed-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com" target="_blank">topi.pohjolainen@intel.com</a>> (v1)<br>
---<br>
 src/intel/compiler/brw_fs.cpp | 27 ++++++++++++++++++---------<br>
 1 file changed, 18 insertions(+), 9 deletions(-)<br>
<br>
diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp<br>
index 0359eb079f7..0b3ec94e2d2 100644<br>
--- a/src/intel/compiler/brw_fs.cpp<br>
+++ b/src/intel/compiler/brw_fs.cpp<br>
@@ -5493,18 +5493,27 @@ get_lowered_simd_width(const struct gen_device_info *devinfo,<br>
    case SHADER_OPCODE_EXP2:<br>
    case SHADER_OPCODE_LOG2:<br>
    case SHADER_OPCODE_SIN:<br>
-   case SHADER_OPCODE_COS:<br>
+   case SHADER_OPCODE_COS: {<br>
       /* Unary extended math instructions are limited to SIMD8 on Gen4 and<br>
-       * Gen6.<br>
+       * Gen6. Extended Math Function is limited to SIMD8 with half-float.<br>
        */<br>
-      return (devinfo->gen >= 7 ? MIN2(16, inst->exec_size) :<br>
-              devinfo->gen == 5 || devinfo->is_g4x ? MIN2(16, inst->exec_size) :<br>
-              MIN2(8, inst->exec_size));<br>
+      if (devinfo->gen == 6 || (devinfo->gen == 4 && !devinfo->is_g4x))<br>
+         return MIN2(8, inst->exec_size);<br>
+      if (inst->dst.type == BRW_REGISTER_TYPE_HF)<br>
+         return MIN2(8, inst->exec_size);<br>
+      return MIN2(16, inst->exec_size);<br>
+   }<br>
<br>
-   case SHADER_OPCODE_POW:<br>
-      /* SIMD16 is only allowed on Gen7+. */<br>
-      return (devinfo->gen >= 7 ? MIN2(16, inst->exec_size) :<br>
-              MIN2(8, inst->exec_size));<br>
+   case SHADER_OPCODE_POW: {<br>
+      /* SIMD16 is only allowed on Gen7+. Extended Math Function is limited<br>
+       * to SIMD8 with half-float<br>
+       */<br>
+      if (devinfo->gen < 7)<br>
+         return MIN2(8, inst->exec_size);<br>
+      if (inst->dst.type == BRW_REGISTER_TYPE_HF)<br>
+         return MIN2(8, inst->exec_size);<br>
+      return MIN2(16, inst->exec_size);<br>
+   }<br>
<br>
    case SHADER_OPCODE_INT_QUOTIENT:<br>
    case SHADER_OPCODE_INT_REMAINDER:<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<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/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>