This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][vect] Disable vectorization of epilogues for loops with SIMDUID set
- From: "Andre Vieira (lists)" <andre dot simoesdiasvieira at arm dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <rguenther at suse dot de>, gcc-patches <gcc-patches at gcc dot gnu dot org>, richard dot sandiford at arm dot com, tobias at codesourcery dot com
- Date: Mon, 4 Nov 2019 17:11:48 +0000
- Subject: [PATCH][vect] Disable vectorization of epilogues for loops with SIMDUID set
- References: <8be5d0a6-e14b-42af-6b46-738e5b760212@arm.com> <alpine.LSU.2.20.1908261410570.32458@zhemvz.fhfr.qr> <1f9dca66-d8ff-9b80-75b4-98df06e73b96@arm.com> <20191031165841.GL4650@tucnak>
Hi,
I was using loop->simdlen to detect whether it was a SIMD loop and I
don't believe that was correct, as can be witnessed by the mass failures
in libgomp. My apologies for not running this, didn't think of it!
I found that these were failing because we do not handle vectorization
of epilogues correctly when SIMDUID is set. For now Jakub and I agreed
to disable epilogue vectorization for loops where SIMDUID is set until
we have fixed this. See further comments inline.
I bootstrapped it on aarch64 and x86_64, ran libgomp on both.
This OK for trunk?
Cheers,
Andre
gcc/ChangeLog:
2019-11-04 Andre Vieira <andre.simoesdiasvieira@arm.com>
* tree-vect-loop.c (vect_analyze_loop): Disable epilogue
vectorization if loop->simduid is non null.
On 31/10/2019 16:58, Jakub Jelinek wrote:
FAIL: libgomp.c/../libgomp.c-c++-common/loop-1.c execution test
FAIL: libgomp.c/examples-4/simd-3.c execution test
FAIL: libgomp.c/pr58392.c execution test
FAIL: libgomp.c/scan-13.c execution test
FAIL: libgomp.c/scan-17.c execution test
FAIL: libgomp.c/scan-19.c execution test
FAIL: libgomp.c/scan-20.c execution test
FAIL: libgomp.c/simd-10.c execution test
FAIL: libgomp.c/simd-12.c execution test
FAIL: libgomp.c/simd-13.c execution test
FAIL: libgomp.c/simd-6.c execution test
FAIL: libgomp.c++/../libgomp.c-c++-common/loop-1.c execution test
FAIL: libgomp.c++/simd-8.C execution test
FAIL: libgomp.fortran/examples-4/simd-3.f90 -O1 execution test
FAIL: libgomp.fortran/examples-4/simd-3.f90 -O2 execution test
FAIL: libgomp.fortran/examples-4/simd-3.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test
FAIL: libgomp.fortran/examples-4/simd-3.f90 -O3 -g execution test
FAIL: libgomp.fortran/examples-4/simd-3.f90 -Os execution test
FAIL: libgomp.fortran/nestedfn5.f90 -O1 execution test
FAIL: libgomp.fortran/nestedfn5.f90 -O2 execution test
FAIL: libgomp.fortran/nestedfn5.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test
FAIL: libgomp.fortran/nestedfn5.f90 -O3 -g execution test
FAIL: libgomp.fortran/nestedfn5.f90 -Os execution test
These should go away now, but we should revisit SIMDUID and epilogue
vectorization later. I tried to look into it, but I am afraid I know
very little about SIMD loops to figure out how to make this work.
On i686-linux, I also see newly
FAIL: gcc.dg/vect/vect-epilogues.c -flto -ffat-lto-objects scan-tree-dump vect "LOOP EPILOGUE VECTORIZED"
FAIL: gcc.dg/vect/vect-epilogues.c scan-tree-dump vect "LOOP EPILOGUE VECTORIZED"
and in libgomp just
These, just like for arm should be skipped for i686, I suspect it
doesn't know how to vectorize for lower VF's. Could someone add the
appropriate skip target triple for i686?
FAIL: libgomp.c/examples-4/simd-3.c execution test
FAIL: libgomp.c/scan-13.c execution test
FAIL: libgomp.c/scan-17.c execution test
FAIL: libgomp.fortran/examples-4/simd-3.f90 -O1 execution test
FAIL: libgomp.fortran/examples-4/simd-3.f90 -O2 execution test
FAIL: libgomp.fortran/examples-4/simd-3.f90 -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions execution test
FAIL: libgomp.fortran/examples-4/simd-3.f90 -O3 -g execution test
FAIL: libgomp.fortran/examples-4/simd-3.f90 -Os execution test
Same as the other libgomp tests. Should go away now.
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index fa873e9b435037e5a81dda6615cab809d2d4de48..d3a0fa015332dbcccf84bc68531dc1e49550cc19 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -2383,10 +2383,11 @@ vect_analyze_loop (class loop *loop, loop_vec_info orig_loop_vinfo,
poly_uint64 lowest_th = 0;
unsigned vectorized_loops = 0;
- /* Only vectorize epilogues if PARAM_VECT_EPILOGUES_NOMASK is enabled, this
- is not a simd loop and it is the most inner loop. */
+ /* Only vectorize epilogues if PARAM_VECT_EPILOGUES_NOMASK is enabled,
+ SIMDLEN is not set, SIMDUID is not set and this is the most inner loop.
+ TODO: Enable epilogue vectorization for loops with SIMDUID set. */
bool vect_epilogues
- = !loop->simdlen && loop->inner == NULL
+ = loop->simdlen == 0 && loop->simduid == NULL_TREE && loop->inner == NULL
&& PARAM_VALUE (PARAM_VECT_EPILOGUES_NOMASK);
while (1)
{