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: [PATCH] Fix PRE of TARGET_MEM_REF


...
> > What we should do for predictive commoning is to run its analysis
> > phase before (or inside?) the vectorizer and just handle it in the
> > vectorizer cost model.  I expect that for small vector sizes
> > (for example v2df) predictive commoning is often more effective
> > than vectorization, especially if the loop is memory bound.
> >
>
> I don't think it's the vectorizer's job to evaluate the impact of
> predictive commoning or any other optimization... hopefully if loop-count
> is too small the cost model will figure out that we shouldn't vectorize
> regardless of other optimization alternatives. Also, we could try to
> vectorize efficiently, taking advantage of the data reuse while we
> vectorize (we do it in other situations in the vectorizer).
>

about this last statement - just FYI, I was referring to cases of
outer-loop vectorization where the inner-loop stride does not evenly divide
the vector size, as in:
      for (i=0; i<n, i++)
        for (j=0; j<m; j++)
           ...a[i+j]...
As a result the misalignment does not remain fixed across inner-loop
iterations, and there's also a lot of overlap between the vectors used in
consecutive inner-loop iterations. We address this by unrolling the
inner-loop such that redundant loads are avoided, and consecutive
iterations of the unrolled inner-loop will have the same (fixed)
misalignment. This was done a while back and unfortunately never got around
to committing it, but hopefully it will be done one day. Here it is in the
meantime (relative to autovect-branch revision 131518...)

dorit

(See attached file: autovect.outer-loop-reuse-patch.txt)


> dorit
>
>
> > Richard.
> >
> > >
> > > Thanks,
> > > Revital
> > >
> > > Index: passes.c
> > > ===================================================================
> > > --- passes.c ? ?(revision 147866)
> > > +++ passes.c ? ?(working copy)
> > > @@ -648,7 +648,6 @@ init_optimization_passes (void)
> > > ? ? ? ? ?NEXT_PASS (pass_copy_prop);
> > > ? ? ? ? ?NEXT_PASS (pass_dce_loop);
> > > ? ? ? ? ?NEXT_PASS (pass_lim);
> > > - ? ? ? ? NEXT_PASS (pass_predcom);
> > > ? ? ? ? ?NEXT_PASS (pass_tree_unswitch);
> > > ? ? ? ? ?NEXT_PASS (pass_scev_cprop);
> > > ? ? ? ? ?NEXT_PASS (pass_empty_loop);
> > > @@ -665,6 +664,7 @@ init_optimization_passes (void)
> > > ? ? ? ? ? ? ?NEXT_PASS (pass_lower_vector_ssa);
> > > ? ? ? ? ? ? ?NEXT_PASS (pass_dce_loop);
> > > ? ? ? ? ? ?}
> > > + ? ? ? ? ?NEXT_PASS (pass_predcom);
> > > ? ? ? ? ?NEXT_PASS (pass_complete_unroll);
> > > ? ? ? ? ?NEXT_PASS (pass_slp_vectorize);
> > > ? ? ? ? ?NEXT_PASS (pass_parallelize_loops);
> > >
> > >
>

Attachment: autovect.outer-loop-reuse-patch.txt
Description: Text document


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