cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

omion
Journeyman III

Viewing x86/x64 assembly

Is there any easy way to view the x86 (or preferably x64) assembly of an OpenCL kernel? Stream KernelAnalyzer does not want to output an x86 assembly listing for some reason.

What I do now is write to a null pointer in the kernel, then run a MSVS debug with a temp host program, then disassemble the code where it throws an exception. This takes a long time and I need to actually put together a program to run the kernel, so it's not very easy to optimize a kernel for it.

Is there any way to just dump the assembly to a file somewhere without having to run a program to get it?

Also, when will Stream KernelAnalyzer support this? The x86 format has been there a while, but it never does anything.
0 Likes
4 Replies

Get the OpenCL binary and disassemble it. It is in ELF format and any standard ELF modification tools can be used on it.
0 Likes

Alternatively, set a breakpoint in your kernel in gdb and type disassemble.

0 Likes

Sorry for the questions, but is there a way to compile a .cl source file to an x86 binary with the command line?

All I can do so far is make a dummy program which calls clBuildProgram(...), then search for a randomly-named DLL file to disassemble. (Also, the file seems like a regular PE file - surely it would only be ELF for Linux?)
0 Likes

omion,

Refer to the SDK sample load and dump options. you will also find the BIF section  in opencl Programming guide useful.

0 Likes