[Mesa-dev] [PATCH 2/2] clover: Fix bug when binary programs are passed to clBuildProgram()
Francisco Jerez
currojerez at riseup.net
Thu Oct 23 02:47:17 PDT 2014
Tom Stellard <thomas.stellard at amd.com> writes:
> This was a regression introduced by
> 611d66fe4513e53bde052dd2bab95d448c909a2a
>
> Passing a binary program to clBuildProgram() is legal, but passing one
> to clCompileProgram() is not.
> ---
> src/gallium/state_trackers/clover/api/program.cpp | 21 ++++++++++++++++-----
> 1 file changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp
> index bf32543..3ea9fe3 100644
> --- a/src/gallium/state_trackers/clover/api/program.cpp
> +++ b/src/gallium/state_trackers/clover/api/program.cpp
> @@ -173,12 +173,23 @@ CLOVER_API cl_int
> clBuildProgram(cl_program d_prog, cl_uint num_devs,
> const cl_device_id *d_devs, const char *p_opts,
> void (*pfn_notify)(cl_program, void *),
> - void *user_data) {
> - cl_int ret = clCompileProgram(d_prog, num_devs, d_devs, p_opts,
> - 0, NULL, NULL, pfn_notify, user_data);
> + void *user_data) try {
> + auto &prog = obj(d_prog);
> + auto devs = (d_devs ? objs(d_devs, num_devs) :
> + ref_vector<device>(prog.context().devices()));
> + auto opts = (p_opts ? p_opts : "");
> + header_map headers;
> +
> + validate_build_program_common(num_devs, d_devs, (void*)pfn_notify,
> + user_data, prog, devs);
>
> - return (ret == CL_COMPILE_PROGRAM_FAILURE ?
> - CL_BUILD_PROGRAM_FAILURE : ret);
> + // FIXME: We should overload this function so we don't need to pass headers.
Just pass an empty initializer list to avoid having to declare an empty
header map, like 'prog.build(devs, opts, {});', or if you find this very
annoying add a default initializer 'headers = {}' to the prototype of
program::build() -- no need to define an overload.
With that fixed:
Reviewed-by: Francisco Jerez <currojerez at riseup.net>
> + prog.build(devs, opts, headers);
> + return CL_SUCCESS;
> +} catch (error &e) {
> + if (e.get() == CL_COMPILE_PROGRAM_FAILURE)
> + return CL_BUILD_PROGRAM_FAILURE;
> + return e.get();
> }
>
> CLOVER_API cl_int
> --
> 1.8.5.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20141023/7d93c73e/attachment.sig>
More information about the mesa-dev
mailing list