public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Hongtao Liu <crazylht@gmail.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
	liuhongt <hongtao.liu@intel.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Enable auto-vectorization at O2 with very-cheap cost model.
Date: Mon, 6 Sep 2021 18:58:37 +0800	[thread overview]
Message-ID: <CAMZc-byX8aP=VraOxBd=zAvA0aW8n=++BbW5+Z+K1KVHg=a57A@mail.gmail.com> (raw)
In-Reply-To: <20210906094127.GQ920497@tucnak>

On Mon, Sep 6, 2021 at 5:42 PM Jakub Jelinek via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> On Mon, Sep 06, 2021 at 11:18:47AM +0200, Richard Biener wrote:
> > On Mon, Sep 6, 2021 at 10:47 AM liuhongt via Gcc-patches
> > <gcc-patches@gcc.gnu.org> wrote:
> > >
> > > Hi:
> > >   As discussed in [1], most of (currently unopposed) targets want
> > > auto-vectorization at O2, and IMHO now would be a good time to enable O2
> > > vectorization for GCC trunk, so it would leave enough time to expose
> > > related issues and fix them.
> > >
> > >   Bootstrapped and regtested on x86_64-linux-gnu{-m32,}
> > >   Ok for trunk?
> >
> > It changes the cost model used when the user specifices
> > -O2 -ftree-vectorize which used 'cheap' before but now sticks to
> > 'very-cheap'.  I guess adjusting the cost model in process_options
> > might be possible when any(?) of the vectorizer flags were set
> > explicitly?
>
> process_options would mean it affects only the command line and not
> __attribute__((optimize ("O2", "ftree-vectorize")))
> etc.
> So, shouldn't it be instead done in default_options_optimization, somewhere
It seems default_options_optimization is before read_comline_options
which means it can't handle cmdline option -O2 -ftree-vectorize.

  default_options_optimization (opts, opts_set,
                                decoded_options, decoded_options_count,
                                loc, lang_mask, &handlers, dc);

  read_cmdline_options (opts, opts_set,
                        decoded_options, decoded_options_count,
                        loc, lang_mask,
                        &handlers, dc);


> among the
>   if (openacc_mode)
>     SET_OPTION_IF_UNSET (opts, opts_set, flag_ipa_pta, true);
>
>   /* Track fields in field-sensitive alias analysis.  */
>   if (opt2)
>     SET_OPTION_IF_UNSET (opts, opts_set, param_max_fields_for_field_sensitive,
>                          100);
>
>   if (opts->x_optimize_size)
>     /* We want to crossjump as much as possible.  */
>     SET_OPTION_IF_UNSET (opts, opts_set, param_min_crossjump_insns, 1);
>
>   /* Restrict the amount of work combine does at -Og while retaining
>      most of its useful transforms.  */
>   if (opts->x_optimize_debug)
>     SET_OPTION_IF_UNSET (opts, opts_set, param_max_combine_insns, 2);
> in there?
> Like:
>   /* Use -fvect-cost-model=cheap instead of -fvect-cost-mode=very-cheap
>      by default with explicit -ftree-{loop,slp}-vectorize.  */
>   if (opts->x_optimize == 2
>       && (opts_set->x_ftree_loop_vectorize
>           || opts_set->x_ftree_slp_vectorize))
>     SET_OPTION_IF_UNSET (opts, opts_set, fvect_cost_model_,
>                          VECT_COST_MODEL_CHEAP);
> Though, unsure if that will work with -O2 -ftree-vectorize which is an
> option without flag with EnabledBy on the other two options.
>
> Also, is:
> +    { OPT_LEVELS_2_PLUS, OPT_ftree_loop_vectorize, NULL, 1 },
> +    { OPT_LEVELS_2_PLUS, OPT_ftree_slp_vectorize, NULL, 1 },
> what we really want, isn't that instead:
> +    { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_ftree_loop_vectorize, NULL, 1 },
> +    { OPT_LEVELS_2_PLUS_SPEED_ONLY, OPT_ftree_slp_vectorize, NULL, 1 },
> ?  I mean, for -Os vectorization even in very-cheap model I'd think it
> usually enlarges code size, and for -Og it is seriously harmful for
> debugging experience, especially when DWARF <= 5 doesn't have anything that
> would help debugging vectorized loops.
>
>         Jakub
>


--
BR,
Hongtao

  reply	other threads:[~2021-09-06 10:52 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-06  8:46 liuhongt
2021-09-06  8:55 ` Hongtao Liu
2021-09-06  9:18 ` Richard Biener
2021-09-06  9:41   ` Jakub Jelinek
2021-09-06 10:58     ` Hongtao Liu [this message]
2021-09-06 11:01       ` Jakub Jelinek
2021-09-06 11:15         ` Hongtao Liu
2021-09-06 11:15           ` Jakub Jelinek
2021-09-06 12:18             ` Richard Biener
2021-09-06 12:30               ` Jakub Jelinek
2021-09-06 12:43                 ` Richard Biener
2021-09-06 11:05     ` Richard Biener
2021-09-06  9:41   ` Hongtao Liu
2021-09-06 16:37 ` Joseph Myers
2021-09-07  2:07   ` Hongtao Liu
2021-09-16  4:33 liuhongt
2021-09-16  8:22 ` Richard Biener
2021-09-16  9:03   ` Hongtao Liu
2021-09-16 12:31     ` Richard Biener
2021-09-17  3:26       ` Hongtao Liu
2021-09-17  7:47         ` Richard Biener
2021-09-17  8:06           ` Hongtao Liu
2021-09-19 20:13     ` Martin Sebor
2021-09-22  1:38       ` Hongtao Liu
2021-09-22 14:21         ` Martin Sebor
2021-09-22 15:03           ` Martin Sebor
2021-09-23  1:48           ` Hongtao Liu
2021-09-23  2:08             ` Hongtao Liu
2021-09-23  6:30               ` Richard Biener
2021-09-23 15:18                 ` Martin Sebor
2021-09-24  3:32                   ` Hongtao Liu
2021-09-24 14:27                     ` Martin Sebor
2021-09-26  3:18                       ` liuhongt
2021-09-28 11:18                         ` Richard Biener
2021-10-07 15:34                         ` Martin Liška
2021-10-07 15:36                           ` H.J. Lu
2021-10-08  2:16                             ` Hongtao Liu
2021-10-08 10:49                 ` Aldy Hernandez
2021-10-08 23:43                   ` Martin Sebor

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='CAMZc-byX8aP=VraOxBd=zAvA0aW8n=++BbW5+Z+K1KVHg=a57A@mail.gmail.com' \
    --to=crazylht@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hongtao.liu@intel.com \
    --cc=jakub@redhat.com \
    --cc=richard.guenther@gmail.com \
    /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).