[Mesa-dev] [PATCH 3/5] clover: Report default values for half and double fp configs v2

Tom Stellard thomas.stellard at amd.com
Wed Jun 25 07:32:11 PDT 2014


From: Matt Arsenault <arsenm2 at gmail.com>

v2:
  -Fix indentation
---
 src/gallium/state_trackers/clover/api/device.cpp  | 11 +++++++++--
 src/gallium/state_trackers/clover/core/device.cpp | 24 +++++++++++++++++++++++
 src/gallium/state_trackers/clover/core/device.hpp |  3 +++
 3 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp
index 97b2cf9..7006702 100644
--- a/src/gallium/state_trackers/clover/api/device.cpp
+++ b/src/gallium/state_trackers/clover/api/device.cpp
@@ -201,8 +201,15 @@ 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_DOUBLE_FP_CONFIG:
+      buf.as_scalar<cl_device_fp_config>() = dev.double_fp_config();
+      break;
+
+   case CL_DEVICE_HALF_FP_CONFIG:
+      buf.as_scalar<cl_device_fp_config>() = dev.half_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 b6078db..bc6b761 100644
--- a/src/gallium/state_trackers/clover/core/device.cpp
+++ b/src/gallium/state_trackers/clover/core/device.cpp
@@ -169,6 +169,30 @@ device::max_compute_units() const {
                                       PIPE_COMPUTE_CAP_MAX_COMPUTE_UNITS)[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;
+}
+
+cl_device_fp_config
+device::double_fp_config() const {
+   // TODO: Get these from somewhere. This is the "mandated minimum double
+   // precision floating-point capability"
+   return CL_FP_FMA
+       | CL_FP_ROUND_TO_NEAREST
+       | CL_FP_ROUND_TO_ZERO
+       | CL_FP_ROUND_TO_INF
+       | CL_FP_INF_NAN
+       | CL_FP_DENORM;
+}
+
+cl_device_fp_config
+device::half_fp_config() const {
+   // TODO: Get these from somewhere.
+   return CL_FP_DENORM | CL_FP_INF_NAN | CL_FP_ROUND_TO_NEAREST;
+}
+
 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 731c31e..16831ab 100644
--- a/src/gallium/state_trackers/clover/core/device.hpp
+++ b/src/gallium/state_trackers/clover/core/device.hpp
@@ -63,6 +63,9 @@ namespace clover {
       cl_ulong max_mem_alloc_size() const;
       cl_uint max_clock_frequency() const;
       cl_uint max_compute_units() const;
+      cl_device_fp_config single_fp_config() const;
+      cl_device_fp_config double_fp_config() const;
+      cl_device_fp_config half_fp_config() const;
 
       std::vector<size_t> max_block_size() const;
       std::string device_name() const;
-- 
1.8.1.5



More information about the mesa-dev mailing list