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 4/4] Vect peeling cost model


On Mon, May 8, 2017 at 6:13 PM, Robin Dapp <rdapp@linux.vnet.ibm.com> wrote:
> gcc/ChangeLog:
>
> 2017-05-08  Robin Dapp  <rdapp@linux.vnet.ibm.com>
>
>         * tree-vect-data-refs.c (vect_peeling_hash_get_lowest_cost):
>         Remove unused variable.
>         (vect_enhance_data_refs_alignment):
>         Compare best peelings costs to doing no peeling and choose no
>         peeling if equal.

no braces around single stmt ifs please.

+  /* Add epilogue costs.  As we do no peeling for alignment here, no prologue
+     costs will be recorded.  */
+  stmt_vector_for_cost prologue_cost_vec, epilogue_cost_vec;
+  prologue_cost_vec.create (2);
+  epilogue_cost_vec.create (2);
+
+  int dummy2;
+  nopeel_outside_cost += vect_get_known_peeling_cost
+    (loop_vinfo, vf / 2, &dummy2,

^^ pass 0 instead of vf / 2?

+     &LOOP_VINFO_SCALAR_ITERATION_COST (loop_vinfo),
+     &prologue_cost_vec, &epilogue_cost_vec);

+  /* Check if doing no peeling is not more expensive than the best peeling we
+     have so far.  */
+  if (!unlimited_cost_model (LOOP_VINFO_LOOP (loop_vinfo))
+      && vect_supportable_dr_alignment (dr0, false)
+      && ((nopeel_inside_cost < best_peel.inside_cost)
+         || (nopeel_inside_cost == best_peel.inside_cost
+             && nopeel_outside_cost <= best_peel.outside_cost)))
+    {
+      do_peeling = false;
+      npeel = 0;
+    }

please on tie do no peeling, thus change to

 if (...
     && nopeel_inside_cost <= best_peel.inside_cost)

I'm not sure why you test for unlimited_cost_model here as I said
elsewhere I'm not sure
what not cost modeling means for static decisions.  The purpose of
unlimited_cost_model
is to always vectorize when possible and omit the runtime
profitability check.  So for peeling
I'd just always use the cost model.  Thus please drop this check.

Otherwise ok.

Thanks,
Richard.


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