<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Shadertoy shader causing hang"
href="https://bugs.freedesktop.org/show_bug.cgi?id=111241#c6">Comment # 6</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Shadertoy shader causing hang"
href="https://bugs.freedesktop.org/show_bug.cgi?id=111241">bug 111241</a>
from <span class="vcard"><a class="email" href="mailto:pierre-eric.pelloux-prayer@amd.com" title="Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>"> <span class="fn">Pierre-Eric Pelloux-Prayer</span></a>
</span></b>
<pre>I've created a different shadertoy showing the problem:
<a href="https://www.shadertoy.com/view/Wt2SW1">https://www.shadertoy.com/view/Wt2SW1</a> (but this one doesn't hang the GPU).
The shader for "Buffer A" is:
0: MOV TEMP[0], SV[0]
1: MAD TEMP[0].y, SV[0], CONST[0][2].xxxx, CONST[0][2].yyyy
2: MOV OUT[0], IMM[0].xxxx
3: USEQ TEMP[1].x, CONST[0][1].xxxx, IMM[1].xxxx
4: UIF TEMP[1].xxxx
5: ADD TEMP[2], TEMP[2], -TEMP[2]
6: ELSE
[...]
13: MOV OUT[0], TEMP[2]
14: END
TEMP[2] is used before being assigned a value, so I suppose that's what allows
LLVM to turn line 5 in:
v_mov_b32_e32 v3, 0x7fc00000
v_mov_b32_e32 v2, 0x7fc00000
v_mov_b32_e32 v1, 0x7fc00000
v_mov_b32_e32 v0, 0x7fc00000
(ie: output is NaN)
A possible way to fix this is to transform "dst = x - x" operations in "dst =
0" which is what nir does in its nir_opt_algebraic pass.
I've open a MR to fix/discuss this issue:
<a href="https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1681">https://gitlab.freedesktop.org/mesa/mesa/merge_requests/1681</a></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>