cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

maxdz8
Elite

Automatic injection of -g option when building GPU kernel

Hello, CodeXL is currently failing on me, popping a message box reading:


Could not debug kernel.


The kernel is not debuggable (it was probably built without debugging flags).


...


Now, if I go in Menu Debug>Debug Settings and then open Analyze>OpenCL Build Options>Other I have indeed set the -g flag.

Is this really for analyze mode only?

For the time being, I'm putting -g in my build flags. However, I'm afraid I've missed this in the CL spec (I'm running 1.2 and thus referring to 1.2). It is my understanding this flag was specified in the CL2.0 spec.

So, I'm a bit uneasy at adding it to the build code. Shouldn't CodeXL inject this itself? Perhaps something is wrong with my setup?

0 Likes
1 Solution

CodeXL does indeed inject -g (among other flags) to clBuildProgram. However, these flags don't add debug information if the program was created using clCreateProgramWithBinary (it's simply too late to do so).

To be able to perform kernel debugging with CodeXL, you must create the program with clCreateProgramWithSource.

* The options you mentioned are under the Analyze tab - and therefore only relevant to the static kernel analysis feature of CodeXL.

Regards,

View solution in original post

0 Likes
2 Replies

CodeXL does indeed inject -g (among other flags) to clBuildProgram. However, these flags don't add debug information if the program was created using clCreateProgramWithBinary (it's simply too late to do so).

To be able to perform kernel debugging with CodeXL, you must create the program with clCreateProgramWithSource.

* The options you mentioned are under the Analyze tab - and therefore only relevant to the static kernel analysis feature of CodeXL.

Regards,

0 Likes

Then I guess something must be wrong with my setup, because I am not building from binary at the moment.

Do you suggest to reinstall?

I am currently using clCreateProgramWithSource and clBuildProgram (flags defining two macros I use). I can even set breakpoints on them.

I have no errors.18_36_26-Debugged Process Events.png

0 Likes