[Mesa-dev] [PATCH 3/3] clover: query driver for the max number of compute units

Tom Stellard tom at stellard.net
Tue Jun 10 11:07:52 PDT 2014


On Fri, May 30, 2014 at 05:31:12PM +0200, Bruno Jiménez wrote:

Reviewed-by: Tom Stellard <thomas.stellard at amd.com>

> ---
>  src/gallium/state_trackers/clover/api/device.cpp  | 2 +-
>  src/gallium/state_trackers/clover/core/device.cpp | 6 ++++++
>  src/gallium/state_trackers/clover/core/device.hpp | 1 +
>  3 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
> index 1bc2692..97b2cf9 100644
> --- a/src/gallium/state_trackers/clover/api/device.cpp
> +++ b/src/gallium/state_trackers/clover/api/device.cpp
> @@ -109,7 +109,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
>        break;
>  
>     case CL_DEVICE_MAX_COMPUTE_UNITS:
> -      buf.as_scalar<cl_uint>() = 1;
> +      buf.as_scalar<cl_uint>() = dev.max_compute_units();
>        break;
>  
>     case CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS:
> diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
> index bc3e3e6..b6078db 100644
> --- a/src/gallium/state_trackers/clover/core/device.cpp
> +++ b/src/gallium/state_trackers/clover/core/device.cpp
> @@ -163,6 +163,12 @@ device::max_clock_frequency() const {
>                                        PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY)[0];
>  }
>  
> +cl_uint
> +device::max_compute_units() const {
> +   return get_compute_param<uint32_t>(pipe,
> +                                      PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS)[0];
> +}
> +
>  std::vector<size_t>
>  device::max_block_size() const {
>     auto v = get_compute_param<uint64_t>(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 3662c6b..731c31e 100644
> --- a/src/gallium/state_trackers/clover/core/device.hpp
> +++ b/src/gallium/state_trackers/clover/core/device.hpp
> @@ -62,6 +62,7 @@ namespace clover {
>        size_t max_threads_per_block() const;
>        cl_ulong max_mem_alloc_size() const;
>        cl_uint max_clock_frequency() const;
> +      cl_uint max_compute_units() const;
>  
>        std::vector<size_t> max_block_size() const;
>        std::string device_name() const;
> -- 
> 1.9.3
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list