Revert "refactor: remove not needed check for cpu transfer in ocl"

This reverts commit 098e2e76fb.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation
2024-02-13 20:53:41 +01:00
committed by Compute-Runtime-Automation
parent 1e3d57b29a
commit 4656e2ec12
3 changed files with 18 additions and 1 deletions

View File

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

View File

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