[PATCH] Disable slp in loop vectorizer when cost model is very-cheap.

liuhongt hongtao.liu@intel.com
Mon Aug 23 02:41:27 GMT 2021


Performance impact for the commit with option:
-march=x86-64 -O2 -ftree-vectorize -fvect-cost-model=very-cheap

SPEC2017 fprate
503.bwaves_r        BuildSame
507.cactuBSSN_r         -0.04
508.namd_r               0.14
510.parest_r            -0.54
511.povray_r             0.10
519.lbm_r           BuildSame
521.wrf_r                0.64
526.blender_r           -0.32
527.cam4_r               0.17
538.imagick_r            0.09
544.nab_r           BuildSame
549.fotonik3d_r     BuildSame
554.roms_r          BuildSame
997.specrand_fr         -0.09
Geometric mean:  0.02

SPEC2017 intrate
500.perlbench_r          0.26
502.gcc_r                0.21
505.mcf_r               -0.09
520.omnetpp_r       BuildSame
523.xalancbmk_r     BuildSame
525.x264_r              -0.41
531.deepsjeng_r     BuildSame
541.leela_r              0.13
548.exchange2_r     BuildSame
557.xz_r            BuildSame
999.specrand_ir     BuildSame
Geometric mean:  0.02

EEMBC: no regression, only improvement or build the same, the below is
improved benchmarks.

mp2decoddata1       7.59
mp2decoddata2       31.80
mp2decoddata3       12.15
mp2decoddata4       11.16
mp2decoddata5       11.19
mp2decoddata1       7.06
mp2decoddata2       24.12
mp2decoddata3       10.83
mp2decoddata4       10.04
mp2decoddata5       10.07

Survived regression test.
Ok for trunk?

gcc/ChangeLog:

	PR tree-optimization/100089
	* tree-vectorizer.c (try_vectorize_loop_1): Disable slp in
	loop vectorizer when cost model is very-cheap.
---
 gcc/tree-vectorizer.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index b9709a613d5..8a5b8735546 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -1033,7 +1033,10 @@ try_vectorize_loop_1 (hash_table<simduid_to_vf> *&simduid_to_vf_htab,
 	 only non-if-converted parts took part in BB vectorization.  */
       if (flag_tree_slp_vectorize != 0
 	  && loop_vectorized_call
-	  && ! loop->inner)
+	  && ! loop->inner
+	  /* This would purely be a workaround and should be removed
+	     once the PR100089 is fixed.  */
+	  && flag_vect_cost_model != VECT_COST_MODEL_VERY_CHEAP)
 	{
 	  basic_block bb = loop->header;
 	  bool require_loop_vectorize = false;
-- 
2.18.1



More information about the Gcc-patches mailing list