[Mesa-dev] [PATCH] clover: fix clBuildProgram Piglit regression
Francisco Jerez
currojerez at riseup.net
Sun Nov 2 10:03:31 PST 2014
EdB <edb+mesa at sigluy.net> writes:
> should trigger CL_INVALID_VALUE
> if device_list is NULL and num_devices is greater than zero.
>
> introduced by e5468dfa523be2a7a0d04bb9efcf8ae780957563
Tom, can you just drop the the vector of devices parameter and validate
the d_devs/num_devs arguments from validate_build_program_common() by
calling objs<allow_empty_tag>, as I suggested when I gave my R-b for
your commit.
Thanks.
> ---
> src/gallium/state_trackers/clover/api/program.cpp | 20 +++++++++++---------
> 1 file changed, 11 insertions(+), 9 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp
> index 64c4a43..dc89730 100644
> --- a/src/gallium/state_trackers/clover/api/program.cpp
> +++ b/src/gallium/state_trackers/clover/api/program.cpp
> @@ -27,7 +27,7 @@ using namespace clover;
>
> namespace {
> void validate_build_program_common(const program &prog, cl_uint num_devs,
> - const ref_vector<device> &devs,
> + ref_vector<device> &devs,
> void (*pfn_notify)(cl_program, void *),
> void *user_data) {
>
> @@ -37,10 +37,14 @@ namespace {
> if (prog.kernel_ref_count())
> throw error(CL_INVALID_OPERATION);
>
> - if (any_of([&](const device &dev) {
> - return !count(dev, prog.context().devices());
> - }, devs))
> - throw error(CL_INVALID_DEVICE);
> + if (!num_devs) {
> + devs = prog.context().devices();
> + } else {
> + if (any_of([&](const device &dev) {
> + return !count(dev, prog.context().devices());
> + }, devs))
> + throw error(CL_INVALID_DEVICE);
> + }
> }
> }
>
> @@ -173,8 +177,7 @@ clBuildProgram(cl_program d_prog, cl_uint num_devs,
> void (*pfn_notify)(cl_program, void *),
> 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 devs = objs<allow_empty_tag>(d_devs, num_devs);
> auto opts = (p_opts ? p_opts : "");
>
> validate_build_program_common(prog, num_devs, devs, pfn_notify, user_data);
> @@ -195,8 +198,7 @@ clCompileProgram(cl_program d_prog, cl_uint num_devs,
> void (*pfn_notify)(cl_program, void *),
> 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 devs = objs<allow_empty_tag>(d_devs, num_devs);
> auto opts = (p_opts ? p_opts : "");
> header_map headers;
>
> --
> 1.9.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- 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/20141102/853ce50a/attachment.sig>
More information about the mesa-dev
mailing list