[Mesa-dev] [PATCH 3/3] clover: Query drivers for max clock frequency

Francisco Jerez currojerez at riseup.net
Fri Apr 18 08:16:47 PDT 2014


Bruno Jiménez <brunojimen at gmail.com> writes:

> From: Tom Stellard <thomas.stellard at amd.com>
>
> v2: PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY instead of
>     PIPE_COMPUTE_MAX_CLOCK_FREQUENCY
>
> Signed-off-by: Igor Gnatenko <i.gnatenko.brain at gmail.com>
>
> clover: Correct the returned value for max_clock_frequency
>
> According to OpenCL 1.1 spec, the returned value must be in MHz, and we
> were returning it in kHz
>
> v3: Now the conversion is done in patch 2.

The commit message looks kind of funny, but other than that the patch
looks good to me.

Reviewed-by: Francisco Jerez <currojerez at riseup.net>

> ---
>  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 7bc8d0a..f980845 100644
> --- a/src/gallium/state_trackers/clover/api/device.cpp
> +++ b/src/gallium/state_trackers/clover/api/device.cpp
> @@ -122,7 +122,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
>        break;
>  
>     case CL_DEVICE_MAX_CLOCK_FREQUENCY:
> -      buf.as_scalar<cl_uint>() = 0;
> +      buf.as_scalar<cl_uint>() = dev.max_clock_frequency();
>        break;
>  
>     case CL_DEVICE_ADDRESS_BITS:
> diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
> index 2c5f9b7..2f84677 100644
> --- a/src/gallium/state_trackers/clover/core/device.cpp
> +++ b/src/gallium/state_trackers/clover/core/device.cpp
> @@ -154,6 +154,12 @@ device::max_mem_alloc_size() const {
>                                        PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE)[0];
>  }
>  
> +cl_uint
> +device::max_clock_frequency() const {
> +   return get_compute_param<uint32_t>(pipe,
> +                                      PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY)[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 433ac81..3662c6b 100644
> --- a/src/gallium/state_trackers/clover/core/device.hpp
> +++ b/src/gallium/state_trackers/clover/core/device.hpp
> @@ -61,6 +61,7 @@ namespace clover {
>        cl_uint max_const_buffers() const;
>        size_t max_threads_per_block() const;
>        cl_ulong max_mem_alloc_size() const;
> +      cl_uint max_clock_frequency() const;
>  
>        std::vector<size_t> max_block_size() const;
>        std::string device_name() const;
> -- 
> 1.9.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/20140418/ab18f738/attachment.sig>


More information about the mesa-dev mailing list