cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

philips
Journeyman III

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

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.

0 Likes
5 Replies
omkaranathan
Adept I

Which GPU and driver are you using? 

What is the behavior outside SKA?

 

0 Likes

The GPU I tried it on was a 5800 (Cypress)

 

EDIT:

 

I just looked at the driver version. I am not familar with ATI so I ll just paste it all:

 

Driver Packaging Version 8.732-100504a-099996C-ATI 
Catalyst™ Version 10.5 
Provider ATI Technologies Inc. 
2D Driver Version 8.01.01.1030 
2D Driver File Path /REGISTRY/MACHINE/SYSTEM/ControlSet001/Control/CLASS/{4D36E968-E325-11CE-BFC1-08002BE10318}/0000 
Direct3D Version 8.14.10.0753 
OpenGL Version 6.14.10.9836 
Catalyst™ Control Center Version 2010.0504.2152.37420

 

 

Outside the SKA:  the Program::build function never returns a value. It just fails. No error message.

 

 

 

 

I don't think it's relevant here, but because of a different bug I also added the line int dummy = (*input).totalWork; at the beginning of the kernel.

(A known problem with unused struct parameters)

 

 

 

0 Likes

 

I edited the previous post with the information you asked for.

 

omkaranathan, have you tried compiling it with the SKA?

 

 

 

here is the raw version of the first paste: http://pastebin.com/raw.php?i=J2ss4XYj

(for copy and paste purposes)

 

0 Likes

philips,

Current release of SKA has issues in handling large size of code. You can expect this to compile without any issues with an upcoming release.

0 Likes

Hi.

 

I just want to make sure you have seen that I added a comment to the ticket I wrote last week (with the same title. ticketID 1006).


It's not limited to the SKA. and I have posted a link to a testcase.

0 Likes