philips

Compiler crashes because of "break;" and "continue;" in loop

Discussion created by philips on Jun 11, 2010
Latest reply on Jun 25, 2010 by philips
on AMD GPU; works on Nvidia GPU

Hi.

I have an OpenCL program that works on an Nvidia GPU and I am trying to get it to run on an AMD GPU.

The function Program::build(...) crashes (fails without error code) as does the Stream KernelAnalyzer.

 

The program uses a function with a loop of the following structure:

while (scale < 23)
    {
 
        if (iter > 10000)
            break;
       
  //more code
  
        if ((child_masks & 0x8000) != 0 && t_min <= t_max)
        {
            if (tc_max * (*ray).dir.w + ray_orig_sz >= scale_exp2)
                break;
           
            //more code
           
            if ((contour_mask & 0x80) != 0)
            {
                //more coed
            }
           
            if (t_min <= tv_max)
            {

                if ((child_masks & 0x0080) == 0)
                    break;

                //more code
    
                continue;
            }
        }
       
        //more code
       
    }

 

the problem lies with the two inner calls:

if (tc_max * (*ray).dir.w + ray_orig_sz >= scale_exp2)
                break;

and

continue;

 

if I comment those out, the program compiles.

 

I have tried using two bool variables:

if, instead of break, I write: bBreak = true;

and then write: if(bBreak) break; 

on the same level as if(iter > 10000), it seems to resolve the problem with the break.

 

However, if I try to replace the continue with a bool bContinue and try to simply call if(bContinue) continue; it still crashes.

Nor does it work if I use 

if(!bContinue){ //rest of the loop }

 

I have no idea why that is or how to work around it.

 

Now I will paste the full .cl Code, which you can try in the KernelAnalyzer:

here is the original version: http://pastebin.com/J2ss4XYj

I have highlighted the two calls at line 434 and 466. If those are removed it compiles.

Here is the version where I changed break; and commented out continue;

http://pastebin.com/nsySW7ts

this compiles successfully.

 

However I have no idea what to do about continue...

 

Thanks for reading.

Outcomes