cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

gwz
Journeyman III

clBuildProgram crashes

building an OpenCL program for GPU crashes.

The code has some parameters, namely loop bounds and local array sizes. For some parameter combinations clBuildProgram causes a segmentation fault, some are working fine and some builds are nor reproducible. The program builds and runs fine with AMDAPP OpenCL for CPU device (and for Nvidia OpenCL for GPU). The problem occurs with current and previous versions of AMDAPP.

The clBuildProgram invokes a compiler, which may print warnings or error messages, may fail to optimize code, but should never crash.

Tags (2)
0 Likes
16 Replies
MicahVillmow
Staff
Staff

Re: clBuildProgram crashes

Please provide the crashing kernel and the compile options, otherwise we cannot debug the issue.

0 Likes
10n02
Adept I

Re: clBuildProgram crashes

I have the same issue.

the problem didn't occur with CCC 11.12 but occurs with CCC 12.1

my projet is big, it's hard to isolate it in a small sample

but here is the idea:

In my kernel prog, I have something like that:

-------------------------------------------------------------------------------------

... lot of code ....

//I declare an "internal" function: no __kernel in front of it

void OneFunction(

... lot of args ...

float* argsOut,

... lot of args ...

)

{

... lot of code ...

if ( t1 >= 0.0f ) {  *argsOut= t1;  }

... lot of code ...

}

... lot of code ....

-------------------------------------------------------------------------------------

If I build this kernel on the GPU, clBuildProgram will crash (that doesn't crash on the CPU)

but for example, if I do something like that, that works:

------------------------------------------

//I replace t1 with a random value, my code becomes wrong BUT clBuildProgram doesn't crash

if ( t1 >= 0.0f ) {  *argsOut= 123456.0f;  }

-----------------------------------------

Weird isn't it ???

(Once again, this is since CCC 12.1)

Edit: it seems that the problem doesn't come from the condition, but just the set of the variable

Edit #2 : For the moment, I avoid the crash with -cl-opt-disable in the clBuildProgram arguments... hope this crash will be corrected in the next driver version.

viscocoa
Adept I

Re: clBuildProgram crashes

Just experienced the same problem.

My OpenCL program actually compiled well a few months ago. I then upgraded all drivers and OpenCL SDK. The cl program now cause clBuildProgram to crash. The cl program still compiles well when tagarted at Intel CPU.

0 Likes
MicahVillmow
Staff
Staff

Re: clBuildProgram crashes

Without a test case we cannot confirm that the problem still exists and we cannot fix it if it still exists.

0 Likes
fod_dzug
Journeyman III

Re: clBuildProgram crashes

Having the same problem. I used 10n02's advice and disabled optimization and it stopped crashing as well.

My code is 70Kb long so I can't paste it here.

0 Likes
viscocoa
Adept I

Re: clBuildProgram crashes

The problem does exist.

Because my program is a bit complex, it takes time to make a problem sample from it to show you.

I have pinpointed the problem. It happens on an operation like __local int3 x = (int3)(0, 0, 0); but much more complex than this.

0 Likes
tl
Journeyman III

Re: clBuildProgram crashes

Hi Micah,

I can confirm that clBuildPRogram crashes on __local char <name>[<constant>];

and there is no support for 16 and 64 bits local data.

A simple test reveals that there is only 32 bit support on local data.

Kind regards,

Tino

My kernel test:

void TVPclAmdTestSharedMemory ()

{

  // Ok

  __local float sdf[4];

  sdf[0] = 0;

  sdf[1] = 1;

  // Ok

  __local int sdi[4];

  sdi[0] = 0;

  sdi[1] = 1;

  // Compilation fails

  /*

  __local double sdd[4];

  sdd[0] = 0;

  sdd[1] = 1;

  */

  // Compilation fails

  /*

  __local short sds[4];

  sds[0] = 0;

  sds[1] = 1;

  */

  // Causes AMD compiler clBuildProgram to crash

  /*

  __local char sdc[4];

  sdc[0] = 0;

  sdc[1] = 1;

  */

}

0 Likes
MicahVillmow
Staff
Staff

Re: clBuildProgram crashes

Tino,

What device are you attempting to compile on and with what SDK? This test case compiles fine for me.

0 Likes
tl
Journeyman III

Re: clBuildProgram crashes

I used a Radeon 6310 aka Loveland in combination with an E350 CPU. It crashed on the 6310.

Sent from Samsung Galaxy Note

0 Likes