[Bug 111069] Assertion fails in nir_opt_remove_phis.c during compilation of SPIR-V shader

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Jul 11 00:00:28 UTC 2019


https://bugs.freedesktop.org/show_bug.cgi?id=111069

Jason Ekstrand <jason at jlekstrand.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |caio.oliveira at intel.com,
                   |                            |cwabbott0 at gmail.com,
                   |                            |t_arceri at yahoo.com.au

--- Comment #2 from Jason Ekstrand <jason at jlekstrand.net> ---
Ugh... This one gets sticky.  The problem is a rather strange sequence of
events:

 1. nir_opt_dead_cf cleans up the outer `if (true) {`.
 2. nir_opt_if figures out the condition inside condition and turns `while
(gl_FragCoord.x < 0.0)` into `while (1)`.
 3. nir_opt_dead_cf cleans up an if statement with the break that was the only
exit from a loop.
 4. Because the deleted break was the only exit of the loop, now unreachable
code later in the shader still consumes values generated by the loop (dead_cf
only cleans up phis, not things which exit the dead code without a phi).
 5. Loop unrolling comes along and attempts to partially unroll the loop (I
think?  I'm not actually sure on this one.) and inserts LCSSA phis which have
no sources.
 6. nir_opt_remove_phis dies on the existence of phis with zero sources.

So what do we do about it?  Technically, 4. is ok because the way dominance is
defined, unreachable code is vacuously dominated by all other code in the
shader.  I see a few options:

 1. Detect when we've deleted the last exit of a loop and simply delete the
entire loop immediately in nir_opt_dead_cf.
 2. Don't generate LCSSA phis if the loop exit is unreachable
 3. Make nir_opt_remove_phis replace phis with zero sources with ssa_undef
instructions
 4. All of the above?

Thoughs?

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/intel-3d-bugs/attachments/20190711/0d6fcaed/attachment-0001.html>


More information about the intel-3d-bugs mailing list