<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Feb 8, 2017 at 8:56 AM, Elie Tournier <span dir="ltr"><<a href="mailto:tournier.elie@gmail.com" target="_blank">tournier.elie@gmail.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">Explaining what is the "26" for.<br>
<br>
PS: I don't have git rights. Can you push this patch for me?<br>
<br>
Signed-off-by: Elie Tournier <<a href="mailto:tournier.elie@gmail.com" target="_blank">tournier.elie@gmail.com</a>><br>
---<br>
src/compiler/nir/nir_opt_<wbr>loop_unroll.c | 4 +++-<br>
1 file changed, 3 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/compiler/nir/nir_opt_loo<wbr>p_unroll.c b/src/compiler/nir/nir_opt_loo<wbr>p_unroll.c<br>
index 37cbced43d..2bb1a57791 100644<br>
--- a/src/compiler/nir/nir_opt_loo<wbr>p_unroll.c<br>+++ b/src/compiler/nir/nir_opt_loo<wbr>p_unroll.c<br>
@@ -26,6 +26,8 @@<br>
#include "nir_control_flow.h"<br>
#include "nir_loop_analyze.h"<br>
<br>
+#define GLSL_IR_UNROLL_LIMIT 26<br></blockquote><div><br></div><div>Maybe just call this LOOP_UNROLL_LIMIT? It's not exactly the same as the GLSL IR limit. Also, a comment would be good. How about:<br><br></div><div>This limit is chosen fairly arbitrarily. The GLSL IR limit is 25. However, due to slight differences in the way the two IRs count instructions, some loops that would unroll with GLSL IR fail to unroll if we set this to 25 so we set it to 26.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
/* Prepare this loop for unrolling by first converting to lcssa and then<br>
* converting the phis from the loops first block and the block that follows<br>
* the loop into regs. Partially converting out of SSA allows us to unroll<br>
@@ -460,7 +462,7 @@ is_loop_small_enough_to_unroll<wbr>(nir_shader *shader, nir_loop_info *li)<br>
return true;<br>
<br>
bool loop_not_too_large =<br>
- li->num_instructions * li->trip_count <= max_iter * 26;<br>
+ li->num_instructions * li->trip_count <= max_iter * GLSL_IR_UNROLL_LIMIT;<br>
<br>
return loop_not_too_large;<br>
}<br>
<span class="gmail-m_-702011133264154443HOEnZb"><font color="#888888">--<br>
2.11.0<br>
<br>
</font></span></blockquote></div><br></div></div>