[Bug 111241] Shadertoy shader causing hang

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Aug 14 12:56:48 UTC 2019


--- Comment #6 from Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com> ---
I've created a different shadertoy showing the problem:
https://www.shadertoy.com/view/Wt2SW1 (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:

You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20190814/3b03b1fd/attachment-0001.html>

More information about the dri-devel mailing list