[PATCH] support llvm.vectorization.vector_width metadata

Tobias Grosser tobias at grosser.es
Wed May 29 07:27:30 PDT 2013


On 05/29/2013 07:09 AM, David Tweed wrote:
>> "This metadata forces the loop vectorizer to widen scalar values to a
>> vector width of ``N`` rather than computing the width using a cost model."
>>
>> Could you add the following senctence.
>>
>> "The ``llvm.vectorizer.width'' metadata overwrites only the cost
>> heuristics of the vectorizer. To actually vectorize a loop the
>> vectorizer either needs to be able to prove that a loop is parallel or
>> the loop has to be marked with additional
>> ``llvm.mem.parallel_loop_access'' as parallel"
>
> I like where you're going, but I think this is too over-specified. How
> about (as a general cleanup of this section):
>
> """
> |This metadata sets the target width of the vectorizer to ``N``. Without
> |this metadata, the vectorizer will choose a width automatically.
> |Regardless of this metadata, the vectorizer will only vectorize loops if
> |it is safe to do so.
>
> A couple of minor things. Firstly, I'd prefer "valid" to "safe". Secondly, I
> know
> it's anthropomorphising the compiler, but how about "if it believes it is
> valid
> to do so" (since conceivably one could have loops which are not at the LLVM
> language level valid to vectorize but which are, at the level of the
> algorithm,
> it yields the same result...)

Yes, this is even better.

Tobi




More information about the llvm-commits mailing list