[Mesa-dev] [PATCH 1/2] clover: Report a default value for CL_DEVICE_SINGLE_FP_CONFIG

Francisco Jerez currojerez at riseup.net
Mon Mar 2 11:31:42 PST 2015


Tom Stellard <thomas.stellard at amd.com> writes:

> ---
>  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 +
>  3 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
> index e825468..e8750e8 100644
> --- a/src/gallium/state_trackers/clover/api/device.cpp
> +++ b/src/gallium/state_trackers/clover/api/device.cpp
> @@ -201,8 +201,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
>        break;
>  
>     case CL_DEVICE_SINGLE_FP_CONFIG:
> -      buf.as_scalar<cl_device_fp_config>() =
> -         CL_FP_DENORM | CL_FP_INF_NAN | CL_FP_ROUND_TO_NEAREST;
> +      buf.as_scalar<cl_device_fp_config>() = dev.single_fp_config();
>        break;
>  
>     case CL_DEVICE_GLOBAL_MEM_CACHE_TYPE:
> diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
> index 688a7dd..34f0372 100644
> --- a/src/gallium/state_trackers/clover/core/device.cpp
> +++ b/src/gallium/state_trackers/clover/core/device.cpp
> @@ -173,6 +173,12 @@ device::image_support() const {
>                                        PIPE_COMPUTE_CAP_IMAGES_SUPPORTED)[0];
>  }
>  
> +cl_device_fp_config
> +device::single_fp_config() const {
> +   // TODO: Get these from somewhere.
> +   return CL_FP_DENORM | CL_FP_INF_NAN | CL_FP_ROUND_TO_NEAREST;
> +}
> +

I don't think there's any benefit right now from defining a method just
so you can return the same constant?  In the CL_DEVICE_DOUBLE_FP_CONFIG
case too you could just:

|     case CL_DEVICE_DOUBLE_FP_CONFIG:
|       if (dev.has_doubles())
|             buf.as_scalar<cl_device_fp_config>() = ...;
|       else
|             buf.as_scalar<cl_device_fp_config>() = 0;
|       break;

Kind of like you're doing already for the other device params.  It
doesn't seem very likely that we will need to query those from the
device because the minimum supported double-precision fp config is
pretty much everything if the implementation supports doubles at all...

>  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 2201700..6d3c2c3 100644
> --- a/src/gallium/state_trackers/clover/core/device.hpp
> +++ b/src/gallium/state_trackers/clover/core/device.hpp
> @@ -64,6 +64,7 @@ namespace clover {
>        cl_uint max_clock_frequency() const;
>        cl_uint max_compute_units() const;
>        bool image_support() const;
> +      cl_device_fp_config single_fp_config() const;
>  
>        std::vector<size_t> max_block_size() const;
>        std::string device_name() const;
> -- 
> 2.0.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150302/df5231b4/attachment.sig>


More information about the mesa-dev mailing list