[LLVMdev] [PATCH] parallel loop awareness to the LoopVectorizer
Nadav Rotem
nrotem at apple.com
Tue Jan 29 10:58:12 PST 2013
On Jan 29, 2013, at 12:51 AM, Tobias Grosser <tobias at grosser.es> wrote:
>
> # ignore assumed dependences.
> for (i = 0; i < 4; i++) {
> tmp1 = A[3i+1];
> tmp2 = A[3i+2];
> tmp3 = tmp1 + tmp2;
> A[3i] = tmp3;
> }
>
> Now I apply for whatever reason a partial reg2mem transformation.
>
> float tmp3[1];
>
> # ignore assumed dependences. // Still valid?
> for (i = 0; i < 4; i++) {
> tmp1 = A[3i+1];
> tmp2 = A[3i+2];
> tmp3[0] = tmp1 + tmp2;
> A[3i] = tmp3[0];
> }
The transformation that you described is illegal because it changes the behavior of the loop. In the first version only A is modified, and in the second version of the loop both A and tmp3 are modified. Can you think of another example that demonstrates why the per-instruction attribute is needed ?
I am afraid that so many different llvm transformations will have to be modified to preserve parallelism. This is not something that I want to slip in. If we want to add new parallelism semantics to LLVM them we need to discuss the bigger picture. We need to plan a mechanism that will allow us to implement support for a number of different models (Vectorizers, SPMD languages such as GL and CL, parallel threads such as OpenMP, etc).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130129/010444a8/attachment.html>
More information about the llvm-dev
mailing list