[Mesa-dev] EXTERNAL: Re: OpenCL Clang/Clover Offline Compilation issue
Francisco Jerez
currojerez at riseup.net
Tue Jan 14 13:17:42 PST 2014
"Dorrington, Albert" <albert.dorrington at lmco.com> writes:
> Hi Tom and Francisco,
>
> When I tried to use Clang from the command line to produce binaries, all I could get was the LLVM IR code, so I adapted my test program to produce a binary using clGetProgramInfo().
> (I have been following code examples in book 'OpenCL Programming Guide')
>
> I have been stepping through the existing code in this area, using GDB, for the past few days, trying to get the binary to load successfully, and I have also stepped through the code behind clCreateProgramWithSource() - so I have started getting familiar with the process that is going on.
>
> I thought, if I generated the binary using clGetProgramInfo() after clBuildProgram() that the binary would be in the same format as would be needed.
>
> So far, I have run into two main issues.
> The first is, if there is only one kernel in the binary, it seems that clCreateProgramWithBinary() thinks there are two, due to (I think) an issue with the range() processing.
> In the debugger I see a second pair of binary/length fields in the result map, and when the 'return new program()' call is made at the end of clCreateProgramWithBinary() I get a SegFault after the first (only) binary is deserialized.
>
> So, I added a second kernel function to the CL program, and I am able to get through clCreateProgramWithBinary() without crashing, but quickly ran into a second issue.
>
> My code currently calls in the order:
> clCreateProgramWithBinary();
> clBuildProgram();
> clCreateKernel();
>
> The clCreateKernel() call fails with a -46/Invalid Kernel Name; stepping through the debugger, I believe I can see the two loaded kernels, however I cannot find the names in what was loaded.
>
> For now, I don't need Clang/LLVM to produce the binary without Mesa/Clover, I am fine with Mesa/Clover producing the binary.
>
Hi Albert, can you give the attached patch a try? It fixes a couple of
issues I've found in the clCreateProgramWithBinary path. Let me know if
it helps.
Thanks.
> Tom, from what you wrote below, it sounds like the clBuildProgram() implementation may only be expecting IR code and not a binary input?
>
> Since getting this to function is related to my current assignment at work, I do have a lot of time I can spend on this task.
>
> Thanks!
> -Al
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clover_program_from_binary_fixes.patch
Type: text/x-diff
Size: 4721 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140114/948fdd7c/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 229 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140114/948fdd7c/attachment.pgp>
More information about the mesa-dev
mailing list