[PATCH] Implement pragma llvm.vectorizer.enable in LoopVectorizer
nrotem at apple.com
Fri Nov 29 09:23:59 PST 2013
On Nov 29, 2013, at 4:03 AM, Renato Golin <renato.golin at linaro.org> wrote:
>> I would like to propose a slightly different semantic for this pragma. I think that people who care about vectorization would like to do one of following:
>> 1. Tell the compiler to enable vectorization on this part of the code, even if vectorization is disabled via -Oz, etc.
> This is the other semantics, which I'll implement next.
> If the vectorizer is enable, I want to be able to force the
> vectorization of loops even if the cost analysis say it's not worth
> it. If the vectorizer is not enabled, I want to enable it and
> vectorize this loop, also no matter the cost.
> This is why I think these two behaviours are related.
There are so many vectorization configurations: WIDTH x UNROLL, and selecting anything but scalar is not that usable. You either trust LLVM to select the best vectorization configuration for you, or you don’t. If you don’t trust LLVM’s heuristics then you can use the UNROLL and WIDTH pragmas to select specific configuration parameters. I don’t think that it makes sense to have a pragma that says that the vectorizer should select whatever it wants except for one specific configuration. The goal is not to see vector instructions in the code, the goal is to give the users tools to tune their code.
Maybe the "#vectorize enable” should be a code block pragma, not a loop pragma. We could attach metadata to basic blocks and if a loop is dominated by a block with ‘enable’ metadata then vectorization should be allowed.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-commits