<div dir="ltr"><div>Here's the output:<br><br>creating vs ...<br>shader compilation status: OK<br>creating fs ...<br>shader compilation status: OK<br>thread #0 (0;0) : ref = 16608<br>thread #1 (1;0) : ref = 27873<br>thread #2 (0;1) : ref = 16608<br>


thread #3 (1;1) : ref = 27877<br>results:<br> thread 0 (0, 0): expected = 16608, observed = 27876, FAIL<br> thread 1 (1, 0): expected = 27873, observed = 27873, OK<br> thread 2 (0, 1): expected = 16608, observed = 27876, FAIL<br>


 thread 3 (1, 1): expected = 27877, observed = 27877, OK<br><br></div>Marek<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 10, 2013 at 11:42 PM, Vadim Girlin <span dir="ltr"><<a href="mailto:vadimgirlin@gmail.com" target="_blank">vadimgirlin@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On 04/10/2013 01:53 PM, Marek Olšák wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
glsl-fs-loop-nested passes here.<br>
<br>
nstack is 3 and adding 4 to it doesn't help.<br>
</blockquote>
<br></div>
Ok, thanks.<br>
<br>
Also I wrote a simple test app that should reproduce the issue if it's really related to diverging control flow with nested loops and might more information about what's going wrong.<br>
<br>
The source is in the attachment and needs to be compiled with -lGL -lglut -lGLEW. The app renders four points and computes some value for each point in the loops similar to the transform feedback order test, but it doesn't use tfb. It should render four green or red squares depending on correctness of the result.<br>



<br>
Here is the correct output produced for me on evergreen:<br>
<br>
 thread 0 (0, 0): expected = 16608, observed = 16608, OK<br>
 thread 1 (1, 0): expected = 27873, observed = 27873, OK<br>
 thread 2 (0, 1): expected = 16608, observed = 16608, OK<br>
 thread 3 (1, 1): expected = 27877, observed = 27877, OK<br>
<br>
Please post the output if it fails on cayman.<br>
<br>
Vadim<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
<br>
Marek<br>
<br>
<br>
On Wed, Apr 10, 2013 at 8:46 AM, Vadim Girlin <<a href="mailto:vadimgirlin@gmail.com" target="_blank">vadimgirlin@gmail.com</a>> wrote:<br>
<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
On 04/10/2013 03:58 AM, Marek Olšák wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Vadim,<br>
<br>
your patch does not fix the test.<br>
<br>
</blockquote>
<br>
Hmm, I'm out of ideas then. Thanks for testing.<br>
<br>
I've checked the shader dump few times but I don't see anything obviously<br>
wrong there, and the same code (except the minor ALU grouping changes due<br>
to the VLIW4/VLIW5 difference) works fine for me on evergreen.<br>
<br>
According to the Martin's observations it looks like if the threads that<br>
shouldn't execute the loop body were incorrectly left in the active state.<br>
LOOP_BREAK should put them into the inactive-break state, but something<br>
goes wrong. Do the other piglit tests with nested loops (e.g.<br>
glsl-fs-loop-nested) work on cayman? Though possibly there are no other<br>
tests with the diverging loops as in this case.<br>
<br>
I'll try to write a simpler test with the diverging loops to see if the<br>
issue is really caused by the incorrect control flow handling, and to<br>
figure out the exact instruction that results in the incorrect active state.<br>
<br>
Also probably it worth checking if the stack size is correct for that<br>
shader (latest mesa should print nstack value in the shader disassemble<br>
header, I think it should be 3 for that shader) and maybe try adding some<br>
constant, e.g. 4 to the bc->nstack in the r600_bytecode_build just to be<br>
sure that we reserve enough of stack space, though I don't think stack size<br>
is the cause of this issue.<br>
<br>
Vadim<br>
<br>
<br>
<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
Marek<br>
<br>
<br>
On Tue, Apr 9, 2013 at 11:30 PM, Vadim Girlin <<a href="mailto:vadimgirlin@gmail.com" target="_blank">vadimgirlin@gmail.com</a>><br>
wrote:<br>
<br>
  On 04/09/2013 10:58 AM, Martin Andersson wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
