From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 199423851C03 for ; Wed, 5 Aug 2020 07:28:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 199423851C03 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=richard.sandiford@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6E0E6D6E; Wed, 5 Aug 2020 00:28:00 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 987AE3F718; Wed, 5 Aug 2020 00:27:59 -0700 (PDT) From: Richard Sandiford To: "Kewen.Lin" Mail-Followup-To: "Kewen.Lin" , GCC Patches , Bill Schmidt , Segher Boessenkool , Richard Biener , richard.sandiford@arm.com Cc: GCC Patches , Bill Schmidt , Segher Boessenkool , Richard Biener Subject: Re: [PATCH v5] vect/rs6000: Support vector with length cost modeling References: <419f1fad-05be-115c-1a53-cb710ae7b2dc@linux.ibm.com> <1aeabdc7-0cf4-055b-a3ec-74c283053cf5@linux.ibm.com> Date: Wed, 05 Aug 2020 08:27:57 +0100 In-Reply-To: (Kewen Lin's message of "Fri, 31 Jul 2020 22:51:06 +0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2020 07:28:02 -0000 "Kewen.Lin" writes: > diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c > index 490e7befea3..2a0d3b1840d 100644 > --- a/gcc/tree-vect-loop-manip.c > +++ b/gcc/tree-vect-loop-manip.c > @@ -412,7 +412,10 @@ vect_maybe_permute_loop_masks (gimple_seq *seq, rgro= up_controls *dest_rgm, >=20=20 > This means that we cannot guarantee that such an induction variable > would ever hit a value that produces a set of all-false masks or zero > - lengths for RGC. */ > + lengths for RGC. > + > + Note that please check cost modeling whether needed to be updated in > + function vect_estimate_min_profitable_iters if any changes. */ Maybe: Note: the cost of the code generated by this function is modeled by vect_estimate_min_profitable_iters, so changes here may need corresponding changes there. */ > [=E2=80=A6] > diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c > index 43ec4fb04d5..dea9ca6778f 100644 > --- a/gcc/tree-vect-loop.c > +++ b/gcc/tree-vect-loop.c > @@ -3798,6 +3798,58 @@ vect_estimate_min_profitable_iters (loop_vec_info = loop_vinfo, > (void) add_stmt_cost (loop_vinfo, target_cost_data, num_masks - 1, > vector_stmt, NULL, NULL_TREE, 0, vect_body); > } > + else if (LOOP_VINFO_FULLY_WITH_LENGTH_P (loop_vinfo)) > + { > + /* Referring to the functions vect_set_loop_condition_partial_vect= ors > + and vect_set_loop_controls_directly, we need to generate each > + length in the prologue and in the loop body if required. Although > + there are some possible optimizations, we consider the worst case > + here. */ > + > + bool niters_known_p =3D LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo); > + bool need_iterate_p > + =3D (!LOOP_VINFO_EPILOGUE_P (loop_vinfo) > + && !vect_known_niters_smaller_than_vf (loop_vinfo)); > + > + /* Calculate how many statements to be added. */ > + unsigned int prologue_stmt =3D 0; > + unsigned int body_stmt =3D 0; Sorry to be nit-picky, but =E2=80=9C_stmts=E2=80=9D reads better to me. > [=E2=80=A6] > @@ -4015,6 +4067,10 @@ vect_estimate_min_profitable_iters (loop_vec_info = loop_vinfo, > && min_profitable_iters < (assumed_vf + peel_iters_prologue)) > /* We want the vectorized loop to execute at least once. */ > min_profitable_iters =3D assumed_vf + peel_iters_prologue; > + else if (min_profitable_iters < peel_iters_prologue) > + /* For LOOP_VINFO_USING_PARTIAL_VECTORS_P, we need to ensure the > + vectorized loop to execute at least once. */ > + min_profitable_iters =3D peel_iters_prologue; s/to execute/executes/ > [=E2=80=A6] > diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c > index 31af46ae19c..8550a252f44 100644 > --- a/gcc/tree-vect-stmts.c > +++ b/gcc/tree-vect-stmts.c > @@ -12090,7 +12090,10 @@ vect_get_vector_types_for_stmt (vec_info *vinfo,= stmt_vec_info stmt_info, > min_of_start_and_end =3D min (START_INDEX, END_INDEX); > left_len =3D END_INDEX - min_of_start_and_end; > rhs =3D min (left_len, LEN_LIMIT); > - LEN =3D rhs; */ > + LEN =3D rhs; > + > + Note that please check cost modeling whether needed to be updated in > + function vect_estimate_min_profitable_iters if any changes. */ Same suggested edit as above. OK for the vectoriser parts with those changes, thanks. Richard