From 5c9bccc97e9fb0776f2ca5bb57e55116a7efb43b Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 12 May 2012 19:32:46 +0200 Subject: [PATCH] clover, gallium: add PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK This is not necessarily the product of MAX_BLOCK_SIZE[i]. Reviewed-by: Tom Stellard Reviewed-by: Francisco Jerez --- src/gallium/docs/source/screen.rst | 5 +++++ src/gallium/include/pipe/p_defines.h | 1 + src/gallium/state_trackers/clover/api/device.cpp | 3 ++- src/gallium/state_trackers/clover/core/device.cpp | 6 ++++++ src/gallium/state_trackers/clover/core/device.hpp | 1 + 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index ff63ce83bea..2bddf1bbb3b 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -212,6 +212,11 @@ pipe_screen::get_compute_param. units. Value type: ``uint64_t []``. * ``PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE``: Maximum block size in thread units. Value type: ``uint64_t []``. +* ``PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK``: Maximum number of threads that + a single block can contain. Value type: ``uint64_t``. + This may be less than the product of the components of MAX_BLOCK_SIZE and is + usually limited by the number of threads that can be resident simultaneously + on a compute unit. * ``PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE``: Maximum size of the GLOBAL resource. Value type: ``uint64_t``. * ``PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE``: Maximum size of the LOCAL diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 1e05cc4caee..ad7f24ef39b 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -548,6 +548,7 @@ enum pipe_compute_cap PIPE_COMPUTE_CAP_GRID_DIMENSION, PIPE_COMPUTE_CAP_MAX_GRID_SIZE, PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE, + PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK, PIPE_COMPUTE_CAP_MAX_GLOBAL_SIZE, PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE, PIPE_COMPUTE_CAP_MAX_PRIVATE_SIZE, diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp index 03767519aaf..1a9127bb3d5 100644 --- a/src/gallium/state_trackers/clover/api/device.cpp +++ b/src/gallium/state_trackers/clover/api/device.cpp @@ -87,7 +87,8 @@ clGetDeviceInfo(cl_device_id dev, cl_device_info param, dev->max_block_size()); case CL_DEVICE_MAX_WORK_GROUP_SIZE: - return scalar_property(buf, size, size_ret, SIZE_MAX); + return scalar_property(buf, size, size_ret, + dev->max_threads_per_block()); case CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR: return scalar_property(buf, size, size_ret, 16); diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp index 8390f3f4abb..59e43af075d 100644 --- a/src/gallium/state_trackers/clover/core/device.cpp +++ b/src/gallium/state_trackers/clover/core/device.cpp @@ -138,6 +138,12 @@ _cl_device_id::max_const_buffers() const { PIPE_SHADER_CAP_MAX_CONST_BUFFERS); } +size_t +_cl_device_id::max_threads_per_block() const { + return get_compute_param( + pipe, PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK)[0]; +} + std::vector _cl_device_id::max_block_size() const { return get_compute_param(pipe, PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE); diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp index 8f284ba5e42..d10635275b1 100644 --- a/src/gallium/state_trackers/clover/core/device.hpp +++ b/src/gallium/state_trackers/clover/core/device.hpp @@ -55,6 +55,7 @@ public: cl_ulong max_mem_input() const; cl_ulong max_const_buffer_size() const; cl_uint max_const_buffers() const; + size_t max_threads_per_block() const; std::vector max_block_size() const; std::string device_name() const; -- 2.30.2