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(),
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;