From: Jeff Law <law@redhat.com>
To: Ilya Enkovich <enkovich.gnu@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH, vec-tails 07/10] Support loop epilogue combining
Date: Thu, 14 Jul 2016 22:04:00 -0000 [thread overview]
Message-ID: <cca77c6b-fd73-1c98-7f9c-820b91d9733c@redhat.com> (raw)
In-Reply-To: <20160628122439.GB4143@msticlxl57.ims.intel.com>
On 06/28/2016 06:24 AM, Ilya Enkovich wrote:
>
> Here is an updated patch version.
>
> Thanks,
> Ilya
> --
> gcc/
>
> 2016-05-28 Ilya Enkovich <ilya.enkovich@intel.com>
>
> * dbgcnt.def (vect_tail_combine): New.
> * params.def (PARAM_VECT_COST_INCREASE_COMBINE_THRESHOLD): New.
> * tree-vect-data-refs.c (vect_get_new_ssa_name): Support vect_mask_var.
> * tree-vect-loop-manip.c (slpeel_tree_peel_loop_to_edge): Support
> epilogue combined with loop body.
> (vect_do_peeling_for_loop_bound): LIkewise.
> (vect_do_peeling_for_alignment): ???
> * tree-vect-loop.c Include alias.h and dbgcnt.h.
> (vect_estimate_min_profitable_iters): Add ret_min_profitable_combine_niters
> arg, compute number of iterations for which loop epilogue combining is
> profitable.
> (vect_generate_tmps_on_preheader): Support combined apilogue.
> (vect_gen_ivs_for_masking): New.
> (vect_get_mask_index_for_elems): New.
> (vect_get_mask_index_for_type): New.
> (vect_gen_loop_masks): New.
> (vect_mask_reduction_stmt): New.
> (vect_mask_mask_load_store_stmt): New.
> (vect_mask_load_store_stmt): New.
> (vect_combine_loop_epilogue): New.
> (vect_transform_loop): Support combined apilogue.
>
>
> diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
> index 41b9380..08fad82 100644
> --- a/gcc/tree-vect-loop.c
> +++ b/gcc/tree-vect-loop.c
> @@ -6895,6 +7044,489 @@ vect_generate_tmps_on_preheader (loop_vec_info loop_vinfo,
> return;
> }
>
+
> +/* Function vect_gen_loop_masks.
> +
> + Create masks to mask a loop described by LOOP_VINFO. Masks
> + are created according to LOOP_VINFO_REQUIRED_MASKS and are stored
> + into MASKS vector.
> +
> + Index of a mask in a vector is computed according to a number
> + of masks's elements. Masks are sorted by number of its elements
> + in descending order. Index 0 is used to access a mask with
> + current_vector_size elements. Among masks with the same number
> + of elements the one with lower index is used to mask iterations
> + with smaller iteration counter. Note that you may get NULL elements
> + for masks which are not required. Use vect_get_mask_index_for_elems
> + or vect_get_mask_index_for_type to access resulting vector. */
> +
> +static void
> +vect_gen_loop_masks (loop_vec_info loop_vinfo, vec<tree> *masks)
I find myself wondering if this ought to be broken down a bit (without
changing the underlying semantics).
> +
> + /* Create narrowed masks. */
> + cur_mask_elems = iv_elems;
> + nmasks = ivs.length ();
> + while (cur_mask_elems < max_mask_elems)
> + {
> + prev_mask = vect_get_mask_index_for_elems (cur_mask_elems);
> +
> + cur_mask_elems <<= 1;
> + nmasks >>= 1;
> +
> + cur_mask = vect_get_mask_index_for_elems (cur_mask_elems);
> +
> + mask_type = build_truth_vector_type (cur_mask_elems, vec_size);
> +
> + for (unsigned i = 0; i < nmasks; i++)
> + {
> + tree mask_low = (*masks)[prev_mask++];
> + tree mask_hi = (*masks)[prev_mask++];
> + mask = vect_get_new_ssa_name (mask_type, vect_mask_var);
> + stmt = gimple_build_assign (mask, VEC_PACK_TRUNC_EXPR,
> + mask_low, mask_hi);
> + gsi_insert_before (&gsi, stmt, GSI_SAME_STMT);
> + (*masks)[cur_mask++] = mask;
> + }
> + }
For example, pull this into its own function as well as the code to
create widened masks. In fact, didn't I see those functions in one of
the other patches as their own separate subroutines?
It's not a huge deal and I don't think it requires another round of
review. I just found myself scrolling through multiple pages of this
function and thought it'd be slightly easier to grok if were simply smaller.
> +
> +/* Function vect_mask_reduction_stmt.
> +
> + Mask given vectorized reduction statement STMT using
> + MASK. In case scalar reduction statement is vectorized
> + into several vector statements then PREV holds a
> + preceding vetor statement copy for STMT.
s/vetor/vector/
With the one function split up and the typo fix I think this is OK for
the trunk when the set as a whole is ready.
jeff
next prev parent reply other threads:[~2016-07-14 22:04 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-19 19:46 Ilya Enkovich
2016-06-15 11:44 ` Richard Biener
2016-06-16 15:41 ` Ilya Enkovich
2016-06-16 15:51 ` Jeff Law
2016-06-16 16:03 ` Ilya Enkovich
2016-06-16 16:54 ` Jeff Law
2016-06-28 13:37 ` Ilya Enkovich
2016-06-28 14:16 ` Ilya Enkovich
2016-07-11 13:39 ` Ilya Enkovich
2016-07-14 22:04 ` Jeff Law [this message]
2016-07-20 14:40 ` Ilya Enkovich
2016-07-20 16:24 ` Jeff Law
2016-07-21 9:15 ` Ilya Enkovich
2016-07-21 16:34 ` Jeff Law
2016-07-22 11:36 ` Richard Biener
2016-07-25 18:01 ` Jeff Law
2016-07-25 18:33 ` Richard Biener
2016-07-25 21:08 ` Jeff Law
2016-07-26 9:57 ` Ilya Enkovich
2016-07-26 11:51 ` Richard Biener
2016-07-26 13:03 ` Ilya Enkovich
2016-07-26 13:05 ` Richard Biener
2016-07-26 15:26 ` Jeff Law
2016-07-26 15:38 ` Ilya Enkovich
2016-08-01 9:09 ` Ilya Enkovich
2016-08-01 16:10 ` Jeff Law
2016-09-02 14:46 ` Yuri Rumyantsev
2016-09-02 16:33 ` Bin.Cheng
2016-09-05 7:39 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cca77c6b-fd73-1c98-7f9c-820b91d9733c@redhat.com \
--to=law@redhat.com \
--cc=enkovich.gnu@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).