public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: gcc@gcc.gnu.org
Cc: kirill.yukhin@gmail.com, ubizjak@gmail.com, Jan Hubicka <hubicka@ucw.cz>
Subject: Vectorizer size preferences (-mprefer-* on x86)
Date: Fri, 15 Jun 2018 11:52:00 -0000	[thread overview]
Message-ID: <alpine.LSU.2.20.1806151337080.5043@zhemvz.fhfr.qr> (raw)


Hi,

I'm in the process of changing the vectorizer to consider all
vector sizes as advertised by targetm.autovectorize_vector_sizes
and to decide which one to use based on its cost model.

I expect that to make sense for example when choosing between
AVX128 and AVX256 since the latter may have penalties for
cross-lane operations which the former lacks.

Now while the option -mprefer-* and the documentation (to
some extent) suggests that the user communicates a preference
the actual implementation in the x86 backend uses -mprefer-*
to disable the use of larger vector sizes.  That also makes
targetm.preferred_simd_mode somewhat redundant.

In the light of using the cost model to decide on the vector
width used how should we go forward here?

I would suggest to more clearly document that -mprefer-*
will disable the use of larger vector sizes and that smaller
vector sizes might be used if costs tell us to do so (or loops
do not roll enough).  Implementation-wise the size chosen
by targetm.preferred_simd_mode could be used as tie-breaker
in case equal costs are computed.

In the (distant?) future we might want to support mixed-size
vectorization which makes all this even more complicated.
Still having -mprefer-* disabling vector sizes makes sense
here?

Thanks,
Richard.

             reply	other threads:[~2018-06-15 11:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-15 11:52 Richard Biener [this message]
2018-06-15 12:02 ` Jan Hubicka
2018-06-15 12:35   ` Richard Biener
2018-06-15 15:26 ` Richard Earnshaw (lists)

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=alpine.LSU.2.20.1806151337080.5043@zhemvz.fhfr.qr \
    --to=rguenther@suse.de \
    --cc=gcc@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    --cc=kirill.yukhin@gmail.com \
    --cc=ubizjak@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).