[Mesa-dev] [PATCH 3/3 v4.1] clover: add clLinkProgramm (CL 1.2)
Francisco Jerez
currojerez at riseup.net
Sun Jul 26 04:09:52 PDT 2015
EdB <edb+mesa at sigluy.net> writes:
> ---
> src/gallium/state_trackers/clover/api/program.cpp | 33 +++++++++++++++++++++++
> 1 file changed, 33 insertions(+)
>
> diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp
> index 553bc83..086f952 100644
> --- a/src/gallium/state_trackers/clover/api/program.cpp
> +++ b/src/gallium/state_trackers/clover/api/program.cpp
> @@ -238,6 +238,39 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs,
> return e.get();
> }
>
> +CLOVER_API cl_program
> +clLinkProgram(cl_context d_ctx, cl_uint num_devs, const cl_device_id *d_devs,
> + const char *p_opts, cl_uint num_progs, const cl_program *d_progs,
> + void (*pfn_notify) (cl_program, void *), void *user_data,
> + cl_int *r_errcode) try {
> + auto &ctx = obj(d_ctx);
> + auto devs = (d_devs ? objs(d_devs, num_devs) :
> + ref_vector<device>(ctx.devices()));
> + auto opts = (p_opts ? p_opts : "");
> + auto progs = objs(d_progs, num_progs);
> +
> + if (!pfn_notify && user_data)
> + throw error(CL_INVALID_VALUE);
> +
> + if (any_of([&](const device &dev) {
> + return !count(dev, ctx.devices());
> + }, objs<allow_empty_tag>(d_devs, num_devs)))
> + throw error(CL_INVALID_DEVICE);
> +
> + auto prog = intrusive_ref<program>(*(new program(ctx, {}, {})));
Ah, of course, the empty initializers now made it impossible for the
compiler to deduce the correct argument types for create() -- You could
give it some help though like 'create<program>(ctx,
ref_vector<device>(), std::vector<module>())', or feel free to add
default "= {}" initializers to the last two constructor arguments so you
don't need to pass them at all.
> + try {
> + prog().link(devs, opts, progs);
> + ret_error(r_errcode, CL_SUCCESS);;
Double semicolon. With these fixed this patch is:
Reviewed-by: Francisco Jerez <currojerez at riseup.net>
> + } catch (link_error &e) {
> + ret_error(r_errcode, CL_LINK_PROGRAM_FAILURE);
> + }
> +
> + return ret_object(prog);
> +} catch (error &e) {
> + ret_error(r_errcode, e);
> + return NULL;
> +}
> +
> CLOVER_API cl_int
> clUnloadCompiler() {
> return CL_SUCCESS;
> --
> 2.5.0.rc2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150726/04b8f35a/attachment.sig>
More information about the mesa-dev
mailing list