[Mesa-dev] [PATCH v2 03/22] clover/api: Fail if trying to build a non-executable binary
Pierre Moreau
pierre.morrow at free.fr
Tue Jan 23 23:15:02 UTC 2018
On 2018-01-23 — 14:03, Francisco Jerez wrote:
> Pierre Moreau <pierre.morrow at 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.morrow at 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.
>
> > + // 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
More information about the mesa-dev
mailing list