Displaying 20 results from an estimated 4000 matches similar to: "[LLVMdev] loop vectorizer says Bad stride"
2013 Oct 28
0
[LLVMdev] loop vectorizer says Bad stride
Frank,
It looks like the loop vectorizer is unable to tell that the two stores in your code never overlap. This is probably because of the sign-extend in your code. Can you extend the indices to 64bit ?
Thanks,
Nadav
On Oct 28, 2013, at 1:38 PM, Frank Winter <fwinter at jlab.org> wrote:
> Verifying function
> running passes ...
> LV: Checking a loop in "bar"
> LV:
2017 May 19
4
memcmp code fragment
Hi,
Look at the following code:
Look at the following C code seqence:
unsigned char mainGtU ( unsigned int i1,
unsigned int i2,
unsigned char* block)
{
unsigned char c1, c2;
c1 = block[i1]; c2 = block[i2];
if (c1 != c2) return (c1 > c2);
i1++; i2++;
c1 = block[i1]; c2 = block[i2];
if (c1 != c2) return (c1 > c2);
i1++; i2++;
..
..
2013 Nov 08
1
[LLVMdev] loop vectorizer and storing to uniform addresses
I changed the input C to using a 64 bit type for the loop index (this
eliminates 'sext' instructions in the IR)
Here the IR produced with clang -O0
define float @foo(i64 %start, i64 %end, float* %A) #0 {
entry:
%start.addr = alloca i64, align 8
%end.addr = alloca i64, align 8
%A.addr = alloca float*, align 8
%sum = alloca [4 x float], align 16
%i = alloca i64, align 8
2013 Nov 08
0
[LLVMdev] loop vectorizer and storing to uniform addresses
On 7 November 2013 17:18, Frank Winter <fwinter at jlab.org> wrote:
> LV: We don't allow storing to uniform addresses
>
This is triggering because it didn't recognize as a reduction variable
during the canVectorizeInstrs() but did recognize that sum[q] is loop
invariant in canVectorizeMemory().
I'm guessing the nested loop was unrolled because of the low trip-count,
and
2013 Nov 01
2
[LLVMdev] loop vectorizer: this loop is not worth vectorizing
I am trying a setup where the one loop is rewritten as two loops. This
avoids the 'rem' and 'div' instructions in the index calculation (which
give the loop vectorizer a hard time).
However, with this setup the loop vectorizer complains about a too small
loop.
LV: Checking a loop in "main"
LV: Found a loop: L3
LV: Found a loop with a very small trip count. This loop
2013 Nov 08
3
[LLVMdev] loop vectorizer and storing to uniform addresses
I am trying my luck on this global reduction kernel:
float foo( int start , int end , float * A )
{
float sum[4] = {0.,0.,0.,0.};
for (int i = start ; i < end ; ++i ) {
for (int q = 0 ; q < 4 ; ++q )
sum[q] += A[i*4+q];
}
return sum[0]+sum[1]+sum[2]+sum[3];
}
LV: Checking a loop in "foo"
LV: Found a loop: for.cond1
LV: Found an induction variable.
LV: We
2014 Sep 18
2
[LLVMdev] [Vectorization] Mis match in code generated
Hi Nadav,
Thanks for the quick reply !!
Ok, so as of now we are lacking capability to handle flat large reductions.
I did go through function vectorizeChainsInBlock() (line number 2862). In
this function,
we try to vectorize if we have phi nodes in the IR (several if's check for
phi nodes) i.e we try to
construct tree that starts at chains.
Any pointers on how to join multiple trees? I
2014 Sep 19
3
[LLVMdev] [Vectorization] Mis match in code generated
Hi Arnold,
Thanks for your reply.
I tried test case as suggested by you.
*void foo(int *a, int *sum) {*sum =
a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]+a[8]+a[9]+a[10]+a[11]+a[12]+a[13]+a[14]+a[15];}*
so that it has a 'store' in its IR.
*IR before vectorization :*target datalayout =
"e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
target triple =
2014 Sep 18
2
[LLVMdev] [Vectorization] Mis match in code generated
Hi,
I am trying to understand LLVM vectorization implementation and was looking
into both loop and SLP vectorization.
test case 1:
*int foo(int *a) {int sum = 0,i;for(i=0; i<16; i++) sum += a[i];return
sum;}*
This code is vectorized by loop vectorizer where we calculate scalar loop
cost as 4 and vector loop cost as 2.
Since vector loop cost is less and above reduction is legal to
2013 Oct 28
2
[LLVMdev] Loop vectorizer dosen't find loop bounds
Bingo! That works (when coming from C source)
Now, I have a serious problem. I am not coming from C but I build the
function with the builder. I am also forced to change the signature and
load the pointers a,b,c afterwards:
define void @bar([8 x i8]* nocapture readonly %arg_ptr) #0 {
entrypoint:
%0 = bitcast [8 x i8]* %arg_ptr to i32*
%1 = load i32* %0, align 4
%2 = getelementptr [8 x
2013 Nov 01
0
[LLVMdev] loop vectorizer: this loop is not worth vectorizing
In the case when coming from C it was probably the loop unroller and SLP
vectorizer which vectorized the code. Potentially I could do the same in
the IR. However, the loop body that is generated in the IR can get very
large. Thus, the loop unroller will refuse to unroll the loop in a large
number of (important) cases.
Isn't there a way to convince the loop vectorizer that it should
2014 Nov 10
2
[LLVMdev] [Vectorization] Mis match in code generated
Hi Suyog,
Thanks for looking at this. This has recently got itself onto my TODO list
too.
> I am not sure how much all this will improve the code quality for
horizontal reduction
> (donno how frequently such pattern of horizontal reduction from same
array occurs in real world/SPECS).
Actually the main loop of 470.lbm can be SLP vectorized like this. We have
three parts to it: A fully
2013 Oct 29
2
[LLVMdev] Loop vectorizer dosen't find loop bounds
Thanks for the alternatives!
I am trying the 'extracting sub-function' approach. However, it seems I
can't get the 'subfunction' to pass the verifier. This is my subfunction:
define void @main_extern([8 x i8]* %arg_ptr) {
entrypoint:
%0 = getelementptr [8 x i8]* %arg_ptr, i32 0
%1 = bitcast [8 x i8]* %0 to i64*
%2 = load i64* %1
%3 = getelementptr [8 x i8]*
2013 Oct 28
2
[LLVMdev] Loop vectorizer dosen't find loop bounds
I am trying to vectorize the function
void bar(float *c, float *a, float *b)
{
const int width = 256;
for (int i = 0 ; i < 256 ; ++i ) {
c[ i ] = a[ i ] + b[ i ];
c[ width + i ] = a[ width + i ] + b[ width + i ];
}
}
using the following commands
clang -emit-llvm -S loop.c
opt loop.ll -O3 -debug-only=loop-vectorize -S -o -
LV: Checking a loop in
2013 Oct 28
0
[LLVMdev] Loop vectorizer dosen't find loop bounds
----- Original Message -----
> I am trying to vectorize the function
>
> void bar(float *c, float *a, float *b)
> {
> const int width = 256;
> for (int i = 0 ; i < 256 ; ++i ) {
> c[ i ] = a[ i ] + b[ i ];
> c[ width + i ] = a[ width + i ] + b[ width + i ];
> }
> }
>
> using the following commands
>
> clang
2013 Oct 28
0
[LLVMdev] Loop vectorizer dosen't find loop bounds
----- Original Message -----
> Bingo! That works (when coming from C source)
>
> Now, I have a serious problem. I am not coming from C but I build the
> function with the builder. I am also forced to change the signature
> and
> load the pointers a,b,c afterwards:
>
> define void @bar([8 x i8]* nocapture readonly %arg_ptr) #0 {
> entrypoint:
> %0 = bitcast [8 x
2013 Nov 06
2
[LLVMdev] loop vectorizer: Unexpected extract/insertelement
The following IR implements the following nested loop:
for (int i = start ; i < end ; ++i )
for (int p = 0 ; p < 4 ; ++p )
a[i*4+p] = b[i*4+p] + c[i*4+p];
define void @main(i64 %arg0, i64 %arg1, i1 %arg2, i64 %arg3, float*
noalias %arg4, float* noalias %arg5, float* noalias %arg6) {
entrypoint:
br i1 %arg2, label %L0, label %L1
L0:
2016 Sep 16
2
SCEV cannot compute the trip count of Simple loop
Hi All,
I am trying to unroll the below loop, but couldn't as SCEV returns TripCount as 0.
void foo(int x) {
int p, i = 1;
int mat[6][6][6];
for (p = x+3 ; p<= x+6 ;p++)
mat[x][p][i] = mat[x][p][i] + 5;
}
For a quick reference I have added the generated IR compiled with clang using -O3.
Please let me know if this is an known issue in SCEV or I am missing something here ?
;
2016 Sep 16
3
SCEV cannot compute the trip count of Simple loop
I have modified the example test case for UB error, still it didn’t unroll
void foo(int x) {
int p, i = 1;
int mat[9][9][9];
for (p = (x+1) ; p < (x+3) ;p++)
mat[x][p-1][i] = mat[x][p-1][i] + 5;
}
Regard,
Deepali
From: Kevin Choi [mailto:code.kchoi at gmail.com]
Sent: Friday, September 16, 2016 1:20 PM
To: Rai, Deepali
Cc: llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] SCEV
2013 Oct 29
0
[LLVMdev] Loop vectorizer dosen't find loop bounds
----- Original Message -----
> Thanks for the alternatives!
>
> I am trying the 'extracting sub-function' approach. However, it seems
> I
> can't get the 'subfunction' to pass the verifier. This is my
> subfunction:
>
> define void @main_extern([8 x i8]* %arg_ptr) {
> entrypoint:
> %0 = getelementptr [8 x i8]* %arg_ptr, i32 0
> %1 =