This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Vectorizer size preferences (-mprefer-* on x86)
- From: Richard Biener <rguenther at suse dot de>
- To: gcc at gcc dot gnu dot org
- Cc: kirill dot yukhin at gmail dot com, ubizjak at gmail dot com, Jan Hubicka <hubicka at ucw dot cz>
- Date: Fri, 15 Jun 2018 13:48:34 +0200 (CEST)
- Subject: Vectorizer size preferences (-mprefer-* on x86)
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.