<div dir="ltr">Tested-by: Alex Smith <<a href="mailto:asmith@feralinteractive.com">asmith@feralinteractive.com</a>><div><br></div><div>Thanks!<br><div class="gmail_extra"><br><div class="gmail_quote">On 18 October 2017 at 23:27, Timothy Arceri <span dir="ltr"><<a href="mailto:tarceri@itsqueeze.com" target="_blank">tarceri@itsqueeze.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">It looks the original indirect mask was probably copied from<br>
ANV.<br>
<br>
</span><span class="gmail-">Sascha Willems demo results:<br>
<br>
tessellation ~4000 -> ~4200 fps<br>
<br>
</span>V2: continue lowering local indirect due to llvm deficiencies.<br>
<br>
Cc: Alex Smith <<a href="mailto:asmith@feralinteractive.com">asmith@feralinteractive.com</a>><br>
---<br>
 src/amd/vulkan/radv_shader.c | 27 ++++++++++++++++++++++++++-<br>
 1 file changed, 26 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c<br>
index 055787a705..faba0c50e9 100644<br>
--- a/src/amd/vulkan/radv_shader.c<br>
+++ b/src/amd/vulkan/radv_shader.c<br>
@@ -238,22 +238,47 @@ radv_shader_compile_to_nir(<wbr>struct radv_device *device,<br>
<span class="gmail-">                NIR_PASS_V(nir, nir_lower_constant_<wbr>initializers, ~0);<br>
                NIR_PASS_V(nir, nir_lower_system_values);<br>
                NIR_PASS_V(nir, nir_lower_clip_cull_distance_<wbr>arrays);<br>
        }<br>
<br>
        /* Vulkan uses the separate-shader linking model */<br>
        nir->info.separate_shader = true;<br>
<br>
        nir_shader_gather_info(nir, entry_point->impl);<br>
<br>
+       /* While it would be nice not to have this flag, we are constrained<br>
+        * by the reality that LLVM 5.0 doesn't have working VGPR indexing<br>
+        * on GFX9.<br>
+        */<br>
+       bool llvm_has_working_vgpr_indexing =<br>
+               device->physical_device->rad_<wbr>info.chip_class <= VI;<br>
+<br>
+       /* TODO: Indirect indexing of GS inputs is unimplemented.<br>
+        *<br>
+        * TCS and TES load inputs directly from LDS or offchip memory, so<br>
+        * indirect indexing is trivial.<br>
+        */<br>
        nir_variable_mode indirect_mask = 0;<br>
-       indirect_mask |= nir_var_shader_in;<br>
</span><span class="gmail-">+       if (nir->stage == MESA_SHADER_GEOMETRY ||<br>
+           (nir->stage != MESA_SHADER_TESS_CTRL &&<br>
+            nir->stage != MESA_SHADER_TESS_EVAL &&<br>
+            !llvm_has_working_vgpr_<wbr>indexing)) {<br>
+               indirect_mask |= nir_var_shader_in;<br>
+       }<br>
</span>+<br>
+       /* TODO: We shouldn't need to do this, however LLVM isn't currently<br>
+        * smart enough to handle indirects without causing excess spilling<br>
+        * causing the gpu to hang.<br>
+        *<br>
+        * See the following thread for more details of the problem:<br>
+        * <a href="https://lists.freedesktop.org/archives/mesa-dev/2017-July/162106.html" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>archives/mesa-dev/2017-July/<wbr>162106.html</a><br>
+        */<br>
        indirect_mask |= nir_var_local;<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
        nir_lower_indirect_derefs(nir, indirect_mask);<br>
<br>
        static const nir_lower_tex_options tex_options = {<br>
          .lower_txp = ~0,<br>
        };<br>
<br>
        nir_lower_tex(nir, &tex_options);<br>
<br>
</div></div><span class="gmail-HOEnZb"><font color="#888888">--<br>
2.13.6<br>
<br>
</font></span></blockquote></div><br></div></div></div>