I'm using HelloWorld example from APP SDK 3.0 with your OpenCL compute program(Particles.cl), during calling clBuildProgram crash happens in amdocl.dll.
The list of GPU where problem was found:
GPU AMD R5 Graphics(Notebook), AMD Radeon (TM) R9 380 Series (OpenCL 1.2 AMD-APP (2348.3) Radeon Software Version 17.1.1)
Minimal problem code: (From HelloWorld example APP SDK 3.0):
status=clBuildProgram(program, 1,devices,NULL,NULL,NULL); // crash
Screenshot from system where problem was found:
On AMD R7 240, Intel HD 4000, nVidia 8600GT, nVidia 210 GT it works fine!, final result with same OpenCL Program(Particles.cl😞
I attached modified sample program(for test) from APP SDK HelloWorld and separate Particles.cl, please check Particles.cl program in attached archive or use separate attached file.
This is driver bug or not ?
Thanks for reporting this. I was able to reproduce the issue. After a quick test, it seems that attached kernel is working fine on SI cards (e.g. R7 240), however generating a segfault on CI+ cards (e.g. R9 380 Tonga). I'll verify it further and open a ticket if required.
Here is a good news. The compiler team has found the root of the crash and already fixed it. Please use the below workaround until the fix is publicly available.
Use string literal as a format argument of printf. Compiler was unable to track constant expression if format is defined as a variable. That is, replace "format" variable by string literal as shown below:
__constant char* format = (__constant char *)"Particle width %f height %f pos %f %f %f"
"totalTimeAlive %f timeAlive %f\n";
printf(format, particle.Width, particle.Height, particle.position.x, particle.position.y, particle.position.z, particle.totalTimeAlive, particle.timeAlive);
printf((__constant char *)"Particle width %f height %f pos %f %f %f"
"totalTimeAlive %f timeAlive %f\n", particle.Width, particle.Height, particle.position.x, particle.position.y, particle.position.z, particle.totalTimeAlive, particle.timeAlive);