[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 00:33:45 UTC 2018
>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))) {
+ // 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).
+ throw error(CL_INVALID_BINARY);
}
return CL_SUCCESS;
--
2.16.0
More information about the mesa-dev
mailing list