[Mesa-dev] [PATCH] RFC clover: calculate maximum workgroup size based on device

Francisco Jerez currojerez at riseup.net
Thu Oct 24 22:35:05 CEST 2013


Aaron Watry <awatry at gmail.com> writes:

> The maximum workgroup size for a given kernel is based on the
> capabilities of the device that it's being run on. Previously,
> we were just returning the maximum value of a size_t which is
> obviously wrong.
>
> This patch uses the device's capabilities, but doesn't take into
> account any resource usage which would decrease the work group
> size further.  Suggestions/comments/fixes welcome.
> ---
>  src/gallium/state_trackers/clover/api/kernel.cpp | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/kernel.cpp b/src/gallium/state_trackers/clover/api/kernel.cpp
> index d6129e6..90bb213 100644
> --- a/src/gallium/state_trackers/clover/api/kernel.cpp
> +++ b/src/gallium/state_trackers/clover/api/kernel.cpp
> @@ -156,7 +156,11 @@ clGetKernelWorkGroupInfo(cl_kernel d_kern, cl_device_id d_dev,
>  
>     switch (param) {
>     case CL_KERNEL_WORK_GROUP_SIZE:
> -      buf.as_scalar<size_t>() = kern.max_block_size();
> +      //FIXME: This should be maximum that the requested device can support for
> +      //       this kernel, not the maximum value of a size_t... and just using
> +      //       dev->max_threads_per_block doesn't take into account the kernel's
> +      //       resource usage...
> +      buf.as_scalar<size_t>() = pdev->max_threads_per_block();
>        break;
>  
This doesn't work when pdev is NULL.  And I think we could drop the
FIXME comment and the kernel::max_block_size() method altogether.  It
seems unlikely to me that any hardware back-end will ever need the
per-kernel setting, and the Gallium API doesn't support it.

I've pushed a different fix [1] based on your patch that takes care of
that.

Thank you.

[1] http://cgit.freedesktop.org/mesa/mesa/commit/?id=7463abd37d65abd4d87abe314e0629c853dd9bca

>     case CL_KERNEL_COMPILE_WORK_GROUP_SIZE:
> -- 
> 1.8.3.2
>
> _______________________________________________
> 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: 229 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131024/27c0be24/attachment.pgp>


More information about the mesa-dev mailing list