<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Some infinite 'do{}while' loops lead mesa to an infinite compilation"
href="https://bugs.freedesktop.org/show_bug.cgi?id=111405#c4">Comment # 4</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Some infinite 'do{}while' loops lead mesa to an infinite compilation"
href="https://bugs.freedesktop.org/show_bug.cgi?id=111405">bug 111405</a>
from <span class="vcard"><a class="email" href="mailto:andrey.simiklit.1989@gmail.com" title="andrii simiklit <andrey.simiklit.1989@gmail.com>"> <span class="fn">andrii simiklit</span></a>
</span></b>
<pre>Well, looks like I found a root cause.
There is an infinite loop of the following optimizations:
nir_opt_if->nir_opt_constant_folding->nir_opt_if->nir_opt_constant_folding->...
For instance the original loop is:
<span class="quote">>vec1 32 ssa_1 = load_const (0x40000000 /* 2.000000 */)
>vec1 32 ssa_2 = load_const (0x41200000 /* 10.000000 */)
>...
>loop {
> vec1 32 ssa_10 = phi block_2: ssa_1, block_3: ssa_12
> vec1 32 ssa_12 = fmul ssa_10, ssa_2
>}</span >
nir_opt_if optimizes first loop iteration extracting fmul out of the loop:
<span class="quote">>vec1 32 ssa_0 = load_const (0x40000000 /* 2.000000 */)
>vec1 32 ssa_1 = load_const (0x41200000 /* 10.000000 */)
>...
>vec1 32 ssa_6 = fmul ssa_0, ssa_1
>loop {
> vec1 32 ssa_8 = phi block_1: ssa_6, block_2: ssa_10
> vec1 32 ssa_10 = fmul ssa_8, ssa_1
>}</span >
then nir_opt_constant_folding replaces fmul by constant value:
<span class="quote">>vec1 32 ssa_0 = load_const (0x40000000 /* 2.000000 */)
>vec1 32 ssa_1 = load_const (0x41200000 /* 10.000000 */)
>...
>vec1 32 ssa_16 = load_const (0x41a00000 /* 20.000000 */)
>loop {
> vec1 32 ssa_8 = phi block_1: ssa_16, block_2: ssa_10
> vec1 32 ssa_10 = fmul ssa_8, ssa_1
>}</span >
and nir_opt_if does it again extracts fmul out of the loop:
<span class="quote">>vec1 32 ssa_0 = load_const (0x40000000 /* 2.000000 */)
>vec1 32 ssa_1 = load_const (0x41200000 /* 10.000000 */)
>...
>vec1 32 ssa_16 = load_const (0x41a00000 /* 20.000000 */)
>vec1 32 ssa_17 = fmul ssa_16, ssa_1
>loop {
> vec1 32 ssa_19 = phi block_1: ssa_17, block_2: ssa_18
> vec1 32 ssa_18 = fmul ssa_19, ssa_1
>}</span >
again nir_opt_constant_folding replaces fmul by the constant
....
The simple solution is to disallow `opt_split_alu_of_phi` for infinity loops
but I can't say for sure that it is the best one at least for now. So I am
investigating nir_opt_if</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>