Pierre Moreau <pierre.mor...@free.fr> writes:

> On 2018-01-23 — 14:03, Francisco Jerez wrote:
>> Pierre Moreau <pierre.mor...@free.fr> writes:
>> 
>> > From the OpenCL 1.2 Specification, Section 5.6.2 (about clBuildProgram:
>> >
>> >> If program is created with clCreateProgramWithBinary, then the
>> >> program binary must be an executable binary (not a compiled binary or
>> >> library).
>> >
>> > Signed-off-by: Pierre Moreau <pierre.mor...@free.fr>
>> > ---
>> >  src/gallium/state_trackers/clover/api/program.cpp | 8 ++++++++
>> >  1 file changed, 8 insertions(+)
>> >
>> > diff --git a/src/gallium/state_trackers/clover/api/program.cpp 
>> > b/src/gallium/state_trackers/clover/api/program.cpp
>> > index 9d59668f8f..6044179587 100644
>> > --- a/src/gallium/state_trackers/clover/api/program.cpp
>> > +++ b/src/gallium/state_trackers/clover/api/program.cpp
>> > @@ -186,6 +186,14 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs,
>> >     if (prog.has_source) {
>> >        prog.compile(devs, opts);
>> >        prog.link(devs, opts, { prog });
>> > +   } else if (any_of([&](const device &dev){
>> > +         return prog.build(dev).binary_type() != 
>> > CL_PROGRAM_BINARY_TYPE_EXECUTABLE;
>> > +         }, objs<allow_empty_tag>(d_devs, num_devs))) {
>> 
>> Shouldn't this be using the range of devices the application requested
>> to build for (which might be the whole set of devices associated with
>> prog if d_devs was null) instead of the objs expression?
>
> I had missed that part of the specification, when d_devs is null. I’ll fix the
> code, and reformat the specification extract as suggested further down.
>

I think this could just use the "devs" variable defined above, but from
the look of it the current definition probably has a bug, it should be
using prog.devices() instead of prog.context().devices() in cases where
d_devs is specified as NULL.

>> 
>> > +      // OpenCL 1.2 Specification, Section 5.6.2:
>> > +      // > If program is created with clCreateProgramWithBinary, then the
>> > +      // > program binary must be an executable binary (not a compiled 
>> > binary or
>> > +      // > library).
>> 
>> I'd format this like:
>> 
>> |      // According to the OpenCL 1.2 specification, "if program is created 
>> with
>> |      // clCreateProgramWithBinary, then the program binary must be an 
>> executable
>> |      // binary (not a compiled binary or library)."
>> 
>> > +      throw error(CL_INVALID_BINARY);
>> >     }
>> >  
>> >     return CL_SUCCESS;
>> > -- 
>> > 2.16.0

Attachment: signature.asc
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to