fix: remove not needed check in OCL CPU copy path

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2024-05-14 16:01:06 +00:00
committed by Compute-Runtime-Automation
parent 21114ddc03
commit 92f9c8be96
3 changed files with 3 additions and 7 deletions

View File

@@ -774,10 +774,6 @@ bool Buffer::isReadWriteOnCpuAllowed(const Device &device) {
return false; return false;
} }
if (graphicsAllocation->isAllocatedInLocalMemoryPool()) {
return false;
}
return true; return true;
} }

View File

@@ -338,6 +338,6 @@ TEST(ReadWriteBufferOnCpu, whenLocalMemoryPoolAllocationIsAskedForPreferenceThen
ASSERT_NE(nullptr, buffer.get()); ASSERT_NE(nullptr, buffer.get());
reinterpret_cast<MemoryAllocation *>(buffer->getGraphicsAllocation(device->getRootDeviceIndex()))->overrideMemoryPool(MemoryPool::localMemory); reinterpret_cast<MemoryAllocation *>(buffer->getGraphicsAllocation(device->getRootDeviceIndex()))->overrideMemoryPool(MemoryPool::localMemory);
EXPECT_FALSE(buffer->isReadWriteOnCpuAllowed(device->getDevice())); EXPECT_TRUE(buffer->isReadWriteOnCpuAllowed(device->getDevice()));
EXPECT_FALSE(buffer->isReadWriteOnCpuPreferred(reinterpret_cast<void *>(0x1000), MemoryConstants::pageSize, device->getDevice())); EXPECT_FALSE(buffer->isReadWriteOnCpuPreferred(reinterpret_cast<void *>(0x1000), MemoryConstants::pageSize, device->getDevice()));
} }

View File

@@ -72,14 +72,14 @@ TEST(Buffer, givenBufferWhenAskedForPtrLengthThenReturnCorrectValue) {
EXPECT_EQ(size[0], retOffset); EXPECT_EQ(size[0], retOffset);
} }
TEST(Buffer, whenBufferAllocatedInLocalMemoryThenCpuCopyIsDisallowed) { TEST(Buffer, whenBufferAllocatedInLocalMemoryThenCpuCopyIsAllowed) {
MockGraphicsAllocation allocation{}; MockGraphicsAllocation allocation{};
MockBuffer buffer(allocation); MockBuffer buffer(allocation);
UltDeviceFactory factory{1, 0}; UltDeviceFactory factory{1, 0};
auto &device = *factory.rootDevices[0]; auto &device = *factory.rootDevices[0];
allocation.memoryPool = MemoryPool::localMemory; allocation.memoryPool = MemoryPool::localMemory;
EXPECT_FALSE(buffer.isReadWriteOnCpuAllowed(device)); EXPECT_TRUE(buffer.isReadWriteOnCpuAllowed(device));
allocation.memoryPool = MemoryPool::system4KBPages; allocation.memoryPool = MemoryPool::system4KBPages;
EXPECT_TRUE(buffer.isReadWriteOnCpuAllowed(device)); EXPECT_TRUE(buffer.isReadWriteOnCpuAllowed(device));