Tom Stellard <t...@stellard.net> writes:

> From: Tom Stellard <thomas.stell...@amd.com>
>
> ---
>  src/gallium/state_trackers/clover/api/device.cpp  | 5 ++++-
>  src/gallium/state_trackers/clover/core/device.cpp | 6 ++++++
>  src/gallium/state_trackers/clover/core/device.hpp | 1 +
>  3 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/device.cpp 
> b/src/gallium/state_trackers/clover/api/device.cpp
> index 1a9127b..3093652 100644
> --- a/src/gallium/state_trackers/clover/api/device.cpp
> +++ b/src/gallium/state_trackers/clover/api/device.cpp
> @@ -126,7 +126,10 @@ clGetDeviceInfo(cl_device_id dev, cl_device_info param,
>                                        dev->max_images_write());
>  
>     case CL_DEVICE_MAX_MEM_ALLOC_SIZE:
> -      return scalar_property<cl_ulong>(buf, size, size_ret, 0);
> +      return scalar_property<cl_ulong>(buf, size, size_ret,
> +             std::max(std::max(dev->max_mem_alloc_size(),
> +                               dev->max_mem_global() / 4),
> +                      (cl_ulong)(128 * 1024 * 1024)));
>  
I think this is confusing, just return dev->max_mem_alloc_size() here.
Lying from the state tracker isn't going to fix the driver if it's
advertising less than the minimum allocation size required by the
standard...

Other than that, Reviewed-by: Francisco Jerez <curroje...@riseup.net>

>     case CL_DEVICE_IMAGE2D_MAX_WIDTH:
>     case CL_DEVICE_IMAGE2D_MAX_HEIGHT:
> diff --git a/src/gallium/state_trackers/clover/core/device.cpp 
> b/src/gallium/state_trackers/clover/core/device.cpp
> index 2ab735d..d93a1f6 100644
> --- a/src/gallium/state_trackers/clover/core/device.cpp
> +++ b/src/gallium/state_trackers/clover/core/device.cpp
> @@ -144,6 +144,12 @@ _cl_device_id::max_threads_per_block() const {
>        pipe, PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK)[0];
>  }
>  
> +cl_ulong
> +_cl_device_id::max_mem_alloc_size() const {
> +   return get_compute_param<uint64_t>(pipe,
> +                                      
> PIPE_COMPUTE_CAP_MAX_MEM_ALLOC_SIZE)[0];
> +}
> +
>  std::vector<size_t>
>  _cl_device_id::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 9408083..5b92751 100644
> --- a/src/gallium/state_trackers/clover/core/device.hpp
> +++ b/src/gallium/state_trackers/clover/core/device.hpp
> @@ -56,6 +56,7 @@ public:
>     cl_ulong max_const_buffer_size() const;
>     cl_uint max_const_buffers() const;
>     size_t max_threads_per_block() const;
> +   cl_ulong max_mem_alloc_size() const;
>  
>     std::vector<size_t> max_block_size() const;
>     std::string device_name() const;

Attachment: pgpe9G7adu1sB.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to