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

Tom Stellard thomas.stellard at amd.com
Fri Jun 29 11:33:05 PDT 2012


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.

-Tom

> > +   }
> >     return CL_SUCCESS;
> >  
> >  } catch (error &e) {




> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev




More information about the mesa-dev mailing list