[Mesa-dev] [PATCH v2 03/22] clover/api: Fail if trying to build a non-executable binary
Francisco Jerez
currojerez at riseup.net
Tue Jan 23 22:03:56 UTC 2018
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?
> + // 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180123/9f6436b2/attachment.sig>
More information about the mesa-dev
mailing list