[PATCH] D66199: [docs] loop pragmas

Michael Kruse via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 14 13:09:50 PDT 2019


Meinersbur added inline comments.


================
Comment at: docs/LanguageExtensions.rst:3068-3069
 
+There are loop hints that control transformations (e.g. vectorization, loop
+unrolling) and there loop hints that set transformation options (e.g.
+``vectorize_width``, ``unroll_count``).  Pragmas setting transformation options
----------------
SjoerdMeijer wrote:
> Meinersbur wrote:
> > `vectorize_width` also "controls" a transformation. Is it that in our interpretation, `vectorize(enable)` overrides the profitability heuristic by taking out the "do not apply at all" option without setting any other option?
> I think I need to think a little bit more about this:
> 
> > Is it that in our interpretation, vectorize(enable) overrides the profitability heuristic by taking out the "do not apply at all" option without setting any other option?
> 
> but I would answer this with "yes". But just checking, what exactly do you mean with "do not apply at all option"?
I unfortunately mixed two meanings of "option" here:
1. option as in optimization setting
2. option as in candidate to choose from.

Let's take a look on the loop vectorizer. The profitability heuristic's job is too choose the "best" candidate out of the following list (independently of how LoopVectorize's heuristic is actually implemented; these might be decision made independently of each other, but as the user still sees one of the following outcomes):

0) no vectorization (the "do not apply at all" option/candidate)
1a) vec width=2 with epilogue
1b) vec width=2 without epilogue
2a) vec width=4 with epilogue
2b) vec width=4 without epilogue
3a) vec width=8 with epilogue
3b) vec width=8 without epilogue
...

`vectorize(enable)` with remove 0) as a candidate. `vecorize(disable)` will remove all expect 0) as a candidate. 

The option/settings are `vectorize_width` and `vectorize_predicate` (and `interleave_count`). For instance `vectorize_width(4)` would remove 1) and 3)+ from the candidate list. `vectorize_predicate(enable)` takes any a) candidate from the list. What we were discussing was that these settings would remove 0) from the candidate list as well.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66199/new/

https://reviews.llvm.org/D66199





More information about the cfe-commits mailing list