[Mesa-dev] [PATCH 5/5] clover: Enable cl_khr_fp64 for devices that support doubles
Bruno Jimenez
brunojimen at gmail.com
Tue Jun 17 15:11:31 PDT 2014
Hi,
I have a couple of questions about this patch:
1) Could you please also change how the results of the
'CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE' and
'CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE' queries are generated?
According to the spec, if 'cl_khr_fp64' is not supported, they should be
0.
2) When llvm is invoked for compiling a module, a macro definition is
added with:
'c.getPreprocessorOpts().addMacroDef("cl_khr_fp64");'
Is it ok to use this macro always or should it only be used when
'cl_khr_fp64' is supported?
Thanks!
Bruno
On Tue, 2014-06-17 at 09:44 -0700, Tom Stellard wrote:
> ---
> 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;
More information about the mesa-dev
mailing list