From 4c5d567b40c810352c4b9dcf6f3b4c5bc06da7e1 Mon Sep 17 00:00:00 2001 From: Compute-Runtime-Validation Date: Fri, 17 May 2024 10:18:42 +0200 Subject: [PATCH] Revert "fix: remove not needed check in OCL CPU copy path 2" This reverts commit 0a27aa9f7bae8e2535472dcf8f7f6f4cdf783cad. Signed-off-by: Compute-Runtime-Validation --- 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, 7 insertions(+), 3 deletions(-) diff --git a/opencl/source/mem_obj/buffer.cpp b/opencl/source/mem_obj/buffer.cpp index 22e87c69d0..2169846358 100644 --- a/opencl/source/mem_obj/buffer.cpp +++ b/opencl/source/mem_obj/buffer.cpp @@ -774,6 +774,10 @@ 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 97b4ee0cc5..bb181a6c29 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_TRUE(buffer->isReadWriteOnCpuAllowed(device->getDevice())); + EXPECT_FALSE(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 81d5c7d021..a824b20810 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, whenBufferAllocatedInLocalMemoryThenCpuCopyIsAllowed) { +TEST(Buffer, whenBufferAllocatedInLocalMemoryThenCpuCopyIsDisallowed) { MockGraphicsAllocation allocation{}; MockBuffer buffer(allocation); UltDeviceFactory factory{1, 0}; auto &device = *factory.rootDevices[0]; allocation.memoryPool = MemoryPool::localMemory; - EXPECT_TRUE(buffer.isReadWriteOnCpuAllowed(device)); + EXPECT_FALSE(buffer.isReadWriteOnCpuAllowed(device)); allocation.memoryPool = MemoryPool::system4KBPages; EXPECT_TRUE(buffer.isReadWriteOnCpuAllowed(device));