Philipp Schaad via llvm-dev
2017-May-08 09:43 UTC
[llvm-dev] [OpenCL][AMDGPU] Using AMDGPU generated kernel code for OpenCL
Hello everyone I was wondering, what the correct way of using an AMDGPU generated kernel code for OpenCL was. I am trying to provide Polly's GPGPU Code generation with the ability to run on different GPU devices, such as AMD GPUs. For NVIDIA, I simply retrieve a pre-compiled PTX string from the NVPTX backend and pass that to OpenCL's 'clCreateProgramWithBinary' function. However, when doing the same with the AMDGPU backend and its returned kernel string, OpenCL complains about an invalid binary. This has been tried with a number of different target triples (eg. 'amdgcn--', 'amdgcn-amd-amdhsa' etc), and my assumption so far is, that I am not trying the correct Triple. Or am I missing something entirely, and there have to be additional steps, to get the correct ELF binary? Thank you in advance for any help and pointers! Best, Philipp -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170508/b9910505/attachment.html>
Michael Kruse via llvm-dev
2017-May-09 13:49 UTC
[llvm-dev] [OpenCL][AMDGPU] Using AMDGPU generated kernel code for OpenCL
The binary format expected by AMD OpenCL drivers are elf-linked binaries. See http://openwall.info/wiki/john/development/AMD-IL https://community.amd.com/thread/166955 Michael 2017-05-08 11:43 GMT+02:00 Philipp Schaad via llvm-dev <llvm-dev at lists.llvm.org>:> Hello everyone > > I was wondering, what the correct way of using an AMDGPU generated kernel > code for OpenCL was. I am trying to provide Polly's GPGPU Code generation > with the ability to run on different GPU devices, such as AMD GPUs. > > For NVIDIA, I simply retrieve a pre-compiled PTX string from the NVPTX > backend and pass that to OpenCL's 'clCreateProgramWithBinary' function. > However, when doing the same with the AMDGPU backend and its returned kernel > string, OpenCL complains about an invalid binary. > This has been tried with a number of different target triples (eg. > 'amdgcn--', 'amdgcn-amd-amdhsa' etc), and my assumption so far is, that I am > not trying the correct Triple. > Or am I missing something entirely, and there have to be additional steps, > to get the correct ELF binary? > > Thank you in advance for any help and pointers! > > Best, > Philipp > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >
Philipp Schaad via llvm-dev
2017-May-10 08:11 UTC
[llvm-dev] [OpenCL][AMDGPU] Using AMDGPU generated kernel code for OpenCL
Hi Michael Thank you for those two links. So if I understand that correctly, this means that the ISA generated by the AMDGPU backend is only a part of the expected elf-linked binary file, and would have to be correctly wrapped/packed up in order for OpenCL to accept it? Best, Philipp On Tue, 9 May 2017 at 15:49 Michael Kruse <llvmdev at meinersbur.de> wrote:> The binary format expected by AMD OpenCL drivers are elf-linked binaries. > See > > http://openwall.info/wiki/john/development/AMD-IL > https://community.amd.com/thread/166955 > > Michael > > > 2017-05-08 11:43 GMT+02:00 Philipp Schaad via llvm-dev > <llvm-dev at lists.llvm.org>: > > Hello everyone > > > > I was wondering, what the correct way of using an AMDGPU generated kernel > > code for OpenCL was. I am trying to provide Polly's GPGPU Code generation > > with the ability to run on different GPU devices, such as AMD GPUs. > > > > For NVIDIA, I simply retrieve a pre-compiled PTX string from the NVPTX > > backend and pass that to OpenCL's 'clCreateProgramWithBinary' function. > > However, when doing the same with the AMDGPU backend and its returned > kernel > > string, OpenCL complains about an invalid binary. > > This has been tried with a number of different target triples (eg. > > 'amdgcn--', 'amdgcn-amd-amdhsa' etc), and my assumption so far is, that > I am > > not trying the correct Triple. > > Or am I missing something entirely, and there have to be additional > steps, > > to get the correct ELF binary? > > > > Thank you in advance for any help and pointers! > > > > Best, > > Philipp > > > > _______________________________________________ > > LLVM Developers mailing list > > llvm-dev at lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170510/c0bbbc00/attachment.html>