[Mesa-dev] [PATCH] clover: Handle NULL devs argument in clBuildProgram
Francisco Jerez
currojerez at riseup.net
Sun Jul 1 06:49:26 PDT 2012
Tom Stellard <thomas.stellard at amd.com> writes:
> On Fri, Jun 29, 2012 at 12:18:15AM +0200, Francisco Jerez wrote:
>> Tom Stellard <tstellar at gmail.com> writes:
>>
>> > If devs is NULL, then the kernel should be compiled for all devices
>> > associated with the program's context.
>> > ---
>> > src/gallium/state_trackers/clover/api/program.cpp | 16 ++++++++++------
>> > 1 files changed, 10 insertions(+), 6 deletions(-)
>> >
>> > diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp
>> > index e874c51..e863e00 100644
>> > --- a/src/gallium/state_trackers/clover/api/program.cpp
>> > +++ b/src/gallium/state_trackers/clover/api/program.cpp
>> > @@ -142,12 +142,16 @@ clBuildProgram(cl_program prog, cl_uint count, const cl_device_id *devs,
>> > (!pfn_notify && user_data))
>> > throw error(CL_INVALID_VALUE);
>> >
>> > - if (any_of([&](const cl_device_id dev) {
>> > - return !prog->ctx.has_device(dev);
>> > - }, devs, devs + count))
>> > - throw error(CL_INVALID_DEVICE);
>> > -
>> > - prog->build({ devs, devs + count });
>> > + if (devs) {
>> > + if (any_of([&](const cl_device_id dev) {
>> > + return !prog->ctx.has_device(dev);
>> > + }, devs, devs + count))
>> > + throw error(CL_INVALID_DEVICE);
>> > +
>> > + prog->build({ devs, devs + count });
>> > + } else {
>> > + prog->build({ prog->ctx.devs.begin(), prog->ctx.devs.end() });
>>
>> How about 'prog->build(prog->ctx.devs);'?
>>
>> The spec doesn't seem very clear on what should happen in that case, but
>> isn't this wrong for programs created with 'clCreateProgramWithBinary'
>> that are associated with a specific subset of devices from the program
>> context?
>>
>
> The way I read the spec is that clBuildProgram should 'build' the binaries
> as well. I guess depending on the binary format, this could either be
> a noop or maybe a conversion from one binary format to another. In any
> case, it seems like the program should know what to do when the build
> method is called.
>
OK, for now I've pushed this patch (with a minor style change) and the
fix for the event handling segfault you had seen.
Thanks.
-------------- 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/20120701/6d4f207c/attachment.pgp>
More information about the mesa-dev
mailing list