AnsweredAssumed Answered

Use isa/il with OpenCL, Create BIF from isa/il

Question asked by tivxo on Oct 12, 2015

hi,

 

I'd like to compile OpenCL kernels with llvm (clang opencl frontend and amdgpu backend (http://llvm.org/docs/AMDGPUUsage.html)) and run them with the AMD OpenCL interface. Since the llvm amdgpu backend produces gcn-isa, it would be nice be able to create a binary image - in the form of what the OpenCL framework produces, when you call clGetProgramInfo(...,CL_PROGRAM_BINARIES,... - loadable from OpenCL.

 

So, is there any "official" way/tool of using isa (gcn) or amdil for OpenCL? Can this be done directly from llvm? Any suggestions other than the nasty binary patching?

 

AMD uses llvm as part of their toolchain (see http://developer.amd.com/wordpress/media/2013/07/AMD_Accelerated_Parallel_Processing_OpenCL_Programming_Guide-rev-2.7.pdf , Chapter 3), so there has to be a way, I guess.

 

 

I know that there have been discussions about patching a binary generated with the AMD OpenCL framework, like so "

https://community.amd.com/thread/160199?q=Use isa/il with OpenCL", "https://community.amd.com/message/1285055#1285055". I'd rather use an official or at least more elegant way. Since theses threads are fairly old, I guess it's okay to "repeat" the question. I also think that the public llvm amdgpu backend did not exist ~3 years ago.

 

 

Thanks for your help!

Outcomes