[llvm-dev] Jacobi 5 Point Stencil Code not Vectorizing
hameeza ahmed via llvm-dev
llvm-dev at lists.llvm.org
Sat Jul 1 13:54:21 PDT 2017
Does it happen due to loop carried dependence? if yes what is the solution
to vectorize such codes?
please reply. i m waiting.
On Jul 1, 2017 12:30 PM, "hameeza ahmed" <hahmed2305 at gmail.com> wrote:
> I even tried polly but still my llvm IR does not contain vector
> instructions. i used the following command;
>
> clang -S -emit-llvm stencil.c -march=knl -O3 -mllvm -polly -mllvm
> -polly-vectorizer=stripmine -o stencil_poly.ll
>
> Please specify what is wrong with my code?
>
>
> On Sat, Jul 1, 2017 at 4:08 PM, hameeza ahmed <hahmed2305 at gmail.com>
> wrote:
>
>> Hello,
>>
>> I am trying to vectorize following stencil code;
>>
>> #include <stdio.h>
>> #define N 100351
>>
>> // This function computes 2D-5 point Jacobi stencil
>> void stencil(int a[restrict][N])
>> {
>> int i, j, k;
>> for (k = 0; k < 100; k++)
>> { for (i = 1; i <= N-2; i++)
>> { for (j = 1; j <= N-2; j++)
>> { a[i][j] = 0.25 * (a[i][j] + a[i-1][j] + a[i+1][j] + a[i][j-1]
>> + a[i][j+1]);
>> }
>> }
>> }}
>>
>> I have used the following commands
>>
>> clang -S -emit-llvm stencil.c -march=knl -O3 -mllvm -disable-llvm-optzns
>> -o stencil.ll
>>
>> opt -S -O3 stencil.ll -o stencil_o3.ll
>>
>> llc -x86-asm-syntax=intel stencil_o3.ll -o stencil.s
>>
>> But the code is not vectorized. It still uses the scalar instructions;
>>
>> Please correct me.
>>
>> Thank You
>>
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170702/6381642e/attachment-0001.html>
More information about the llvm-dev
mailing list