[Mesa-dev] [PATCH 3/5] clover: Report default values for half and double fp configs
Francisco Jerez
currojerez at riseup.net
Sat Jun 21 09:33:55 PDT 2014
Tom Stellard <thomas.stellard at amd.com> writes:
> From: Matt Arsenault <arsenm2 at 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
Weird indentation here, otherwise looks good to me.
> + | 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
-------------- 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/f881f2c3/attachment.sig>
More information about the mesa-dev
mailing list