This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gomp4 simd, RFC] Simple fix to override vectorization cost estimation.


On Wed, Nov 20, 2013 at 02:59:21PM +0100, Richard Biener wrote:
> > --- a/gcc/c-family/c.opt
> > +++ b/gcc/c-family/c.opt
> > @@ -592,6 +592,10 @@ Wold-style-definition
> >  C ObjC Var(warn_old_style_definition) Warning
> >  Warn if an old-style parameter definition is used
> > 
> > +Wopenmp-simd
> > +C C++ Var(openmp_simd) Warning EnabledBy(Wall)

Please use Var(warn_openmp_simd) here.

> > --- a/gcc/common.opt
> > +++ b/gcc/common.opt
> > @@ -2296,6 +2296,10 @@ fvect-cost-model=
> >  Common Joined RejectNegative Enum(vect_cost_model)
> > Var(flag_vect_cost_model) Init(VECT_COST_MODEL_DEFAULT)
> >  Specifies the cost model for vectorization
> > 
> > +fsimd-cost-model=
> > +Common Joined RejectNegative Enum(vect_cost_model)
> > Var(flag_simd_cost_model) Init(VECT_COST_MODEL_UNLIMITED)
> > +Specifies the vectorization cost model for code marked with simd directive
> > +
> >  Enum
> >  Name(vect_cost_model) Type(enum vect_cost_model) UnknownError(unknown
> > vectorizer cost model %qs)

I'd say you want to add
EnumValue
Enum(vect_cost_model) String(default) Value(VECT_COST_MODEL_DEFAULT)
here.

> > @@ -2929,6 +2929,13 @@ vect_estimate_min_profitable_iters
> > (loop_vec_info loop_vinfo,
> >    /* vector version will never be profitable.  */
> >    else
> >      {
> > +      if (LOOP_VINFO_LOOP (loop_vinfo)->force_vect)
> > +        {
> > +          warning_at (LOOP_VINFO_LOC (loop_vinfo), OPT_Wopenmp_simd,
> > +                      "Vectorization did not happen for "
> > +                      "the loop labeled as simd.");

No {} around single stmt then body.  Also, diagnostic messages
don't start with a capital letter and don't end with dot.
So
		"vectorization did not happen for "
		"a simd loop"
or so.

> >  /* Return true if the vect cost model is unlimited.  */
> >  static inline bool
> > -unlimited_cost_model ()
> > +unlimited_cost_model (loop_p loop)
> >  {
> > -  return flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED;
> > +  return (flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED
> > +          || (loop != NULL
> > +              && loop->force_vect
> > +              && flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED));
> >  }

IMNSHO this should instead do:
  if (loop != NULL && loop->force_vect
      && flag_simd_cost_model != VECT_COST_MODEL_DEFAULT)
    return flag_simd_cost_model == VECT_COST_MODEL_UNLIMITED;
  return flag_vect_cost_model == VECT_COST_MODEL_UNLIMITED;
so, if user said that -fsimd-cost-model=default, then it should honor
-fvect-cost-model.  And, IMHO that should be the default, but I don't
feel strongly about that.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]