[LLVMdev] Loop vectorizer

Ralf Karrenberg Chareos at gmx.de
Thu Oct 18 02:48:39 PDT 2012


Hi Hal,

On 10/17/12 9:43 AM, Hal Finkel wrote:
>> I am currently working on a full re-implementation of the WFV
>> algorithm
>> on top of the latest trunk.
>> One part of it that is basically finished is an analysis pass that I
>> call "vectorization analysis", which annotates a function (WFV works
>> on
>> entire functions) with metadata used during control-flow to data-flow
>> conversion and instruction vectorization.
>
> Is there a reason to use metadata here as opposed to just keeping state in the analysis pass?

Yes, two practical ones:
1) I don't need to to maintain an additional instruction->properties 
mapping and I don't need a map lookup every time I want to check if a 
block/instruction has a certain property (which happens quite often).
2) For debugging purposes, I don't need to write my own 
AssemblyAnnotationWriter but all information is directly visible in the IR.

However, other approaches may of course be viable. My last 
implementation kept its own state, but the metadata approach feels a lot 
more convenient (even though my block and argument metadata patch was 
refused ;) ).

>> Generally, it would be possible to implement a loop vectorizer on top
>> of
>> WFV simply by running a loop dependency analysis to determine if the
>> loop in question is vectorizable, extracting the loop body into a
>> function, running WFV on it, and inlining the call again.
>
> I presume that we could refactor your code in combination with Nadav's work to directly vectorize loop bodies as well. Do you disagree?

I only meant to describe one way of using the code. Due to its 
complexity, I think that moving forward step by step is the right 
approach to include all that functionality in LLVM.

>> I am willing to provide all of my implementation as soon as required.
>> I hope to have mostly finished the rewrite at that point.
>
> I encourage you to do this as soon as possible, otherwise I think that we might miss the opportunity to take advantage of your work in current development.

I'll do my best :).

Cheers,
Ralf



More information about the llvm-dev mailing list