[Mesa-dev] [PATCH 3/5] clover: Handle NULL value for clEnqueueNDRangeKernel local_work_size

Francisco Jerez currojerez at riseup.net
Mon Sep 24 09:40:37 PDT 2012


Tom Stellard <tom at stellard.net> writes:

> From: Tom Stellard <thomas.stellard at amd.com>
>
Thanks, I've pushed a slightly simplified version of this patch --
There's no need for opt_vector() to be a function template.

> ---
>  src/gallium/state_trackers/clover/api/kernel.cpp | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/kernel.cpp b/src/gallium/state_trackers/clover/api/kernel.cpp
> index ab4982d..6ef2b05 100644
> --- a/src/gallium/state_trackers/clover/api/kernel.cpp
> +++ b/src/gallium/state_trackers/clover/api/kernel.cpp
> @@ -261,11 +261,11 @@ namespace {
>  
>     template<typename T, typename S>
>     std::vector<T>
> -   opt_vector(const T *p, S n) {
> +   opt_vector(const T *p, S n, T default_value) {
>        if (p)
>           return { p, p + n };
>        else
> -         return { n };
> +         return { n, default_value };
>     }
>  }
>  
> @@ -275,9 +275,12 @@ clEnqueueNDRangeKernel(cl_command_queue q, cl_kernel kern,
>                         const size_t *pgrid_size, const size_t *pblock_size,
>                         cl_uint num_deps, const cl_event *deps,
>                         cl_event *ev) try {
> -   const std::vector<size_t> grid_offset = opt_vector(pgrid_offset, dims);
> -   const std::vector<size_t> grid_size = opt_vector(pgrid_size, dims);
> -   const std::vector<size_t> block_size = opt_vector(pblock_size, dims);
> +   const std::vector<size_t> grid_offset = opt_vector(pgrid_offset, dims,
> +                                                      (size_t)0);
> +   const std::vector<size_t> grid_size = opt_vector(pgrid_size, dims,
> +                                                    (size_t)1);
> +   const std::vector<size_t> block_size = opt_vector(pblock_size, dims,
> +                                                     (size_t)1);
>  
>     kernel_validate(q, kern, dims, pgrid_offset, pgrid_size, pblock_size,
>                     num_deps, deps, ev);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 229 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20120924/dd448f24/attachment.pgp>


More information about the mesa-dev mailing list