diff options
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r-- | src/gallium/state_trackers/clover/api/device.cpp | 4 | ||||
-rw-r--r-- | src/gallium/state_trackers/clover/core/device.cpp | 23 | ||||
-rw-r--r-- | src/gallium/state_trackers/clover/core/device.hpp | 1 |
3 files changed, 28 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp index ca6b90ba271..d1c37b96aeb 100644 --- a/src/gallium/state_trackers/clover/api/device.cpp +++ b/src/gallium/state_trackers/clover/api/device.cpp @@ -405,6 +405,10 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param, buf.as_scalar<cl_uint>() = 1; break; + case CL_DEVICE_SVM_CAPABILITIES: + buf.as_scalar<cl_device_svm_capabilities>() = dev.svm_support(); + break; + default: throw error(CL_INVALID_VALUE); } diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp index 298cde278b4..e05dc562189 100644 --- a/src/gallium/state_trackers/clover/core/device.cpp +++ b/src/gallium/state_trackers/clover/core/device.cpp @@ -220,6 +220,29 @@ device::mem_base_addr_align() const { return sysconf(_SC_PAGESIZE); } +cl_device_svm_capabilities +device::svm_support() const { + // Without CAP_RESOURCE_FROM_USER_MEMORY SVM and CL_MEM_USE_HOST_PTR + // interactions won't work according to spec as clover manages a GPU side + // copy of the host data. + // + // The biggest problem are memory buffers created with CL_MEM_USE_HOST_PTR, + // but the application and/or the kernel updates the memory via SVM and not + // the cl_mem buffer. + // We can't even do proper tracking on what memory might have been accessed + // as the host ptr to the buffer could be within a SVM region, where through + // the CL API there is no reliable way of knowing if a certain cl_mem buffer + // was accessed by a kernel or not and the runtime can't reliably know from + // which side the GPU buffer content needs to be updated. + // + // Another unsolvable scenario is a cl_mem object passed by cl_mem reference + // and SVM pointer into the same kernel at the same time. + if (pipe->get_param(pipe, PIPE_CAP_RESOURCE_FROM_USER_MEMORY) && + pipe->get_param(pipe, PIPE_CAP_SYSTEM_SVM)) + return CL_DEVICE_SVM_FINE_GRAIN_SYSTEM; + return 0; +} + std::vector<size_t> device::max_block_size() const { auto v = get_compute_param<uint64_t>(pipe, ir_format(), diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp index 828dfaa65e6..dc9064bb638 100644 --- a/src/gallium/state_trackers/clover/core/device.hpp +++ b/src/gallium/state_trackers/clover/core/device.hpp @@ -71,6 +71,7 @@ namespace clover { bool has_int64_atomics() const; bool has_unified_memory() const; cl_uint mem_base_addr_align() const; + cl_device_svm_capabilities svm_support() const; std::vector<size_t> max_block_size() const; cl_uint subgroup_size() const; |