Add alignment check to CL_DEVICE_MEM_BASE_ADDR_ALIGN for compressed buffers

Change-Id: I44fa231411a754fb24398a4a9727ca16f257220e
Signed-off-by: Kamil Diedrich <kamil.diedrich@intel.com>
This commit is contained in:
Kamil Diedrich
2019-04-02 09:42:03 +02:00
committed by sys_ocldev
parent e9a35fbf88
commit cefa3e3119
3 changed files with 22 additions and 4 deletions

View File

@@ -61,12 +61,17 @@ bool Buffer::isSubBuffer() {
}
bool Buffer::isValidSubBufferOffset(size_t offset) {
for (size_t i = 0; i < context->getNumDevices(); ++i) {
cl_uint address_align = 32; // 4 byte alignment
if ((offset & (address_align / 8 - 1)) == 0) {
return true;
if (this->getGraphicsAllocation()->getAllocationType() == GraphicsAllocation::AllocationType::BUFFER_COMPRESSED) {
// From spec: "origin value is aligned to the CL_DEVICE_MEM_BASE_ADDR_ALIGN value"
if (!isAligned(offset, this->getContext()->getDevice(0)->getDeviceInfo().memBaseAddressAlign)) {
return false;
}
}
cl_uint address_align = 32; // 4 byte alignment
if ((offset & (address_align / 8 - 1)) == 0) {
return true;
}
return false;
}