[llvm-dev] Extending SLP Vectorizer to deal with aggregates?

Tom Stellard via llvm-dev llvm-dev at lists.llvm.org
Wed Oct 14 09:16:53 PDT 2015


On Wed, Oct 14, 2015 at 03:40:49PM +0000, Robison, Arch via llvm-dev wrote:
> I'm looking for a sanity check on extending SLP Vectorizer to deal with aggregates.
> 
> I'd like to vectorize Julia tuple operations.  The Julia compiler lowers tuples to LLVM arrays, not LLVM vectors.  I've tried making Julia lower tuples to LLVM vectors, but that hurt performance when SLP Vectorizer was not applicable, because of extraction/insertion overhead.  I.e., the Julia lowering is too early to make the right choice on vector vs. array representation of tuples.  So instead I'd like to make SLP Vectorizer vectorize idioms involving aggregates.  A sample of the idiom is at https://gist.github.com/ArchRobison/e762cd55b8cfc0e019a3 .
> 
> 1. Identify stores of arrays.  E.g. "store [4 x float]".
> 2. Walk chains backwards from the array stores, similar to the way SLPVectorizer already walks chains.
> 3. If vectorization is applicable, replace array construction/load/store with vector construction/load/store.  Vector load/stores will be unaligned.
> 
> Does this sound like a reasonable approach?  If it sounds too Julia-specific, I could do it as a custom Julia pass.
> 

Hi Arch,

This kind of vectorization would be useful for the AMDGPU backend
especially for allocas.

We already have a custom pass in the backend called AMDGPUPromoteAllocas
which replaces loads and stores to alloca pointers with vector
operations in some very simple cases.  It would be great to have something more
generic that handles more cases.

-Tom
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



More information about the llvm-dev mailing list