cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

sesef
Journeyman III

invalid unroll factor

I have some problems with unroling loops, AMD retun clBuildProgram, with Intel OCL works fine

code:


__kernel void conv(...)


{



    #pragma unroll (SIZECOEF+8)


    for (j = 1; j <= SIZECOEF+8; j++)


    {


        ....


    }


}




compiler parameters


-DSIZEFAC=288 -DSIZECOEF=49 -DMAX_N_PAR=200 -DLMAX=6 -DMMAX=6



0 Likes
2 Replies
himanshu_gautam
Grandmaster

Could you please let us know exactly what error you are getting.

Also it will be helpful if you give the software version which you are using.

0 Likes
settle
Challenger

The problem you are experiencing (and I have too) is at what stage literal expressions are evaluated.  You might even experience that for some compilers #pragma unroll (SIZECOFEF), i.e., with the parenthesis, would also error out.  There is a trick around this, but it requires using nested macro functions to ensure the SIZECOFEF+8 is evaluated before it reaches the #pragma unroll stage.  I'm sorry that I forget the exact phrase at the moment to search for the solution.  Anyways, the behavior you may be experiencing is actually due to how C was defined and not really the compiler's fault.  If you ever experienced #pragma unroll SIZECOFEF error out, that would definitely be a problem (as long as SIZECOFEF was a literal constant and not a literal expression).

Try the following:

#define foo(y) (y + 😎

#define bar(y) foo(y)

...

#pragma unroll bar(SIZECOFEF)

for (...)