diff --git a/src/gallium/state_trackers/clover/api/device.cpp b/src/gallium/state_trackers/clover/api/device.cpp index b1b7917e4ec..b202102389f 100644 --- a/src/gallium/state_trackers/clover/api/device.cpp +++ b/src/gallium/state_trackers/clover/api/device.cpp @@ -205,7 +205,8 @@ clGetDeviceInfo(cl_device_id d_dev, cl_device_info param, break; case CL_DEVICE_MEM_BASE_ADDR_ALIGN: - buf.as_scalar() = 128 * 8; + buf.as_scalar() = 8 * + std::max(dev.mem_base_addr_align(), (cl_uint) sizeof(cl_long) * 16); break; case CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE: diff --git a/src/gallium/state_trackers/clover/core/device.cpp b/src/gallium/state_trackers/clover/core/device.cpp index f6bbc38a980..fc74bd51a9e 100644 --- a/src/gallium/state_trackers/clover/core/device.cpp +++ b/src/gallium/state_trackers/clover/core/device.cpp @@ -20,6 +20,7 @@ // OTHER DEALINGS IN THE SOFTWARE. // +#include #include "core/device.hpp" #include "core/platform.hpp" #include "pipe/p_screen.h" @@ -194,6 +195,11 @@ device::has_unified_memory() const { return pipe->get_param(pipe, PIPE_CAP_UMA); } +cl_uint +device::mem_base_addr_align() const { + return sysconf(_SC_PAGESIZE); +} + std::vector device::max_block_size() const { auto v = get_compute_param(pipe, ir_format(), diff --git a/src/gallium/state_trackers/clover/core/device.hpp b/src/gallium/state_trackers/clover/core/device.hpp index efc217aedb0..4e11519421a 100644 --- a/src/gallium/state_trackers/clover/core/device.hpp +++ b/src/gallium/state_trackers/clover/core/device.hpp @@ -68,6 +68,7 @@ namespace clover { bool image_support() const; bool has_doubles() const; bool has_unified_memory() const; + cl_uint mem_base_addr_align() const; std::vector max_block_size() const; cl_uint subgroup_size() const;