<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Feb 14, 2017 at 11:29 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">The optimization in unpack_64 is clearly subsumed with the opt_algebraic<br>
optimizations in the previous commit. The pack optimization may not be<br>
quite handled by opt_algebraic but opt_algebraic should get the really<br>
bad cases. Also, it's been broken since it was merged and we've never<br>
noticed so it must not be doing anything.<br></blockquote><div><br></div><div>Ok, that's not quite fair. It has been broken since it was merged but the breakage is pretty hard to hit since it requires a NIR register. However, this doesn't really cause any regressions either since, prior to patch 1/5, it was basically never getting triggered.<br><br></div><div>I did look at some of the shaders mentioned in the bug as being the reason for this optimization and none of them were hurt by removing it (even after it was fixed). I think back-end copy-prop may have just gotten good enough to make it not needed.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
---<br>
src/mesa/drivers/dri/i965/brw_<wbr>fs_nir.cpp | 50 ------------------------------<wbr>--<br>
1 file changed, 50 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/<wbr>brw_fs_nir.cpp<br>
index 91c14eb..9647300 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_fs_nir.cpp<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_fs_nir.cpp<br>
@@ -1213,61 +1213,11 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)<br>
break;<br>
<br>
case nir_op_pack_64_2x32_split:<br>
- /* Optimize the common case where we are re-packing a double with<br>
- * the result of a previous double unpack. In this case we can take the<br>
- * 32-bit value to use in the re-pack from the original double and bypass<br>
- * the unpack operation.<br>
- */<br>
- for (int i = 0; i < 2; i++) {<br>
- if (!instr->src[i].src.is_ssa)<br>
- continue;<br>
-<br>
- const nir_instr *parent_instr = instr->src[i].src.ssa->parent_<wbr>instr;<br>
- if (parent_instr->type == nir_instr_type_alu)<br>
- continue;<br>
-<br>
- const nir_alu_instr *alu_parent = nir_instr_as_alu(parent_instr)<wbr>;<br>
- if (alu_parent->op == nir_op_unpack_64_2x32_split_x ||<br>
- alu_parent->op == nir_op_unpack_64_2x32_split_y)<br>
- continue;<br>
-<br>
- if (!alu_parent->src[0].src.is_<wbr>ssa)<br>
- continue;<br>
-<br>
- op[i] = get_nir_src(alu_parent->src[0]<wbr>.src);<br>
- op[i] = offset(retype(op[i], BRW_REGISTER_TYPE_DF), bld,<br>
- alu_parent->src[0].swizzle[<wbr>channel]);<br>
- if (alu_parent->op == nir_op_unpack_64_2x32_split_y)<br>
- op[i] = subscript(op[i], BRW_REGISTER_TYPE_UD, 1);<br>
- else<br>
- op[i] = subscript(op[i], BRW_REGISTER_TYPE_UD, 0);<br>
- }<br>
bld.emit(FS_OPCODE_PACK, result, op[0], op[1]);<br>
break;<br>
<br>
case nir_op_unpack_64_2x32_split_x:<br>
case nir_op_unpack_64_2x32_split_y: {<br>
- /* Optimize the common case where we are unpacking from a double we have<br>
- * previously packed. In this case we can just bypass the pack operation<br>
- * and source directly from its arguments.<br>
- */<br>
- unsigned index = (instr->op == nir_op_unpack_64_2x32_split_x) ? 0 : 1;<br>
- if (instr->src[0].src.is_ssa) {<br>
- nir_instr *parent_instr = instr->src[0].src.ssa->parent_<wbr>instr;<br>
- if (parent_instr->type == nir_instr_type_alu) {<br>
- nir_alu_instr *alu_parent = nir_instr_as_alu(parent_instr)<wbr>;<br>
- if (alu_parent->op == nir_op_pack_64_2x32_split &&<br>
- alu_parent->src[index].src.is_<wbr>ssa) {<br>
- op[0] = retype(get_nir_src(alu_parent-<wbr>>src[index].src),<br>
- BRW_REGISTER_TYPE_UD);<br>
- op[0] =<br>
- offset(op[0], bld, alu_parent->src[index].<wbr>swizzle[channel]);<br>
- bld.MOV(result, op[0]);<br>
- break;<br>
- }<br>
- }<br>
- }<br>
-<br>
if (instr->op == nir_op_unpack_64_2x32_split_x)<br>
bld.MOV(result, subscript(op[0], BRW_REGISTER_TYPE_UD, 0));<br>
else<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.0.400.gff86faf<br>
<br>
</font></span></blockquote></div><br></div></div>