cancel
Showing results for 
Search instead for 
Did you mean: 

OpenCL

bhimberg
Journeyman III

UNREACHABLE executed! Involves a switch and sin, cos, tan. Works fine without -cl-opt-disable.

Attached is a complete code sample which causes an "UNREACHABLE executed!" error when compiled on an AMD gpu (Tahiti, Catalyst 13.9, Windows 7 x64).

I've simplified it down to the part that is causing the error: the original kernel was much larger, and had many more math functions in the switch (sinh, tanh, log... etc). Only sin, cos and tan cause this error under these conditions. Additionally, I've run this code successfully on Intel's platform for both GPUs and CPUs, as well as AMD's platform for CPUs.

Finally it does not produce an error unless the compile time option "-cl-opt-disable" is used. Unfortunately I need to disable optimizations for another kernel I'm using (specifically MCW64X, found here). I plan on submitting more code for that bug tomorrow night, hopefully!

The code in question (SomeFunction) isn't even used in the kernel. This might explain why "-cl-opt-disable" is needed (otherwise dead code removal would cull it). I'm basically submitting this as a bug, but I would love to hear a solution: I was hoping make a run with my kernel this weekend.

Best wishes,

Ben

0 Kudos
Reply
3 Replies
jtenbrink
Journeyman III

Re: UNREACHABLE executed! Involves a switch and sin, cos, tan. Works fine without -cl-opt-disable.

I'm also encountering this when invoking clBuildProgram with these options:      sCompilerOptions = "-D _DEBUG -D _AMD_ -cl-opt-disable -fbin-amdil";

I'll be happy to send the opencl kernels to an amd support engineer.

CodeXL 1.3 also crashes when attempting to build and analyze these kernels.

-jim tenbrink

esri

0 Kudos
Reply
himanshu_gautam
Grandmaster

Re: UNREACHABLE executed! Involves a switch and sin, cos, tan. Works fine without -cl-opt-disable.

Hi

Sorry for the late reply.

I tried compiling your code. i got compilation error for the function program.build():

I am using visual studio to compile the application


0 Kudos
Reply
bhimberg
Journeyman III

Re: UNREACHABLE executed! Involves a switch and sin, cos, tan. Works fine without -cl-opt-disable.

Hi, sorry for the late reply to the late reply.

The sample code I provided uses some C++11 functionality. Replace the 'try {program.build...' line with:

std::vector<cl::Device> target_device; target_device.push_back(device);

try { program.build(target_device,"-cl-opt-disable"); }

0 Kudos
Reply