On 22/06/17 01:42, Eero Tamminen wrote:
Hi,
On 21.06.2017 13:12, Timothy Arceri wrote:
The main reason these restriction exist is because glsl the loop
unrolling pass is super slow with large loops.
be5f27a84d0d fixed things so that expression trees were counted
against the limit, however it left the limit as
max_iterations * 5 which is actually fine for most shaders but
probably over conservative.
This change relaxes the limit to allow more loops to unroll in the
Unigine Superposition benchmark.
Results from Unigine Superposition @ 1920x1080 - High - Fullscreen
On radeonsi (RX480)
Before:
Average: 28.20 Frames Per Second
After:
Average: 28.60 Frames Per Second
---
The increase is small but it seems to be consistent, I would be
interested in the results if others were interested in testing it.
Did testing on few different Intel machines with larger set of
benchmarks (older than Superposition).
Didn't see any statistically significant performance changes in either
direction (due to large number of tests, can't run many rounds so
variance is fairly high).
Hi,
I should have mentioned that this won't change anything for drivers that
use NIR for loop unrolling such as i965.
Another change you could consider for larger loops is partial unrolling.
Unrolling several rounds, and then looping that.
The last time I checked with shader-db the nir unrolling pass unrolled
everything without hitting the equivalent limit, although someone might
want to check Superposition.
The limit is mainly in place due to the GLSL IR pass being slow, this is
something that is not an issue with the NIR pass so it could be relaxed
without much issue if needed.
Thanks,
Tim
- Eero
src/compiler/glsl/loop_unroll.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/compiler/glsl/loop_unroll.cpp
b/src/compiler/glsl/loop_unroll.cpp
index bc377df..64ebf0f 100644
--- a/src/compiler/glsl/loop_unroll.cpp
+++ b/src/compiler/glsl/loop_unroll.cpp
@@ -350,21 +350,21 @@ loop_unroll_visitor::visit_leave(ir_loop *ir)
/* Don't try to unroll loops that have zillions of iterations either.
*/
if (iterations > max_iterations)
return visit_continue;
/* Don't try to unroll nested loops and loops with a huge body.
*/
loop_unroll_count count(&ir->body_instructions, ls, options);
bool loop_too_large =
- count.nested_loop || count.nodes * iterations > max_iterations
* 5;
+ count.nested_loop || count.nodes * iterations > max_iterations
* 10;
if (loop_too_large && !count.unsupported_variable_indexing &&
!count.array_indexed_by_induction_var_with_exact_iterations)
return visit_continue;
/* Note: the limiting terminator contributes 1 to ls->num_loop_jumps.
* We'll be removing the limiting terminator before we unroll.
*/
assert(ls->num_loop_jumps > 0);
unsigned predicted_num_loop_jumps = ls->num_loop_jumps - 1;
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev