3

I am trying to view the assembly code of an OpenCL kernel that runs on the AMD GPU of my Mac.

Based on this SO question, OpenCL online compilation: get assembly from cl::program or cl::kernel, I used --save-temps to my clBuildProgram call, as below.

err = clBuildProgram(program, num_devices, deviceList, "-save-temps", NULL, NULL);

However, this fails with error code -43, which translates to CL_INVALID_BUILD_OPTIONS. Based on https://www.khronos.org/registry/OpenCL/sdk/1.0/docs/man/xhtml/clBuildProgram.html, it looks like this option is not supported by the spec.

Tools such as CodeXL shader/kernel analyzer, do not have installation options for Mac.

Is there any other way to see the assembly code for an OpenCL kernel for AMD GPU on OSX?

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
s2o_ozman
  • 71
  • 5

1 Answers1

0

You can call clGetProgramInfo with CL_PROGRAM_BINARIES to get the "binary" for your platform. It is device/platform specific, and may wrap the machine code in some wrapper structure.

Dithermaster
  • 6,223
  • 1
  • 12
  • 20