[patch] Loop distribution for single nested loops

Sebastian Pop sebpop@gmail.com
Wed Dec 5 20:27:00 GMT 2007


On Oct 3, 2007 6:49 AM, Diego Novillo <dnovillo@google.com> wrote:
> I like this pass.  Would it make sense to enable this pass by
> default?  Or enable it only with the vectorizer/parallelizer?  I
> think this is something we could at least enable at -O3.
>

I've also implemented a cost function for the loop distribution: it
aggregates the components containing read or write accesses to
similar memory, that otherwise would end in different loops.  I don't
know yet the performance impact of the loop distribution on real code,
but I'll give a run on spec2006, and then send out the numbers.
During the build of gcc there are 44 loops distributed.  The usual
pattern is the distribution of different arrays initialization.

For counting the number of distributed loops, I've left in the attached
patch a if (0 && ...) that allows you to print to stdout the distributed
cases if you remove the 0. I will not include that part in a commit.

> Before comitting the pass, I think it would be very useful to
> enable it by default at -O2 and do a full bootstrap/test cycle,
> that will help you shake the most obvious bugs.
>

I've bootstrap/test the attached patch with the loop distribution
enabled by default at -O2 on {i686,amd64}-linux.  There are a huge
number of tests that fail in the vectorization part, as the loop
distribution modifies the patterns that the vectorizer expects to see.
Some nice examples include the vectorization of unaligned stores,
something that we expected to see ;-).  See below for the complete
list of autovect fails.

The attached patch passed bootstrap and test on both i686-linux and
amd64-linux.  Okay for trunk?

Sebastian
-- 
AMD - GNU Tools


