summaryrefslogtreecommitdiff
path: root/src/glsl/loop_unroll.cpp
AgeCommit message (Collapse)AuthorFilesLines
2013-09-23glsl: Hide many classes local to individual .cpp files in anon namespaces.Eric Anholt1-0/+3
This gives the compiler the chance to inline and not export class symbols even in the absence of LTO. Saves about 60kb on disk. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@.intel.com>
2012-03-08glsl: Refine the loop instruction counting.Eric Anholt1-12/+36
Before, we were only counting top-level instructions. But if we have an assignment of a giant expression tree (such as the ones eventually generated by glsl-fs-unroll), we were counting the same as an assignment of a variable deref. glsl-fs-unroll-explosion now fails in a reasonable amount of time on i965 because the unrolling didn't go ridiculously far. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2012-02-09glsl: Avoid excessive loop unrolling.Mathias Fröhlich1-0/+15
Avoid unrollong loops that are either nested loops or where the loop body times the unroll count is huge. The change is far from being perfect but it extends the loop unrolling decision heuristic by some additional safeguard. In particular this cuts down compilation of a shader precomputing atmospheric scattering integral tables containing two nesting levels in a loop from something way beyond some minutes (I never waited for it to finish) to some fractions of a second. This fixes piglit tests glsl-fs-unroll-explosion and glsl-vs-unroll-explosion on r600g. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
2011-01-31Convert everything from the talloc API to the ralloc API.Kenneth Graunke1-2/+2
2010-12-09glsl: Unroll loops with conditional breaks anywhere (not just the end)7.10-branchpointLuca Barbieri1-46/+68
Currently we only unroll loops with conditional breaks at the end, which is the form that lower_jumps generates. However, if breaks are not lowered, they tend to appear at the beginning, so add support for a conditional break anywhere. Signed-off-by: Luca Barbieri <luca@luca-barbieri.com> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
2010-12-09glsl: Consider the "else" branch when looking for loop breaks.Kenneth Graunke1-1/+1
Found this bug by code inspection. Based off the comments just before this code, the intent is to find whether the break exists in the "then" branch or the "else" branch. However, the code actually looked at the last instruction in the "then" branch twice.
2010-12-09glsl: Clean up code by adding a new is_break() function.Kenneth Graunke1-6/+11
2010-10-12glsl2: fix signed/unsigned comparison warningBrian Paul1-1/+1
2010-09-13loop_unroll: unroll loops with (lowered) breaksLuca Barbieri1-4/+89
If the loop ends with an if with one break or in a single break unroll it. Loops that end with a continue will have that continue removed by the redundant jump optimizer. Likewise loops that end with an if-statement with a break at the end of both branches will have the break pulled out after the if-statement. Loops of the form for (...) { do_something1(); if (cond) { do_something2(); break; } else { do_something3(); } } will be unrolled as do_something1(); if (cond) { do_something2(); } else { do_something3(); do_something1(); if (cond) { do_something2(); } else { do_something3(); /* Repeat inserting iterations here.*/ } } ir_lower_jumps can guarantee that all loops are put in this form and thus all loops are now potentially unrollable if an upper bound on the number of iterations can be found. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-09-08glsl: add several EmitNo* options, and MaxUnrollIterationsLuca Barbieri1-4/+6
This increases the chance that GLSL programs will actually work. Note that continues and returns are not yet lowered, so linking will just fail if not supported. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2010-09-03glsl2: Add module to perform simple loop unrollingIan Romanick1-0/+100