<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Dec 5, 2016 at 5:12 PM, Timothy Arceri <span dir="ltr"><<a href="mailto:timothy.arceri@collabora.com" target="_blank">timothy.arceri@collabora.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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_<wbr>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 shaders,<br>
and 2 Kerbal Space program shaders that increase by 32 instructions.<br>
The changes seem to be caused be the difference in the GLSL IR vs<br>
NIR variable index lowering passes. The GLSL IR pass creates a<br>
simple if ladder, while the NIR pass implements a binary search.<br></blockquote><div><br></div><div>Fun fact. This patch helps the Gl43CSDof synmark test by about 12%. Aparently, when you have an array of 40 things, the binary search matters. :-)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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>
V2: remove the do_copy_propagation() call from the i965 GLSL IR<br>
linking code. This call was added in f7741c52111 but since we are<br>
moving the variable index lowering to NIR we no longer need it and<br>
can just rely on the nir copy propagation pass.<br>
---<br>
src/intel/vulkan/anv_pipeline.<wbr>c | 10 ----------<br>
src/mesa/drivers/dri/i965/brw_<wbr>link.cpp | 15 ---------------<br>
src/mesa/drivers/dri/i965/brw_<wbr>nir.c | 10 ++++++++++<br>
3 files changed, 10 insertions(+), 25 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/anv_<wbr>pipeline.c b/src/intel/vulkan/anv_<wbr>pipeline.c<br>
index 9b65e35..6b0a3c9 100644<br>
--- a/src/intel/vulkan/anv_<wbr>pipeline.c<br>
+++ b/src/intel/vulkan/anv_<wbr>pipeline.c<br>
@@ -177,16 +177,6 @@ anv_shader_compile_to_nir(<wbr>struct anv_device *device,<br>
<br>
nir_shader_gather_info(nir, entry_point->impl);<br>
<br>
- nir_variable_mode indirect_mask = 0;<br>
- if (compiler->glsl_compiler_<wbr>options[stage].<wbr>EmitNoIndirectInput)<br>
- indirect_mask |= nir_var_shader_in;<br>
- if (compiler->glsl_compiler_<wbr>options[stage].<wbr>EmitNoIndirectOutput)<br>
- indirect_mask |= nir_var_shader_out;<br>
- if (compiler->glsl_compiler_<wbr>options[stage].<wbr>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/<wbr>brw_link.cpp b/src/mesa/drivers/dri/i965/<wbr>brw_link.cpp<br>
index 3f6041b..7902133 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_link.cpp<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_link.cpp<br>
@@ -135,21 +135,6 @@ process_glsl_ir(struct brw_context *brw,<br>
lower_noise(shader->ir);<br>
lower_quadop_vector(shader-><wbr>ir, false);<br>
<br>
- do_copy_propagation(shader-><wbr>ir);<br>
-<br>
- bool lowered_variable_indexing =<br>
- lower_variable_index_to_cond_<wbr>assign(shader->Stage, shader->ir,<br>
- options->EmitNoIndirectInput,<br>
- options->EmitNoIndirectOutput,<br>
- options->EmitNoIndirectTemp,<br>
- options-><wbr>EmitNoIndirectUniform);<br>
-<br>
- if (unlikely(brw->perf_debug && lowered_variable_indexing)) {<br>
- perf_debug("Unsupported form of variable indexing in %s; falling "<br>
- "back to very inefficient code generation\n",<br>
- _mesa_shader_stage_to_abbrev(<wbr>shader->Stage));<br>
- }<br>
-<br>
bool progress;<br>
do {<br>
progress = false;<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_nir.c b/src/mesa/drivers/dri/i965/<wbr>brw_nir.c<br>
index 763e3ec..8768cee 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_nir.c<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_nir.c<br>
@@ -485,6 +485,16 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir)<br>
/* Lower a bunch of stuff */<br>
OPT_V(nir_lower_var_copies);<br>
<br>
+ nir_variable_mode indirect_mask = 0;<br>
+ if (compiler->glsl_compiler_<wbr>options[nir->stage].<wbr>EmitNoIndirectInput)<br>
+ indirect_mask |= nir_var_shader_in;<br>
+ if (compiler->glsl_compiler_<wbr>options[nir->stage].<wbr>EmitNoIndirectOutput)<br>
+ indirect_mask |= nir_var_shader_out;<br>
+ if (compiler->glsl_compiler_<wbr>options[nir->stage].<wbr>EmitNoIndirectTemp)<br>
+ indirect_mask |= nir_var_local;<br>
+<br>
+ nir_lower_indirect_derefs(nir, indirect_mask);<br>
+<br>
/* Get rid of split copies */<br>
nir = nir_optimize(nir, is_scalar);<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
2.7.4<br>
<br>
______________________________<wbr>_________________<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/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>