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

Aaron Watry awatry at gmail.com
Thu Oct 24 01:41:56 CEST 2013


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;
 
    case CL_KERNEL_COMPILE_WORK_GROUP_SIZE:
-- 
1.8.3.2



More information about the mesa-dev mailing list