[Mesa-dev] [PATCH v2 2/2] clover: add missing clGetDeviceInfo CL1.2 queries

Francisco Jerez currojerez at riseup.net
Sun Oct 30 21:34:56 UTC 2016


Serge Martin <edb+mesa at sigluy.net> writes:

> ---
>  src/gallium/state_trackers/clover/api/device.cpp  | 23 +++++++++++++++++++++++
>  src/gallium/state_trackers/clover/core/device.cpp | 10 ++++++++++
>  src/gallium/state_trackers/clover/core/device.hpp |  2 ++
>  3 files changed, 35 insertions(+)
>
> diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
> index f7bd61b..a80ca46 100644
> --- a/src/gallium/state_trackers/clover/api/device.cpp
> +++ b/src/gallium/state_trackers/clover/api/device.cpp
> @@ -184,6 +184,14 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
>        buf.as_scalar<size_t>() = 1 << dev.max_image_levels_3d();
>        break;
>  
> +   case CL_DEVICE_IMAGE_MAX_BUFFER_SIZE:
> +      buf.as_scalar<size_t>() = dev.max_image_buffer_size();
> +      break;
> +
> +   case CL_DEVICE_IMAGE_MAX_ARRAY_SIZE:
> +      buf.as_scalar<size_t>() = dev.max_image_array_number();
> +      break;
> +
>     case CL_DEVICE_IMAGE_SUPPORT:
>        buf.as_scalar<cl_bool>() = dev.image_support();
>        break;
> @@ -273,6 +281,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
>  
>     case CL_DEVICE_AVAILABLE:
>     case CL_DEVICE_COMPILER_AVAILABLE:
> +   case CL_DEVICE_LINKER_AVAILABLE:
>        buf.as_scalar<cl_bool>() = CL_TRUE;
>        break;
>  
> @@ -284,6 +293,10 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
>        buf.as_scalar<cl_command_queue_properties>() = CL_QUEUE_PROFILING_ENABLE;
>        break;
>  
> +   case CL_DEVICE_BUILT_IN_KERNELS:
> +      buf.as_string() = "";
> +      break;
> +
>     case CL_DEVICE_NAME:
>        buf.as_string() = dev.device_name();
>        break;
> @@ -358,6 +371,16 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
>        buf.as_string() = "OpenCL C 1.1 ";
>        break;
>  
> +   case CL_DEVICE_PRINTF_BUFFER_SIZE:
> +      // Per the spec, the minimum value for the FULL profile is 1 MB.
> +      // However, clover is not ready yet to support it
> +      buf.as_scalar<size_t>() = 0 /* 1024 */;
> +      break;
> +

AFAIUI /dev/null is a valid implementation of the printf built-in as far
as the CL spec is concerned, so I'd go ahead and report 1 MB of buffer
space already as the spec requires.  It's up to you, either way patch
is:

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

> +   case CL_DEVICE_PREFERRED_INTEROP_USER_SYNC:
> +      buf.as_scalar<cl_bool>() = CL_TRUE;
> +      break;
> +
>     case CL_DEVICE_PARENT_DEVICE:
>        buf.as_scalar<cl_device_id>() = NULL;
>        break;
> diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
> index 8825f99..8f1c1da 100644
> --- a/src/gallium/state_trackers/clover/core/device.cpp
> +++ b/src/gallium/state_trackers/clover/core/device.cpp
> @@ -98,6 +98,11 @@ device::max_images_write() const {
>     return PIPE_MAX_SHADER_IMAGES;
>  }
>  
> +size_t
> +device::max_image_buffer_size() const {
> +   return pipe->get_param(pipe, PIPE_CAP_MAX_TEXTURE_BUFFER_SIZE);
> +}
> +
>  cl_uint
>  device::max_image_levels_2d() const {
>     return pipe->get_param(pipe, PIPE_CAP_MAX_TEXTURE_2D_LEVELS);
> @@ -108,6 +113,11 @@ device::max_image_levels_3d() const {
>     return pipe->get_param(pipe, PIPE_CAP_MAX_TEXTURE_3D_LEVELS);
>  }
>  
> +size_t
> +device::max_image_array_number() const {
> +   return pipe->get_param(pipe, PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS);
> +}
> +
>  cl_uint
>  device::max_samplers() const {
>     return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE,
> diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp
> index 6cf6c7f..94a61d1 100644
> --- a/src/gallium/state_trackers/clover/core/device.hpp
> +++ b/src/gallium/state_trackers/clover/core/device.hpp
> @@ -51,8 +51,10 @@ namespace clover {
>        cl_uint vendor_id() const;
>        size_t max_images_read() const;
>        size_t max_images_write() const;
> +      size_t max_image_buffer_size() const;
>        cl_uint max_image_levels_2d() const;
>        cl_uint max_image_levels_3d() const;
> +      size_t max_image_array_number() const;
>        cl_uint max_samplers() const;
>        cl_ulong max_mem_global() const;
>        cl_ulong max_mem_local() const;
> -- 
> 2.5.5
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161030/36b96876/attachment-0001.sig>


More information about the mesa-dev mailing list