From 0a27aa9f7bae8e2535472dcf8f7f6f4cdf783cad Mon Sep 17 00:00:00 2001 From: Bartosz Dunajski Date: Thu, 16 May 2024 11:20:14 +0000 Subject: [PATCH] fix: remove not needed check in OCL CPU copy path 2 Signed-off-by: Bartosz Dunajski --- opencl/source/mem_obj/buffer.cpp | 4 ---- .../unit_test/command_queue/read_write_buffer_cpu_copy.cpp | 2 +- opencl/test/unit_test/mem_obj/buffer_tests.cpp | 4 ++-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/opencl/source/mem_obj/buffer.cpp b/opencl/source/mem_obj/buffer.cpp index 2169846358..22e87c69d0 100644 --- a/opencl/source/mem_obj/buffer.cpp +++ b/opencl/source/mem_obj/buffer.cpp @@ -774,10 +774,6 @@ bool Buffer::isReadWriteOnCpuAllowed(const Device &device) { return false; } - if (graphicsAllocation->isAllocatedInLocalMemoryPool()) { - return false; - } - return true; } diff --git a/opencl/test/unit_test/command_queue/read_write_buffer_cpu_copy.cpp b/opencl/test/unit_test/command_queue/read_write_buffer_cpu_copy.cpp index bb181a6c29..97b4ee0cc5 100644 --- a/opencl/test/unit_test/command_queue/read_write_buffer_cpu_copy.cpp +++ b/opencl/test/unit_test/command_queue/read_write_buffer_cpu_copy.cpp @@ -338,6 +338,6 @@ TEST(ReadWriteBufferOnCpu, whenLocalMemoryPoolAllocationIsAskedForPreferenceThen ASSERT_NE(nullptr, buffer.get()); reinterpret_cast(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(0x1000), MemoryConstants::pageSize, device->getDevice())); } diff --git a/opencl/test/unit_test/mem_obj/buffer_tests.cpp b/opencl/test/unit_test/mem_obj/buffer_tests.cpp index a824b20810..81d5c7d021 100644 --- a/opencl/test/unit_test/mem_obj/buffer_tests.cpp +++ b/opencl/test/unit_test/mem_obj/buffer_tests.cpp @@ -72,14 +72,14 @@ TEST(Buffer, givenBufferWhenAskedForPtrLengthThenReturnCorrectValue) { EXPECT_EQ(size[0], retOffset); } -TEST(Buffer, whenBufferAllocatedInLocalMemoryThenCpuCopyIsDisallowed) { +TEST(Buffer, whenBufferAllocatedInLocalMemoryThenCpuCopyIsAllowed) { MockGraphicsAllocation allocation{}; MockBuffer buffer(allocation); UltDeviceFactory factory{1, 0}; auto &device = *factory.rootDevices[0]; allocation.memoryPool = MemoryPool::localMemory; - EXPECT_FALSE(buffer.isReadWriteOnCpuAllowed(device)); + EXPECT_TRUE(buffer.isReadWriteOnCpuAllowed(device)); allocation.memoryPool = MemoryPool::system4KBPages; EXPECT_TRUE(buffer.isReadWriteOnCpuAllowed(device));