[Mesa-dev] [PATCH] clover: Handle NULL devs argument in clBuildProgram

Francisco Jerez currojerez at riseup.net
Thu Jun 28 15:18:15 PDT 2012


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?

> +   }
>     return CL_SUCCESS;
>  
>  } catch (error &e) {
-------------- 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/20120629/bb1c1ba9/attachment.pgp>


More information about the mesa-dev mailing list