3 Replies Latest reply on Aug 22, 2013 2:48 PM by sesef

    invalid unroll factor

    sesef

      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
      
      
        • Re: invalid unroll factor
          himanshu.gautam

          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.

          • Re: invalid unroll factor
            settle

            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 + 8)

            #define bar(y) foo(y)

             

            ...

             

            #pragma unroll bar(SIZECOFEF)

            for (...)