[Mesa-dev] [PATCH 5/5] clover: Enable cl_khr_fp64 for devices that support doubles

Matt Arsenault arsenm2 at gmail.com
Sat Jun 21 12:09:01 PDT 2014


On Jun 21, 2014, at 9:37 AM, Francisco Jerez <currojerez at riseup.net> wrote:

> Tom Stellard <thomas.stellard at amd.com> writes:
> 
>> ---
>> 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.
> 
> Hm...  Really?  Where does the spec say that?
> 

I’m not really sure. I remember reporting a bug before about a trailing space in these outputs, and got the response that it is required by the spec, but never really finding where. I know it’s required for the versions (which also currently fails the conformance test with “A space must appear after the minor version! (returned: OpenCL C 1.1)”


>> +      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);
>> +}
>> +
> 
> Can we call this function "has_doubles()" or something similar?  The
> extension name is somewhat cryptic.  Or, I don't know, maybe use
> 'device::double_fp_config()' to check if doubles are supported?  As
> Bruno said, it should return 0 if doubles are not supported by the
> implementation.

The extension is also “removed” in 1.2 and doubles become an “optional core extension” whatever that means, and is just required to be reported anyway for compatibility.

> 
>> 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
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140621/e1c40961/attachment.html>


More information about the mesa-dev mailing list