clover: Query and export int64 atomics
authorJan Vesely <jan.vesely@rutgers.edu>
Wed, 20 Sep 2017 20:06:10 +0000 (16:06 -0400)
committerJan Vesely <jan.vesely@rutgers.edu>
Wed, 27 Sep 2017 15:13:22 +0000 (11:13 -0400)
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
src/gallium/state_trackers/clover/api/device.cpp
src/gallium/state_trackers/clover/core/device.cpp
src/gallium/state_trackers/clover/core/device.hpp

index 26e88aadc73d6b7a3a9798317bcad7dfdfedbad8..3572bb0c921f83ee9411c290012988c3433fdb5d 100644 (file)
@@ -331,11 +331,13 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
 
    case CL_DEVICE_EXTENSIONS:
       buf.as_string() =
-         "cl_khr_global_int32_base_atomics"
+         "cl_khr_byte_addressable_store"
+         " cl_khr_global_int32_base_atomics"
          " cl_khr_global_int32_extended_atomics"
          " cl_khr_local_int32_base_atomics"
          " cl_khr_local_int32_extended_atomics"
-         " cl_khr_byte_addressable_store"
+         + std::string(dev.has_int64_atomics() ? " cl_khr_int64_base_atomics" : "")
+         + std::string(dev.has_int64_atomics() ? " cl_khr_int64_extended_atomics" : "")
          + std::string(dev.has_doubles() ? " cl_khr_fp64" : "")
          + std::string(dev.has_halves() ? " cl_khr_fp16" : "");
       break;
index c0ee0acaaf9ac6c73e5e6d9ea07df0f17577b816..9dd7eed3f178caca63e7f84930087213cc93a7e2 100644 (file)
@@ -196,6 +196,12 @@ device::has_halves() const {
                                  PIPE_SHADER_CAP_FP16);
 }
 
+bool
+device::has_int64_atomics() const {
+   return pipe->get_shader_param(pipe, PIPE_SHADER_COMPUTE,
+                                 PIPE_SHADER_CAP_INT64_ATOMICS);
+}
+
 bool
 device::has_unified_memory() const {
    return pipe->get_param(pipe, PIPE_CAP_UMA);
index c61be790a94232626143d310911474c26e26e657..85cd031676d4b5ce0d7557108a99f3f472e55bb2 100644 (file)
@@ -68,6 +68,7 @@ namespace clover {
       bool image_support() const;
       bool has_doubles() const;
       bool has_halves() const;
+      bool has_int64_atomics() const;
       bool has_unified_memory() const;
       cl_uint mem_base_addr_align() const;