From: Matt Arsenault <arse...@gmail.com> --- 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 1bc2692..dc8e22c 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 bc3e3e6..6d52dd4 100644 --- a/src/gallium/state_trackers/clover/core/device.cpp +++ b/src/gallium/state_trackers/clover/core/device.cpp @@ -163,6 +163,30 @@ device::max_clock_frequency() const { PIPE_COMPUTE_CAP_MAX_CLOCK_FREQUENCY)[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 3662c6b..380029e 100644 --- a/src/gallium/state_trackers/clover/core/device.hpp +++ b/src/gallium/state_trackers/clover/core/device.hpp @@ -62,6 +62,9 @@ namespace clover { size_t max_threads_per_block() const; cl_ulong max_mem_alloc_size() const; cl_uint max_clock_frequency() 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.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev