OSDN Git Service

nir/range-analysis: Add pragmas to help loop unrolling
authorIan Romanick <ian.d.romanick@intel.com>
Sat, 16 Nov 2019 21:23:31 +0000 (13:23 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 22 Nov 2019 16:16:06 +0000 (08:16 -0800)
commitccefce46cb8e9030b3a9134964ab2f660f66391c
tree903a1ae1e2f430e6bee35f59441d9b8a28dd8f5b
parent25a00b449fbd877716f4732aa116640d58246182
nir/range-analysis: Add pragmas to help loop unrolling

I was pretty liberal with these assertions when I wrote this code
because I had assumed that GCC would unroll the loops, inline the look ups
of static const arrays with now constant indices, and then elmininate
all the actuall assertions.  It seems none of this happens even at -O3.

Adding the pragmas helps encourage loop unrolling at some optimization
levels.  I tested by running shader-db with NIR_VALIDATE=false on a Core
i7 Haswell desktop system.

-Og: No difference proven at 95.0% confidence. N=5
-O1: -48.304 +/- 1.221 (-16.3343% +/- 0.412888%) N=5
-O2: -49.94 +/- 1.23521 (-17.9634% +/- 0.444303%) N=5

v2: Add a _Pragma to an inner loop that was accidentally dropped during
a rebase.

Reviewed-by: Eric Anholt <eric@anholt.net>
src/compiler/nir/nir_range_analysis.c