Summary: | nir: problem case for loop unrolling | ||
---|---|---|---|
Product: | Mesa | Reporter: | Caio Marcelo de Oliveira Filho <caio.oliveira> |
Component: | Mesa core | Assignee: | mesa-dev |
Status: | RESOLVED FIXED | QA Contact: | mesa-dev |
Severity: | normal | ||
Priority: | medium | ||
Version: | git | ||
Hardware: | Other | ||
OS: | All | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | Failing test case |
Was this fixed by the following commit? author Timothy Arceri <tarceri@itsqueeze.com> commit 463f849097193ad20e7622ddd740fd15b96f4277 nir: fix selection of loop terminator when two or more have the same limit We need to add loop terminators to the list in the order we come across them otherwise if two or more have the same exit condition we will select that last one rather than the first one even though its unreachable. This fix is for simple unrolls where we only have a single exit point. When unrolling these type of loops the unreachable terminators and their unreachable branch are removed prior to unrolling. Because of the logic change we also switch some list access in the complex unrolling logic to avoid breakage. Fixes: 6772a17acc8e ("nir: Add a loop analysis pass") Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> (In reply to Timothy Arceri from comment #1) > Was this fixed by the following commit? > > author Timothy Arceri <tarceri@itsqueeze.com> > commit 463f849097193ad20e7622ddd740fd15b96f4277 > > nir: fix selection of loop terminator when two or more have the same limit Yes. Thanks! |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.
Created attachment 140437 [details] Failing test case The following int i = 0; do { if (i == 1) { colour.g = 1.0; break; } i++; } while (i < 2); doesn't get unrolled properly and the green value is never written. If "i++" is moved before the "if (...)" block, then things work. This is a reduction for a problem reported last week by Karol Herbst. It is also the root cause for Piglit test tests/spec/glsl-1.10/execution/vs-loop-simple-unroll-induction-variable-inside-if-branch.shader_test to fail. Attached is a failing test case. From looking last week it seems there's something missing in the logic for counting the number of iterations (hence picking the right terminator for a loop).