<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, May 14, 2018 at 1:22 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"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Mon, May 14, 2018 at 1:05 PM, Samuel Pitoiset <span dir="ltr"><<a href="mailto:samuel.pitoiset@gmail.com" target="_blank">samuel.pitoiset@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">We should stop walking through the CFG when the inner loop's<br>
break block ends up as the same block as the outer loop's<br>
continue block because we are already going to visit it.<br>
<br>
This fixes the following assertion which ends up by crashing<br>
in RADV or ANV:<br>
<br>
SPIR-V parsing FAILED:<br>
In file ../src/compiler/spirv/vtn_cfg.<wbr>c:381<br>
block->node.link.next == NULL<br>
0 bytes into the SPIR-V binary<br>
<br>
This also fixes a crash with a camera shader from SteamVR.<br>
<br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=106090" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/s<wbr>how_bug.cgi?id=106090</a><br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=106504" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/s<wbr>how_bug.cgi?id=106504</a><br>
CC: 18.0 18.1 <<a href="mailto:mesa-stable@lists.freedesktop.org" target="_blank">mesa-stable@lists.freedesktop<wbr>.org</a>><br>
Signed-off-by: Samuel Pitoiset <<a href="mailto:samuel.pitoiset@gmail.com" target="_blank">samuel.pitoiset@gmail.com</a>><br>
---<br>
src/compiler/spirv/vtn_cfg.c | 7 +++++++<br>
1 file changed, 7 insertions(+)<br>
<br>
diff --git a/src/compiler/spirv/vtn_cfg.c b/src/compiler/spirv/vtn_cfg.c<br>
index e7d2f9ea61..28554e8c72 100644<br>
--- a/src/compiler/spirv/vtn_cfg.c<br>
+++ b/src/compiler/spirv/vtn_cfg.c<br>
@@ -374,6 +374,13 @@ vtn_cfg_walk_blocks(struct vtn_builder *b, struct list_head *cf_list,<br>
vtn_cfg_walk_blocks(b, &loop->cont_body, new_loop_cont, NULL, NULL,<br>
new_loop_break, NULL, block);<br>
<br>
+ /* Stop walking through the CFG when this inner loop's break block<br>
+ * ends up as the same block as the outer loop's continue block<br>
+ * because we are already going to visit it.<br>
+ */<br>
+ if (new_loop_break == loop_cont)<br>
+ return;<br></blockquote><div><br></div></div></div><div>I think this is mostly correct. However, I think what we really want is to call vtn_get_branch_type() and bail if the returnd branch type is not vtn_branch_type_none. Possibly with an assert like we have in switch case handling.</div></div></div></div></blockquote><div><br></div><div>In particular, I think loop continues and none are probably the only valid branch types. It's possible that a switch case fall-through would also be valid but I haven't thought about it long enough. That should be considered.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="HOEnZb"><font color="#888888"><div>--Jason<br></div></font></span><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
block = new_loop_break;<br>
continue;<br>
}<br>
<span class="m_8248679812827930261HOEnZb"><font color="#888888">-- <br>
2.17.0<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">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></span></div><br></div></div>
</blockquote></div><br></div></div>