Running /home/seb/gcc/trunk0/gcc/testsuite/gcc.dg/vect/vect.exp ...
FAIL: gcc.dg/vect/pr21591.c scan-tree-dump-times vect "vectorized 2 loops" 1
FAIL: gcc.dg/vect/pr30795.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-1.c scan-tree-dump-times vect "vectorized 3 loops" 1
FAIL: gcc.dg/vect/vect-106.c scan-tree-dump-times vect "vectorized 2 loops" 1
FAIL: gcc.dg/vect/vect-109.c scan-tree-dump-times vect "vectorized 0 loops" 2
FAIL: gcc.dg/vect/vect-109.c scan-tree-dump-times vect "not
vectorized: unsupported unaligned store" 2
XPASS: gcc.dg/vect/vect-12.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-3.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-3.c scan-tree-dump-times vect "Vectorizing an
unaligned access" 0
FAIL: gcc.dg/vect/vect-6.c scan-tree-dump-times vect "vectorized 2 loops" 1
FAIL: gcc.dg/vect/vect-95.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-95.c scan-tree-dump-times vect "Alignment of
access forced using peeling" 0
FAIL: gcc.dg/vect/vect-95.c scan-tree-dump-times vect "Alignment of
access forced using versioning" 2
FAIL: gcc.dg/vect/vect-all.c scan-tree-dump-times vect "vectorized 10 loops" 1
FAIL: gcc.dg/vect/vect-all.c scan-tree-dump-times vect "Vectorizing an
unaligned access" 0
FAIL: gcc.dg/vect/vect-all.c scan-tree-dump-times vect "Alignment of
access forced using peeling" 0
FAIL: gcc.dg/vect/vect-intfloat-conversion-2.c scan-tree-dump-times
vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-iv-3.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-iv-4.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-iv-6.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-iv-8a.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-multitypes-1.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-multitypes-1.c scan-tree-dump-times vect
"Alignment of access forced using peeling" 1
XPASS: gcc.dg/vect/vect-multitypes-1.c scan-tree-dump-times vect
"Vectorizing an unaligned access" 4
FAIL: gcc.dg/vect/vect-multitypes-1.c scan-tree-dump-times vect
"Vectorizing an unaligned access" 2
FAIL: gcc.dg/vect/vect-multitypes-10.c scan-tree-dump-times vect
"vectorized 1 loops" 2
FAIL: gcc.dg/vect/vect-multitypes-2.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-multitypes-3.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-multitypes-4.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-multitypes-4.c scan-tree-dump-times vect
"Alignment of access forced using peeling" 1
XPASS: gcc.dg/vect/vect-multitypes-4.c scan-tree-dump-times vect
"Vectorizing an unaligned access" 8
FAIL: gcc.dg/vect/vect-multitypes-4.c scan-tree-dump-times vect
"Vectorizing an unaligned access" 4
FAIL: gcc.dg/vect/vect-multitypes-5.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-multitypes-6.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-multitypes-8.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-reduc-dot-s16a.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-reduc-dot-s16a.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-reduc-dot-s16b.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-reduc-dot-u16a.c scan-tree-dump-times vect
"vectorized 1 loops" 2
FAIL: gcc.dg/vect/vect-reduc-dot-u16b.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-strided-store-u16-i4.c scan-tree-dump-times
vect "vectorized 1 loops" 2
FAIL: gcc.dg/vect/vect-widen-mult-s16.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/vect-widen-mult-u16.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-12a.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-12a.c scan-tree-dump-times vect "vectorizing
stmts using SLP" 1
FAIL: gcc.dg/vect/slp-12b.c scan-tree-dump-times vect "vectorized 0 loops" 1
FAIL: gcc.dg/vect/slp-12b.c scan-tree-dump-times vect "vectorizing
stmts using SLP" 0
FAIL: gcc.dg/vect/slp-14.c scan-tree-dump-times vect "vectorized 0 loops" 1
XPASS: gcc.dg/vect/slp-14.c scan-tree-dump-times vect "vectorizing
stmts using SLP" 2
FAIL: gcc.dg/vect/slp-14.c scan-tree-dump-times vect "vectorizing
stmts using SLP" 0
FAIL: gcc.dg/vect/slp-15.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-16.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-17.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-19.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-19.c scan-tree-dump-times vect "vectorizing
stmts using SLP" 1
FAIL: gcc.dg/vect/slp-20.c scan-tree-dump-times vect "vectorized 2 loops" 1
FAIL: gcc.dg/vect/slp-21.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-21.c scan-tree-dump-times vect "vectorizing
stmts using SLP" 0
FAIL: gcc.dg/vect/slp-22.c scan-tree-dump-times vect "vectorized 2 loops" 1
FAIL: gcc.dg/vect/slp-24.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-26.c scan-tree-dump-times vect "vectorized 0 loops" 1
FAIL: gcc.dg/vect/slp-26.c scan-tree-dump-times vect "vectorizing
stmts using SLP" 0
FAIL: gcc.dg/vect/slp-34.c scan-tree-dump-times vect "vectorized 1 loops" 1
FAIL: gcc.dg/vect/slp-4.c scan-tree-dump-times vect "vectorized 3 loops" 1
FAIL: gcc.dg/vect/slp-5.c scan-tree-dump-times vect "vectorized 2 loops" 1
FAIL: gcc.dg/vect/slp-5.c scan-tree-dump-times vect "vectorizing stmts
using SLP" 2
FAIL: gcc.dg/vect/slp-7.c scan-tree-dump-times vect "vectorized 2 loops" 1
FAIL: gcc.dg/vect/no-vfa-pr29145.c scan-tree-dump-times vect
"vectorized 1 loops" 1
FAIL: gcc.dg/vect/no-vfa-vect-dv-2.c scan-tree-dump-times vect
"vectorized 3 loops" 1
XPASS: gcc.dg/vect/no-scevccp-vect-iv-2.c scan-tree-dump-times vect
"vectorized 1 loops" 1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 845_loop_distribution.diff
Type: text/x-diff
Size: 82554 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20071205/d466ab9f/attachment.bin>


More information about the Gcc-patches mailing list