[Mesa-dev] [PATCH 5/5] clover: Enable cl_khr_fp64 for devices that support doubles

Francisco Jerez currojerez at riseup.net
Sat Jun 21 09:37:24 PDT 2014


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

> ---
>  src/gallium/state_trackers/clover/api/device.cpp  | 4 +++-
>  src/gallium/state_trackers/clover/core/device.cpp | 6 ++++++
>  src/gallium/state_trackers/clover/core/device.hpp | 1 +
>  3 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
> index dc8e22c..275542d 100644
> --- a/src/gallium/state_trackers/clover/api/device.cpp
> +++ b/src/gallium/state_trackers/clover/api/device.cpp
> @@ -290,7 +290,9 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
>        break;
>  
>     case CL_DEVICE_EXTENSIONS:
> -      buf.as_string() = "";
> +      // The trailing space is intentional. It is a spec-ism that there is a
> +      // trailing space at the end of the list of extensions.

Hm...  Really?  Where does the spec say that?

> +      buf.as_string() = dev.cl_khr_fp64() ? "cl_khr_fp64 " : "";
>        break;
>  
>     case CL_DEVICE_PLATFORM:
> diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp
> index 6d52dd4..51b54fa 100644
> --- a/src/gallium/state_trackers/clover/core/device.cpp
> +++ b/src/gallium/state_trackers/clover/core/device.cpp
> @@ -187,6 +187,12 @@ device::half_fp_config() const {
>     return CL_FP_DENORM | CL_FP_INF_NAN | CL_FP_ROUND_TO_NEAREST;
>  }
>  
> +bool
> +device::cl_khr_fp64() const {
> +   return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE,
> +                                 PIPE_SHADER_CAP_DOUBLES);
> +}
> +

Can we call this function "has_doubles()" or something similar?  The
extension name is somewhat cryptic.  Or, I don't know, maybe use
'device::double_fp_config()' to check if doubles are supported?  As
Bruno said, it should return 0 if doubles are not supported by the
implementation.

>  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 380029e..38bea54 100644
> --- a/src/gallium/state_trackers/clover/core/device.hpp
> +++ b/src/gallium/state_trackers/clover/core/device.hpp
> @@ -65,6 +65,7 @@ namespace clover {
>        cl_device_fp_config single_fp_config() const;
>        cl_device_fp_config double_fp_config() const;
>        cl_device_fp_config half_fp_config() const;
> +      bool cl_khr_fp64() const;
>  
>        std::vector<size_t> max_block_size() const;
>        std::string device_name() const;
> -- 
> 1.8.1.4
-------------- 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/20140621/fc8dcf64/attachment.sig>


More information about the mesa-dev mailing list