[Mesa-dev] EXTERNAL: Re: OpenCL Clang/Clover Offline Compilation issue

Dorrington, Albert albert.dorrington at lmco.com
Mon Jan 13 10:44:15 PST 2014


Tom,

Thanks for your response. I am very interested in implementing this, so any pointers you can provide would be greatly appreciated.
I don't have access to IRC at work (at least I doubt I do) due to firewalls - but I can use the mailing list.

I wasn't entirely sure about the proper clang command line, so I wrote another program which does the online compile, then saves the output away.
I think I can produce an appropriate binary now.

I am currently using a Radeon 6670; so I assume it will be: -mcpu=turks

It looks like the LLVM output from clang is identical with either -mcpu=turks or -mcpu=r600.
I can't seem to make clang output a binary file. (I figure I'm not using clang correctly)
Since I can capture the binary with another C program (I think) I'm not too worried about using clang/llvm directly yet.

Thanks!
-Al
 
-----Original Message-----
From: Tom Stellard [mailto:tom at stellard.net] 
Sent: Monday, January 13, 2014 1:12 PM
To: Dorrington, Albert
Cc: mesa-dev at lists.freedesktop.org
Subject: EXTERNAL: Re: [Mesa-dev] OpenCL Clang/Clover Offline Compilation issue

On Thu, Jan 09, 2014 at 12:49:51PM +0000, Dorrington, Albert wrote:
> I am not sure if this is the appropriate list on which to ask this question, if not hopefully someone can suggest an alternative.
> 
> Under Linux, I am attempting to perform an offline compile of an OpenCL kernel example using Clang, and then load that binary using the clCreateProgramWithBinary() function.
> 
> Unfortunately, while clover is loading the binary, I end up getting a segmentation fault:
> 
> Program received signal SIGSEGV, Segmentation fault.
> proc (v=..., is=...) at core/module.cpp:50
> 50            T x;
> 
> I have pasted the source code I am using below, for both the kernel and the host code.
> 
> I am compiling with the following commands:
> clang -target r600-unknown-unknown -x cl -S -emit-llvm -mcpu=r600 
> kernel.cl -o kernel.clbin

I'm surprised that this works, since the r600 GPU does not support OpenCL (Note that R600 is the name of the target and also one of the individual GPUs supported by the compiler).  The  argument of -mcpu= needs to be GPU you are compiling the code for.  So if you have a redwood GPU you would need to pass -mcpu=redwood.

However, the main issue here is that clover does not support
clCreateProgramWithBinary() yet.  If you are interested in implementing this, I can give you some pointers.  Just send an email to the list or ping me on irc (nick: tstellar on #radeon @ irc.freednode.net).

-Tom

> clang -g -L/usr/local/lib -lOpenCL offline_host.c -o offline_host
> 
> I have LLVM/Clang 3.4RC3 installed and Mesa 10.0.1.
> 
> If anyone has suggestions, or can point me to the appropriate mailing list or documentation,  I'd appreciate it.
> 
> Thanks!
> -Al



More information about the mesa-dev mailing list