<html><head></head><body><div>On Thu, 2016-09-15 at 17:55 -0700, Jason Ekstrand wrote:</div><blockquote type="cite"><p dir="ltr"></p>
<p dir="ltr">On Sep 15, 2016 4:31 PM, "Timothy Arceri" <<a href="mailto:timothy.arceri@collabora.com">timothy.arceri@collabora.com</a>> wrote:<br>
><br>
> On Thu, 2016-09-15 at 12:34 -0700, Jason Ekstrand wrote:<br>
> > On Sep 15, 2016 12:05 AM, "Timothy Arceri" <timothy.arceri@collabora.<br>
> > com> wrote:<br>
> > ><br>
> > > This moves the nir_lower_indirect_derefs() call into<br>
> > > brw_preprocess_nir() so thats is called by both OpenGL and Vulkan<br>
> > > and removes that call to the old GLSL IR pass<br>
> > > lower_variable_index_to_cond_assign()<br>
> > ><br>
> > > We want to do this pass in nir to be able to move loop unrolling<br>
> > > to nir.<br>
> > ><br>
> > > There is a increase of 1-3 instructions in a small number of<br>
> > shaders,<br>
> > > and 2 Kerbal Space program shaders that increase by 32<br>
> > instructions.<br>
> > ><br>
> > > Shader-db results BDW:<br>
> > ><br>
> > > total instructions in shared programs: 8705873 -> 8706194 (0.00%)<br>
> > > instructions in affected programs: 32515 -> 32836 (0.99%)<br>
> > > helped: 3<br>
> > > HURT: 79<br>
> > ><br>
> > > total cycles in shared programs: 74618120 -> 74583476 (-0.05%)<br>
> > > cycles in affected programs: 528104 -> 493460 (-6.56%)<br>
> > > helped: 47<br>
> > > HURT: 37<br>
> > ><br>
> > > LOST: 2<br>
> > > GAINED: 0<br>
> > > ---<br>
> > > src/intel/vulkan/anv_pipeline.c | 10 ----------<br>
> > > src/mesa/drivers/dri/i965/brw_link.cpp | 26 ++++++++++++++------<br>
> > ------<br>
> > > src/mesa/drivers/dri/i965/brw_nir.c | 12 ++++++++++++<br>
> > > 3 files changed, 26 insertions(+), 22 deletions(-)<br>
> > ><br>
> > > diff --git a/src/intel/vulkan/anv_pipeline.c<br>
> > b/src/intel/vulkan/anv_pipeline.c<br>
> > > index f96fe22..f292f0b 100644<br>
> > > --- a/src/intel/vulkan/anv_pipeline.c<br>
> > > +++ b/src/intel/vulkan/anv_pipeline.c<br>
> > > @@ -183,16 +183,6 @@ anv_shader_compile_to_nir(struct anv_device<br>
> > *device,<br>
> > ><br>
> > > nir_shader_gather_info(nir, entry_point->impl);<br>
> > ><br>
> > > - nir_variable_mode indirect_mask = 0;<br>
> > > - if (compiler->glsl_compiler_options[stage].EmitNoIndirectInput)<br>
> > > - indirect_mask |= nir_var_shader_in;<br>
> > > - if (compiler-<br>
> > >glsl_compiler_options[stage].EmitNoIndirectOutput)<br>
> > > - indirect_mask |= nir_var_shader_out;<br>
> > > - if (compiler->glsl_compiler_options[stage].EmitNoIndirectTemp)<br>
> > > - indirect_mask |= nir_var_local;<br>
> > > -<br>
> > > - nir_lower_indirect_derefs(nir, indirect_mask);<br>
> > > -<br>
> > > return nir;<br>
> > > }<br>
> > ><br>
> > > diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp<br>
> > b/src/mesa/drivers/dri/i965/brw_link.cpp<br>
> > > index 2b1fa61..41791d4 100644<br>
> > > --- a/src/mesa/drivers/dri/i965/brw_link.cpp<br>
> > > +++ b/src/mesa/drivers/dri/i965/brw_link.cpp<br>
> > > @@ -139,18 +139,20 @@ process_glsl_ir(gl_shader_stage stage,<br>
> > ><br>
> > > do_copy_propagation(shader->ir);<br>
> > ><br>
> > > - bool lowered_variable_indexing =<br>
> > > - lower_variable_index_to_cond_assign((gl_shader_stage)stage,<br>
> > > - shader->ir,<br>
> > > - options-<br>
> > >EmitNoIndirectInput,<br>
> > > - options-<br>
> > >EmitNoIndirectOutput,<br>
> > > - options-<br>
> > >EmitNoIndirectTemp,<br>
> > > - options-<br>
> > >EmitNoIndirectUniform);<br>
> > > -<br>
> > > - if (unlikely(brw->perf_debug && lowered_variable_indexing)) {<br>
> > > - perf_debug("Unsupported form of variable indexing in %s;<br>
> > falling "<br>
> > > - "back to very inefficient code generation\n",<br>
> > > - _mesa_shader_stage_to_abbrev(shader->Stage));<br>
> > > + if (brw->gen < 7) {<br>
> > > + bool lowered_variable_indexing =<br>
> > > + <br>
> > lower_variable_index_to_cond_assign((gl_shader_stage)stage,<br>
> > > + shader->ir,<br>
> > > + options-<br>
> > >EmitNoIndirectInput,<br>
> > > + options-<br>
> > >EmitNoIndirectOutput,<br>
> > > + options-<br>
> > >EmitNoIndirectTemp,<br>
> > > + options-<br>
> > >EmitNoIndirectUniform);<br>
> > > +<br>
> > > + if (unlikely(brw->perf_debug && lowered_variable_indexing))<br>
> > {<br>
> > > + perf_debug("Unsupported form of variable indexing in %s;<br>
> > falling "<br>
> > > + "back to very inefficient code generation\n",<br>
> > > + _mesa_shader_stage_to_abbrev(shader->Stage));<br>
> > > + }<br>
> > > }<br>
> > ><br>
> > > bool progress;:<br>
> > > diff --git a/src/mesa/drivers/dri/i965/brw_nir.c<br>
> > b/src/mesa/drivers/dri/i965/brw_nir.c<br>
> > > index e8dafae..af646ed 100644<br>
> > > --- a/src/mesa/drivers/dri/i965/brw_nir.c<br>
> > > +++ b/src/mesa/drivers/dri/i965/brw_nir.c<br>
> > > @@ -453,6 +453,18 @@ brw_preprocess_nir(const struct brw_compiler<br>
> > *compiler, nir_shader *nir)<br>
> > > /* Lower a bunch of stuff */<br>
> > > OPT_V(nir_lower_var_copies);<br>
> > ><br>
> > > + if (compiler->devinfo->gen > 6) {<br>
> > I think you want "> 7" here<br>
><br>
> It can be used with gen 7 and up. I could change it to >= 7 if that is<br>
> easier to parse but I think > 6 is functionally correct.</p>
<p dir="ltr">Hunh? You use GLSL for gen7. Why are we duplicating? Also, why can't this be used on sandy bridge and earlier?</p></blockquote><div><br></div><div>GLSL IR is used for the non scalar stages on gen7. See my answers to Connors questions:</div><div><a href="https://lists.freedesktop.org/archives/mesa-dev/2016-September/129108.html">https://lists.freedesktop.org/archives/mesa-dev/2016-September/129108.html</a></div><div><br></div><blockquote type="cite">
<pre>_______________________________________________
mesa-dev mailing list
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a>
</pre></blockquote></body></html>