diff options
author | Pierre Moreau <[email protected]> | 2018-01-27 18:12:16 +0100 |
---|---|---|
committer | Karol Herbst <[email protected]> | 2019-02-26 21:02:07 +0100 |
commit | bad161c8948649eabf29cfedb1cad4247c884616 (patch) | |
tree | 464d9895e02d0a0e700cb7f77abe3148ac459287 /src/gallium/state_trackers | |
parent | 25d4e65eb76cda86997cd9072787f7f3790a12c6 (diff) |
clover/api: Fail if trying to build a non-executable binary
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).
Reviewed-by: Aaron Watry <[email protected]>
Reviewed-by: Francisco Jerez <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/clover/api/program.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp index 891a002f3d0..ac8bc8a5630 100644 --- a/src/gallium/state_trackers/clover/api/program.cpp +++ b/src/gallium/state_trackers/clover/api/program.cpp @@ -186,6 +186,13 @@ 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; + }, devs)) { + // 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; |