change alignment from bits to bytes

Related-To: NEO-2380

Change-Id: I5698bd2043531fb34c4647000833b0558ff8dba7
Signed-off-by: Kamil Diedrich <kamil.diedrich@intel.com>
This commit is contained in:
Kamil Diedrich 2019-04-03 14:11:31 +02:00 committed by sys_ocldev
parent 4e3f0e6ab2
commit 3e56fa6b32
2 changed files with 7 additions and 1 deletions

View File

@ -63,7 +63,7 @@ bool Buffer::isSubBuffer() {
bool Buffer::isValidSubBufferOffset(size_t offset) {
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)) {
if (!isAligned(offset, this->getContext()->getDevice(0)->getDeviceInfo().memBaseAddressAlign / 8u)) {
return false;
}
}

View File

@ -93,6 +93,12 @@ TEST_F(SubBufferTest, GivenAlignmentThatIsHigherThen4BytesWhenCheckedForValidity
EXPECT_FALSE(buffer->isValidSubBufferOffset(region4.origin));
cl_buffer_region region5 = {1024, 4};
EXPECT_TRUE(buffer->isValidSubBufferOffset(region5.origin));
cl_buffer_region region6 = {127, 4};
EXPECT_FALSE(buffer->isValidSubBufferOffset(region6.origin));
cl_buffer_region region7 = {128, 4};
EXPECT_TRUE(buffer->isValidSubBufferOffset(region7.origin));
cl_buffer_region region8 = {129, 4};
EXPECT_FALSE(buffer->isValidSubBufferOffset(region8.origin));
}
TEST_F(SubBufferTest, givenSharingHandlerFromParentBufferWhenCreateThenShareHandler) {