[llvm-dev] OpenCL toolset (for AMD GPU)

Tobias Grosser via llvm-dev llvm-dev at lists.llvm.org
Tue Sep 29 07:37:40 PDT 2015


On 09/29/2015 04:19 PM, Tom Stellard via llvm-dev wrote:
> On Tue, Sep 29, 2015 at 01:20:57PM +0000, Paweł Bylica via llvm-dev wrote:
>> Hi LLVM,
>>
>> I would like to compile OpenCL kernel for a specific AMD GPU target. Is it
>> possible with the current clang/LLVM?
>>
>> I started by using `clang -x cl` but it looks like at least some OpenCL
>> specific headers are missing (e.g. uint2 is not recognized as a type).
>>
>> Any links to documentation / tutorials very welcome. Thanks.
>>
>
> Hi,
>
> You need to include OpenCL library headers from libclc
> (http://libclc.llvm.org/) to compile most OpenCL code.
>
> Here is an example command:
>
> clang -include /path/to/libclc/headers/clc.h -I /path/to/libclc/headers  -Dcl_clang_storage_class_specifiers -target amdgcn--amdhsa -mcpu=carrizo  $INPUT_FILE -o $OUTPUT_FILE

Hi Tom,

to piggy-pack on this question. To load this kernel in OpenCL, is it sufficient to just pass $OUTPUT_FILE
to clCreateProgramWithBinary?

Also, assuming this is enough. Is the code quality for recent AMD GPUs quality-wise on the level of what AMD's closed-source driver would generate.

Thank you,
Tobias


More information about the llvm-dev mailing list