[PATCH] [SLPVectorization] Enhance Ability to Vectorize Horizontal Reductions from Consecutive Loads

suyog suyog.sarda at samsung.com
Sun Dec 21 21:39:46 PST 2014


Hi Michael,

Thanks for the reply.

We are bundling Left[i] and Left[i+1] (and Right[i] and Right[i+1]). 
So its not beneficial for us if Left[i+1] and Right[i+1] are consecutive.

Also, it doesn't make any sense to vectorize one bundle of load 
while leave the other bundle scalar, since u need two vectors to operate together.
This is taken care by the cost model.

And anyways we are checking the loop till e-1 and not e.

For example purpose lets say that one of the Left-Right is consecutive
while other is not.

Lets take an example -

  (a[0] + a[1]) + (a[4] + a[6]))
                
  Left                Right
  a[0]                 a[1]
  a[4]                 a[6]

This is not vectorizable in current form.

Now, with our patch, since Left[i] and Right[i] are consecutive (integers),
and hence swap Left[i+1] and Right[i]

  Left                  Right
  a[0]                   a[4]
  a[1]                   a[6]

Now, since elements in Left are consecutive, Left can be bundled into a vector of load.
Elements in Right are not consecutive, hence they cannot be bundled into a vector load.

It doesn't make any sense to vectorize one bundle of load while other bundle remains scalar.
This is taken care by the cost model. When we calculate the cost of vectorization, it comes 
to be positive than scalar code (positive means expensive), and hence we do not vectorize the entire code.

Any questions/suggestions/comments are welcomed.

I have updated patch addressing extra space and typos.
Please help in reviewing it.

Regards,
Suyog


REPOSITORY
  rL LLVM

http://reviews.llvm.org/D6675

Files:
  lib/Transforms/Vectorize/SLPVectorizer.cpp
  test/Transforms/SLPVectorizer/AArch64/horizontaladd.ll

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6675.17543.patch
Type: text/x-patch
Size: 4715 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141222/f0a69d6d/attachment.bin>


More information about the llvm-commits mailing list