<br>
  On Tue, Apr 9, 2013 at 3:18 AM, Marek Olšák <<a href="mailto:maraeo@gmail.com" target="_blank">maraeo@gmail.com</a>> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>
<br>
  Pushed, thanks. The transform feedback test still doesn't pass, but at<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
least<br>
the hardlocks are gone.<br>
<br>
<br>
</blockquote>
Thanks, I have looked into the other issue as well<br>
</div></div><a href="http://lists.freedesktop.org/****archives/mesa-dev/2013-March/**" target="_blank">http://lists.freedesktop.org/*<u></u>***archives/mesa-dev/2013-<u></u>March/**</a><br>
**036941.html<<a href="http://lists.freedesktop.org/**archives/mesa-dev/2013-March/**036941.html" target="_blank">http://lists.<u></u>freedesktop.org/**archives/<u></u>mesa-dev/2013-March/**036941.<u></u>html</a>><br>



<<a href="http://lists." target="_blank">http://lists.</a>**<a href="http://freedesktop.org/archives/mesa-**" target="_blank">freedesktop.<u></u>org/archives/mesa-**</a><br>
dev/2013-March/036941.html<<a href="http://lists.freedesktop.org/archives/mesa-dev/2013-March/036941.html" target="_blank">htt<u></u>p://lists.freedesktop.org/<u></u>archives/mesa-dev/2013-March/<u></u>036941.html</a>><div>


<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote>
<br>
<br>
The problem arises when there are nested loops. If I rework the code<br>
so there are<br>
no nested loops the issue disappears. At least one pixel also needs to<br>
enter the<br>
outer loop. The pixels that should enter the outer loop behaves<br>
correctly. It is those<br>
pixels that should not enter the outer loop that misbehaves. It does<br>
not matter if they<br>
also fails the test for the inner loop, they will still execute the<br>
instruction inside. That<br>
leads to the strange results for that test.<br>
<br>
<br>
</div></blockquote><div>
Please test the attached patch.<br>
<br>
Vadim<br>
<br>
<br>
  The strangeness is easier to see if the NUM_POINTS in the<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
ext_transform_feedback/<br>
order.c are run with smaller values,like 3, 6 and 9. Disable the code<br>
that fail the test<br>
and print starting_x, shift_reg_final and iteration_count.<br>
<br>
Marek, since you implemented transform feedback for r600, do you think<br>
the issue<br>
is with the tranform feedback code or the shader compiler or some other<br>
thing?<br>
<br>
//Martin<br></div>
______________________________<u></u>****_________________<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="http://lists.freedesktop.org/****mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/*<u></u>***mailman/listinfo/mesa-dev</a><<a href="http://lists.freedesktop.org/**mailman/listinfo/mesa-dev" target="_blank">h<u></u>ttp://lists.freedesktop.org/**<u></u>mailman/listinfo/mesa-dev</a>><br>



<htt**p://<a href="http://lists.freedesktop.org/**mailman/listinfo/mesa-dev" target="_blank">lists.freedesktop.<u></u>org/**mailman/listinfo/mesa-<u></u>dev</a><<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.<u></u>org/mailman/listinfo/mesa-dev</a>><br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
</blockquote>
<br>
<br>
<br>
</blockquote><div>
______________________________<u></u>**_________________<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="http://lists.freedesktop.org/**mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/*<u></u>*mailman/listinfo/mesa-dev</a><<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">htt<u></u>p://lists.freedesktop.org/<u></u>mailman/listinfo/mesa-dev</a>><br>



<br>
<br>
<br>
</div></blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote>
<br>
</blockquote></div><br></div></div>