[Mesa-dev] [PATCH 5/5] clover: Enable cl_khr_fp64 for devices that support doubles
Tom Stellard
thomas.stellard at amd.com
Tue Jun 17 09:44:46 PDT 2014
---
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.
+ 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);
+}
+
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
More information about the mesa-dev
mailing list