[LLVMdev] Proposal for ""llvm.mem.vectorize.safelen"

Renato Golin renato.golin at linaro.org
Tue Aug 12 13:07:29 PDT 2014


On 12 August 2014 18:49, Johannes Doerfert <doerfert at cs.uni-saarland.de> wrote:
> I recently submitted a patch to the list [1] which would allow Polly to
> extract the dependency distance for each analyzable loop. While the
> distance is often not constant but parametric we would also need to
> version the vectorized loop based on the actual runtime values.

Since this is a metadata node, we can actually add it with whatever we
want, from an integer constant to whatever we want. But of course,
complexity is an issue. I believe a constant is a good starting point.

Remember that this annotation is saying that "the loop *as it is* is
safe in a N vector", but things can change between the annotation
(generally source code pragmas, but could be a Polly thing) and actual
vectorization. This is a game that the user must be ready to play to
use these advanced features and Polly has to be extremely conservative
(since the user is *not* directly recommending safety boundaries), but
can also allow some extra room (similar to -ffast-math, we could do
-ffast-polly if needed),


> However,
> the versioning doesn't need to be done by the vectorizer but could also
> be part of Polly (depending on whether or not the vectorizer will have
> that capability). I admit that we would need a good heuristic in order
> to turn this feature on as a default optimization, but I will work on
> that in the near future too.

The original idea for vectorization annotations was to help multiple
passes to communicate.

Initially, it was used between two passes of the vectorizer (so it
wouldn't vectorize the same loop again) but later was used as a
vehicle to source code pragmas. Though, the idea of Polly sharing the
annotation space was in it from the beginning, and I think we'll come
up with a lot more metadata than just wide/safe. Arnold had some
slides about it.

cheers,
--renato



More information about the llvm-dev mailing list