This is the mail archive of the
mailing list for the GCC project.
Re: [gomp4 simd, RFC] Simple fix to override vectorization cost estimation.
- From: Richard Biener <rguenther at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>, Sergey Ostanevich <sergos dot gnu at gmail dot com>, Richard Henderson <rth at redhat dot com>
- Cc: Yuri Rumyantsev <ysrumyan at gmail dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Igor Zamyatin <izamyatin at gmail dot com>, Areg Melik-Adamyan <areg dot melikadamyan at gmail dot com>
- Date: Tue, 12 Nov 2013 15:35:13 +0100
- Subject: Re: [gomp4 simd, RFC] Simple fix to override vectorization cost estimation.
- Authentication-results: sourceware.org; auth=none
- References: <CAEoMCqRPF8h_h0FU=+YHiizio-axzwx77q5gw-ewgbLRhv=cjQ at mail dot gmail dot com> <20131031151528 dot GS27813 at tucnak dot zalov dot cz> <c7dffd79-1947-4722-a75a-a25fdaafdeed at email dot android dot com> <CAGYS_T+m==Vu-bvWNUV0e3q2ZUZwSFSR526QiOiEsOoy_mnzQg at mail dot gmail dot com> <20131112110551 dot GP27813 at tucnak dot zalov dot cz> <CAGYS_TJ4qnkqgJR=8XRGc9cdQJ0CQ_nJpPxr8mC1DBWjf23L9Q at mail dot gmail dot com> <20131112124811 dot GQ27813 at tucnak dot zalov dot cz> <CAGYS_TKHh83oBtOBYD=oVZzKjikdNb_cVjPHF+Um=g9WZ_DnQQ at mail dot gmail dot com> <20131112141618 dot GS27813 at tucnak dot zalov dot cz>
On 11/12/13 3:16 PM, Jakub Jelinek wrote:
> On Tue, Nov 12, 2013 at 05:46:14PM +0400, Sergey Ostanevich wrote:
>> ivdep just substitutes all cross-iteration data analysis,
>> nothing related to cost model. ICC does not cancel its
>> cost model in case of #pragma ivdep
>> as for the safelen - OMP standart treats it as a limitation
>> for the vector length. this means if no safelen is present
>> an arbitrary vector length can be used.
> I was talking about GCC loop->safelen, which is INT_MAX for #pragma omp simd
> without safelen clause or #pragma simd without vectorlength clause.
>> so I believe loop->force_vect is the only trigger to disregard
>> the cost model
> Anyway, in that case I think the originally posted patch is wrong,
> if we want to treat force_vect as disregard all the cost model and
> force vectorization (well, the name of the field already kind of suggest
> that), then IMHO we should treat it the same as -fvect-cost-model=unlimited
> for those loops.
Err - the user may have a specific sub-architecture in mind when using
#pragma simd, if you say we should completely ignore the cost model
then should we also sorry () if we cannot vectorize the loop (either
because of GCC deficiencies or lack of sub-target support)?
That said, at least in the cases that the cost model says the loop
is never profitable to vectorize we should follow its advice.
> Thus (untested):
> 2013-11-12 Jakub Jelinek <firstname.lastname@example.org>
> * tree-vect-loop.c (vect_estimate_min_profitable_iters): Use
> unlimited cost model also for force_vect loops.
> --- gcc/tree-vect-loop.c.jj 2013-11-12 12:09:40.000000000 +0100
> +++ gcc/tree-vect-loop.c 2013-11-12 15:11:43.821404330 +0100
> @@ -2702,7 +2702,7 @@ vect_estimate_min_profitable_iters (loop
> void *target_cost_data = LOOP_VINFO_TARGET_COST_DATA (loop_vinfo);
> /* Cost model disabled. */
> - if (unlimited_cost_model ())
> + if (unlimited_cost_model () || LOOP_VINFO_LOOP (loop_vinfo)->force_vect)
> dump_printf_loc (MSG_NOTE, vect_location, "cost model disabled.\n");
> *ret_min_profitable_niters = 0;