clover/device: Get device/host unified memory from pipe driver
authorAaron Watry <awatry@gmail.com>
Sat, 3 Jun 2017 02:51:43 +0000 (21:51 -0500)
committerAaron Watry <awatry@gmail.com>
Wed, 14 Jun 2017 02:26:09 +0000 (21:26 -0500)
clinfo no longer reports my discrete GCN card as unified memory

Signed-off-by: Aaron Watry <awatry@gmail.com>
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 a80ca46654fe93042823fd4e22624fb5c24f66d6..0b33350bb2efe49fbe131243478c4d93e06b79ae 100644 (file)
@@ -336,7 +336,7 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param,
       break;
 
    case CL_DEVICE_HOST_UNIFIED_MEMORY:
-      buf.as_scalar<cl_bool>() = CL_TRUE;
+      buf.as_scalar<cl_bool>() = dev.has_unified_memory();
       break;
 
    case CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR:
index 158c9aa696499edf16a5b32deba3de3d8c3b906a..8dfba1ad9fd9882b7c28d7cf021d519ffd34633b 100644 (file)
@@ -189,6 +189,11 @@ device::has_doubles() const {
    return pipe->get_param(pipe, PIPE_CAP_DOUBLES);
 }
 
+bool
+device::has_unified_memory() const {
+   return pipe->get_param(pipe, PIPE_CAP_UMA);
+}
+
 std::vector<size_t>
 device::max_block_size() const {
    auto v = get_compute_param<uint64_t>(pipe, ir_format(),
index 94a61d10500d7fdab94ec72517012c286c2e56fd..7b3353df345d8888c395559bd6879d417a9d7b32 100644 (file)
@@ -67,6 +67,7 @@ namespace clover {
       cl_uint max_compute_units() const;
       bool image_support() const;
       bool has_doubles() const;
+      bool has_unified_memory() const;
 
       std::vector<size_t> max_block_size() const;
       cl_uint subgroup_size() const;