<div dir="ltr">The code changes look correct to me. I'm CCing matt in case he knows something about why this wouldn't work the way the docs say. (It is Sandy Bridge after all)<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 27, 2016 at 7:06 PM, Francisco Jerez <span dir="ltr"><<a href="mailto:currojerez@riseup.net" target="_blank">currojerez@riseup.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I haven't found any evidence that this isn't supported by the<br>
hardware, in fact according to the SNB hardware spec:<br>
<br>
"The supported regioning modes for math instructions are align16,<br>
align1 with the following restrictions:<br>
- Scalar source is supported.<br>
[...]<br>
- Source and destination offset must be the same, except the case of<br>
scalar source."<br>
---<br>
src/mesa/drivers/dri/i965/brw_eu_emit.c | 6 ++++--<br>
src/mesa/drivers/dri/i965/brw_fs_builder.h | 10 ++--------<br>
src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 9 ++-------<br>
3 files changed, 8 insertions(+), 17 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c<br>
index ee7462f..4debfd1 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c<br>
@@ -2000,8 +2000,10 @@ void gen6_math(struct brw_codegen *p,<br>
<br>
assert(dest.hstride == BRW_HORIZONTAL_STRIDE_1);<br>
if (devinfo->gen == 6) {<br>
- assert(src0.hstride == BRW_HORIZONTAL_STRIDE_1);<br>
- assert(src1.hstride == BRW_HORIZONTAL_STRIDE_1);<br>
+ assert(has_scalar_region(src0) ||<br>
+ src0.hstride == BRW_HORIZONTAL_STRIDE_1);<br>
+ assert(has_scalar_region(src1) ||<br>
+ src1.hstride == BRW_HORIZONTAL_STRIDE_1);<br>
}<br>
<br>
if (function == BRW_MATH_FUNCTION_INT_DIV_QUOTIENT ||<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_builder.h b/src/mesa/drivers/dri/i965/brw_fs_builder.h<br>
index f22903e..aef35f3 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_builder.h<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_builder.h<br>
@@ -621,20 +621,14 @@ namespace brw {<br>
src_reg<br>
fix_math_operand(const src_reg &src) const<br>
{<br>
- /* Can't do hstride == 0 args on gen6 math, so expand it out. We<br>
- * might be able to do better by doing execsize = 1 math and then<br>
- * expanding that result out, but we would need to be careful with<br>
- * masking.<br>
- *<br>
- * Gen6 hardware ignores source modifiers (negate and abs) on math<br>
+ /* Gen6 hardware ignores source modifiers (negate and abs) on math<br>
* instructions, so we also move to a temp to set those up.<br>
*<br>
* Gen7 relaxes most of the above restrictions, but still can't use IMM<br>
* operands to math<br>
*/<br>
if ((shader->devinfo->gen == 6 &&<br>
- (src.file == IMM || src.file == UNIFORM ||<br>
- src.abs || src.negate)) ||<br>
+ (src.file == IMM || src.abs || src.negate)) ||<br>
(shader->devinfo->gen == 7 && src.file == IMM)) {<br>
const dst_reg tmp = vgrf(src.type);<br>
MOV(tmp, src);<br>
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp<br>
index d88d62b..2a83eb9 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp<br>
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp<br>
@@ -578,14 +578,9 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry)<br>
break;<br>
/* fallthrough */<br>
case SHADER_OPCODE_POW:<br>
- /* Allow constant propagation into src1 (except on Gen 6), and let<br>
- * constant combining promote the constant on Gen < 8.<br>
- *<br>
- * While Gen 6 MATH can take a scalar source, its source and<br>
- * destination offsets must be equal and we cannot ensure that.<br>
+ /* Allow constant propagation into src1, and let constant combining<br>
+ * promote the constant on Gen < 8.<br>
*/<br>
- if (devinfo->gen == 6)<br>
- break;<br>
/* fallthrough */<br>
case BRW_OPCODE_BFI1:<br>
case BRW_OPCODE_ASR:<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.3<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">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>
</font></span></blockquote></div><br></div>