diff --git a/opencl/source/context/context.cpp b/opencl/source/context/context.cpp index 6b66fc2bb9..4b151fb535 100644 --- a/opencl/source/context/context.cpp +++ b/opencl/source/context/context.cpp @@ -122,7 +122,19 @@ cl_int Context::tryGetExistingSvmAllocation(const void *ptr, SvmAllocationData *svmEntry = getSVMAllocsManager()->getSVMAlloc(ptr); if (svmEntry) { memoryType = svmEntry->memoryType; - if ((svmEntry->gpuAllocations.getGraphicsAllocation(rootDeviceIndex)->getGpuAddress() + svmEntry->size) < (castToUint64(ptr) + size)) { + UsmMemAllocPool *pool = nullptr; + if (this->getDevice(0u)->getPlatform()->getHostMemAllocPool().isInPool(ptr)) { + pool = &this->getDevice(0u)->getPlatform()->getHostMemAllocPool(); + } else if (this->getDeviceMemAllocPool().isInPool(ptr)) { + pool = &this->getDeviceMemAllocPool(); + } + if (pool) { + size_t pooledSize = pool->getPooledAllocationSize(ptr); + uint64_t pooledBasePtr = castToUint64(pool->getPooledAllocationBasePtr(ptr)); + if ((pooledBasePtr + pooledSize) < (castToUint64(ptr) + size)) { + return CL_INVALID_OPERATION; + } + } else if ((svmEntry->gpuAllocations.getGraphicsAllocation(rootDeviceIndex)->getGpuAddress() + svmEntry->size) < (castToUint64(ptr) + size)) { return CL_INVALID_OPERATION; } allocation = svmEntry->cpuAllocation ? svmEntry->cpuAllocation : svmEntry->gpuAllocations.getGraphicsAllocation(rootDeviceIndex); diff --git a/opencl/test/unit_test/command_queue/enqueue_read_buffer_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_read_buffer_tests.cpp index b95863df08..bde9dba375 100644 --- a/opencl/test/unit_test/command_queue/enqueue_read_buffer_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_read_buffer_tests.cpp @@ -23,6 +23,7 @@ #include "opencl/test/unit_test/mocks/mock_buffer.h" #include "opencl/test/unit_test/mocks/mock_builder.h" #include "opencl/test/unit_test/mocks/mock_command_queue.h" +#include "opencl/test/unit_test/mocks/ult_cl_device_factory_with_platform.h" using namespace NEO; @@ -776,12 +777,17 @@ struct EnqueueReadBufferHw : public ::testing::Test { if (is32bit) { GTEST_SKIP(); } - device = std::make_unique(MockClDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); - context.reset(new MockContext(device.get())); + device = deviceFactory.rootDevices[0]; + context.reset(new MockContext(device)); } - std::unique_ptr device; + void TearDown() override { + context.reset(); + } + + MockClDevice *device; std::unique_ptr context; + UltClDeviceFactoryWithPlatform deviceFactory{1, 0}; MockBuffer srcBuffer; uint64_t bigSize = 4ull * MemoryConstants::gigaByte; uint64_t smallSize = 4ull * MemoryConstants::gigaByte - 1; @@ -791,7 +797,7 @@ using EnqueueReadBufferStatelessTest = EnqueueReadBufferHw; HWTEST_F(EnqueueReadBufferStatelessTest, WhenReadingBufferStatelessThenSuccessIsReturned) { - auto pCmdQ = std::make_unique>(context.get(), device.get()); + auto pCmdQ = std::make_unique>(context.get(), device); void *missAlignedPtr = reinterpret_cast(0x1041); srcBuffer.size = static_cast(bigSize); auto retVal = pCmdQ->enqueueReadBuffer(&srcBuffer, @@ -811,7 +817,7 @@ using EnqueueReadBufferStatefulTest = EnqueueReadBufferHw; HWTEST2_F(EnqueueReadBufferStatefulTest, WhenReadingBufferStatefulThenSuccessIsReturned, IsStatefulBufferPreferredForProduct) { - auto pCmdQ = std::make_unique>(context.get(), device.get()); + auto pCmdQ = std::make_unique>(context.get(), device); if (pCmdQ->getHeaplessModeEnabled()) { GTEST_SKIP(); } @@ -835,7 +841,7 @@ HWTEST_F(EnqueueReadBufferHw, givenHostPtrIsFromMappedBufferWhenReadBufferIsCall debugManager.flags.DisableZeroCopyForBuffers.set(1); debugManager.flags.DoCpuCopyOnReadBuffer.set(0); - MockCommandQueueHw queue(context.get(), device.get(), nullptr); + MockCommandQueueHw queue(context.get(), device, nullptr); auto &csr = device->getUltCommandStreamReceiver(); BufferDefaults::context = context.get(); @@ -880,7 +886,7 @@ struct ReadBufferStagingBufferTest : public EnqueueReadBufferHw { }; HWTEST_F(ReadBufferStagingBufferTest, whenEnqueueStagingReadBufferCalledThenReturnSuccess) { - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_READ_BUFFER, &buffer, false, 0, buffer.getSize(), ptr, nullptr); EXPECT_TRUE(mockCommandQueueHw.flushCalled); EXPECT_EQ(res, CL_SUCCESS); @@ -892,7 +898,7 @@ HWTEST_F(ReadBufferStagingBufferTest, whenEnqueueStagingReadBufferCalledThenRetu HWTEST_F(ReadBufferStagingBufferTest, whenHostPtrRegisteredThenDontUseStagingUntilEventCompleted) { DebugManagerStateRestore restorer; debugManager.flags.EnableCopyWithStagingBuffers.set(1); - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); cl_event event; auto retVal = mockCommandQueueHw.enqueueReadBuffer(&buffer, @@ -919,7 +925,7 @@ HWTEST_F(ReadBufferStagingBufferTest, whenHostPtrRegisteredThenDontUseStagingUnt HWTEST_F(ReadBufferStagingBufferTest, whenHostPtrRegisteredThenDontUseStagingUntilFinishCalled) { DebugManagerStateRestore restorer; debugManager.flags.EnableCopyWithStagingBuffers.set(1); - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); EXPECT_TRUE(mockCommandQueueHw.isValidForStagingTransfer(&buffer, ptr, MemoryConstants::cacheLineSize, CL_COMMAND_READ_BUFFER, false, false)); EXPECT_FALSE(mockCommandQueueHw.isValidForStagingTransfer(&buffer, ptr, MemoryConstants::cacheLineSize, CL_COMMAND_READ_BUFFER, false, false)); @@ -930,7 +936,7 @@ HWTEST_F(ReadBufferStagingBufferTest, whenHostPtrRegisteredThenDontUseStagingUnt HWTEST_F(ReadBufferStagingBufferTest, whenEnqueueStagingReadBufferCalledWithLargeSizeThenSplitTransfer) { auto hostPtr = new unsigned char[chunkSize * 4]; - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); auto retVal = CL_SUCCESS; std::unique_ptr buffer = std::unique_ptr(Buffer::create(context.get(), 0, @@ -950,7 +956,7 @@ HWTEST_F(ReadBufferStagingBufferTest, whenEnqueueStagingReadBufferCalledWithLarg HWTEST_F(ReadBufferStagingBufferTest, whenEnqueueStagingReadBufferCalledWithEventThenReturnValidEvent) { constexpr cl_command_type expectedLastCmd = CL_COMMAND_READ_BUFFER; - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); cl_event event; auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_READ_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); EXPECT_EQ(res, CL_SUCCESS); @@ -964,7 +970,7 @@ HWTEST_F(ReadBufferStagingBufferTest, whenEnqueueStagingReadBufferCalledWithEven HWTEST_F(ReadBufferStagingBufferTest, givenOutOfOrderQueueWhenEnqueueStagingReadBufferCalledWithSingleTransferThenNoBarrierEnqueued) { constexpr cl_command_type expectedLastCmd = CL_COMMAND_READ_BUFFER; - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); mockCommandQueueHw.setOoqEnabled(); cl_event event; auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_READ_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); @@ -979,7 +985,7 @@ HWTEST_F(ReadBufferStagingBufferTest, givenOutOfOrderQueueWhenEnqueueStagingRead HWTEST_F(ReadBufferStagingBufferTest, givenCmdQueueWithProfilingWhenEnqueueStagingReadBufferThenTimestampsSetCorrectly) { cl_event event; - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); mockCommandQueueHw.setProfilingEnabled(); auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_READ_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); EXPECT_EQ(res, CL_SUCCESS); @@ -992,7 +998,7 @@ HWTEST_F(ReadBufferStagingBufferTest, givenCmdQueueWithProfilingWhenEnqueueStagi } HWTEST_F(ReadBufferStagingBufferTest, whenEnqueueStagingReadBufferFailedThenPropagateErrorCode) { - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); mockCommandQueueHw.enqueueReadBufferCallBase = false; auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_READ_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, nullptr); @@ -1001,7 +1007,7 @@ HWTEST_F(ReadBufferStagingBufferTest, whenEnqueueStagingReadBufferFailedThenProp } HWTEST_F(ReadBufferStagingBufferTest, whenIsValidForStagingTransferCalledThenReturnCorrectValue) { - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); auto isStagingBuffersEnabled = device->getProductHelper().isStagingBuffersEnabled(); unsigned char ptr[16]; @@ -1011,7 +1017,7 @@ HWTEST_F(ReadBufferStagingBufferTest, whenIsValidForStagingTransferCalledThenRet HWTEST_F(ReadBufferStagingBufferTest, whenIsValidForStagingTransferCalledAndCpuCopyAllowedThenReturnCorrectValue) { DebugManagerStateRestore dbgRestore; debugManager.flags.DoCpuCopyOnReadBuffer.set(1); - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); unsigned char ptr[16]; EXPECT_FALSE(mockCommandQueueHw.isValidForStagingTransfer(&buffer, ptr, 16, CL_COMMAND_READ_BUFFER, true, false)); diff --git a/opencl/test/unit_test/command_queue/enqueue_write_buffer_tests.cpp b/opencl/test/unit_test/command_queue/enqueue_write_buffer_tests.cpp index 6b1f848337..e4a701ecb5 100644 --- a/opencl/test/unit_test/command_queue/enqueue_write_buffer_tests.cpp +++ b/opencl/test/unit_test/command_queue/enqueue_write_buffer_tests.cpp @@ -23,6 +23,7 @@ #include "opencl/test/unit_test/mocks/mock_buffer.h" #include "opencl/test/unit_test/mocks/mock_builder.h" #include "opencl/test/unit_test/mocks/mock_command_queue.h" +#include "opencl/test/unit_test/mocks/ult_cl_device_factory_with_platform.h" using namespace NEO; @@ -555,12 +556,17 @@ struct EnqueueWriteBufferHw : public ::testing::Test { if (is32bit) { GTEST_SKIP(); } - device = std::make_unique(MockClDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); - context.reset(new MockContext(device.get())); + device = deviceFactory.rootDevices[0]; + context.reset(new MockContext(device)); } - std::unique_ptr device; + void TearDown() override { + context.reset(); + } + + MockClDevice *device; std::unique_ptr context; + UltClDeviceFactoryWithPlatform deviceFactory{1, 0}; MockBuffer srcBuffer; uint64_t bigSize = 4ull * MemoryConstants::gigaByte; uint64_t smallSize = 4ull * MemoryConstants::gigaByte - 1; @@ -570,7 +576,7 @@ using EnqueueReadWriteStatelessTest = EnqueueWriteBufferHw; HWTEST_F(EnqueueReadWriteStatelessTest, WhenWritingBufferStatelessThenSuccessIsReturned) { - auto pCmdQ = std::make_unique>(context.get(), device.get()); + auto pCmdQ = std::make_unique>(context.get(), device); void *missAlignedPtr = reinterpret_cast(0x1041); srcBuffer.size = static_cast(bigSize); auto retVal = pCmdQ->enqueueWriteBuffer(&srcBuffer, @@ -590,7 +596,7 @@ using EnqueueWriteBufferStatefulTest = EnqueueWriteBufferHw; HWTEST2_F(EnqueueWriteBufferStatefulTest, WhenWritingBufferStatefulThenSuccessIsReturned, IsStatefulBufferPreferredForProduct) { - auto pCmdQ = std::make_unique>(context.get(), device.get()); + auto pCmdQ = std::make_unique>(context.get(), device); if (pCmdQ->getHeaplessModeEnabled()) { GTEST_SKIP(); } @@ -614,7 +620,7 @@ HWTEST_F(EnqueueWriteBufferHw, givenHostPtrIsFromMappedBufferWhenWriteBufferIsCa debugManager.flags.DisableZeroCopyForBuffers.set(1); debugManager.flags.DoCpuCopyOnWriteBuffer.set(0); - MockCommandQueueHw queue(context.get(), device.get(), nullptr); + MockCommandQueueHw queue(context.get(), device, nullptr); auto &csr = device->getUltCommandStreamReceiver(); BufferDefaults::context = context.get(); @@ -659,7 +665,7 @@ struct WriteBufferStagingBufferTest : public EnqueueWriteBufferHw { }; HWTEST_F(WriteBufferStagingBufferTest, whenEnqueueStagingWriteBufferCalledThenReturnSuccess) { - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_WRITE_BUFFER, &buffer, false, 0, buffer.getSize(), ptr, nullptr); EXPECT_TRUE(mockCommandQueueHw.flushCalled); EXPECT_EQ(res, CL_SUCCESS); @@ -671,7 +677,7 @@ HWTEST_F(WriteBufferStagingBufferTest, whenEnqueueStagingWriteBufferCalledThenRe HWTEST_F(WriteBufferStagingBufferTest, whenHostPtrRegisteredThenDontUseStagingUntilEventCompleted) { DebugManagerStateRestore restorer; debugManager.flags.EnableCopyWithStagingBuffers.set(1); - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); cl_event event; auto retVal = mockCommandQueueHw.enqueueWriteBuffer(&buffer, @@ -698,7 +704,7 @@ HWTEST_F(WriteBufferStagingBufferTest, whenHostPtrRegisteredThenDontUseStagingUn HWTEST_F(WriteBufferStagingBufferTest, whenHostPtrRegisteredThenDontUseStagingUntilFinishCalled) { DebugManagerStateRestore restorer; debugManager.flags.EnableCopyWithStagingBuffers.set(1); - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); EXPECT_TRUE(mockCommandQueueHw.isValidForStagingTransfer(&buffer, ptr, MemoryConstants::cacheLineSize, CL_COMMAND_WRITE_BUFFER, false, false)); EXPECT_FALSE(mockCommandQueueHw.isValidForStagingTransfer(&buffer, ptr, MemoryConstants::cacheLineSize, CL_COMMAND_WRITE_BUFFER, false, false)); @@ -709,7 +715,7 @@ HWTEST_F(WriteBufferStagingBufferTest, whenHostPtrRegisteredThenDontUseStagingUn HWTEST_F(WriteBufferStagingBufferTest, whenEnqueueStagingWriteBufferCalledWithLargeSizeThenSplitTransfer) { auto hostPtr = new unsigned char[chunkSize * 4]; - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); auto retVal = CL_SUCCESS; std::unique_ptr buffer = std::unique_ptr(Buffer::create(context.get(), 0, @@ -729,7 +735,7 @@ HWTEST_F(WriteBufferStagingBufferTest, whenEnqueueStagingWriteBufferCalledWithLa HWTEST_F(WriteBufferStagingBufferTest, whenEnqueueStagingWriteBufferCalledWithEventThenReturnValidEvent) { constexpr cl_command_type expectedLastCmd = CL_COMMAND_WRITE_BUFFER; - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); cl_event event; auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_WRITE_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); EXPECT_EQ(res, CL_SUCCESS); @@ -743,7 +749,7 @@ HWTEST_F(WriteBufferStagingBufferTest, whenEnqueueStagingWriteBufferCalledWithEv HWTEST_F(WriteBufferStagingBufferTest, givenOutOfOrderQueueWhenEnqueueStagingWriteBufferCalledWithSingleTransferThenNoBarrierEnqueued) { constexpr cl_command_type expectedLastCmd = CL_COMMAND_WRITE_BUFFER; - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); mockCommandQueueHw.setOoqEnabled(); cl_event event; auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_WRITE_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); @@ -758,7 +764,7 @@ HWTEST_F(WriteBufferStagingBufferTest, givenOutOfOrderQueueWhenEnqueueStagingWri HWTEST_F(WriteBufferStagingBufferTest, givenCmdQueueWithProfilingWhenEnqueueStagingWriteBufferThenTimestampsSetCorrectly) { cl_event event; - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); mockCommandQueueHw.setProfilingEnabled(); auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_WRITE_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); EXPECT_EQ(res, CL_SUCCESS); @@ -771,7 +777,7 @@ HWTEST_F(WriteBufferStagingBufferTest, givenCmdQueueWithProfilingWhenEnqueueStag } HWTEST_F(WriteBufferStagingBufferTest, whenEnqueueStagingWriteBufferFailedThenPropagateErrorCode) { - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); mockCommandQueueHw.enqueueWriteBufferCallBase = false; auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_WRITE_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, nullptr); @@ -780,7 +786,7 @@ HWTEST_F(WriteBufferStagingBufferTest, whenEnqueueStagingWriteBufferFailedThenPr } HWTEST_F(WriteBufferStagingBufferTest, whenIsValidForStagingTransferCalledThenReturnCorrectValue) { - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); auto isStagingBuffersEnabled = device->getProductHelper().isStagingBuffersEnabled(); unsigned char ptr[16]; @@ -790,7 +796,7 @@ HWTEST_F(WriteBufferStagingBufferTest, whenIsValidForStagingTransferCalledThenRe HWTEST_F(WriteBufferStagingBufferTest, whenIsValidForStagingTransferCalledAndCpuCopyAllowedThenReturnCorrectValue) { DebugManagerStateRestore dbgRestore; debugManager.flags.DoCpuCopyOnWriteBuffer.set(1); - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); + MockCommandQueueHw mockCommandQueueHw(context.get(), device, &props); unsigned char ptr[16]; EXPECT_FALSE(mockCommandQueueHw.isValidForStagingTransfer(&buffer, ptr, 16, CL_COMMAND_WRITE_BUFFER, true, false)); diff --git a/opencl/test/unit_test/memory_manager/unified_memory_manager_tests.cpp b/opencl/test/unit_test/memory_manager/unified_memory_manager_tests.cpp index 9baae81cb1..1fac8a2b20 100644 --- a/opencl/test/unit_test/memory_manager/unified_memory_manager_tests.cpp +++ b/opencl/test/unit_test/memory_manager/unified_memory_manager_tests.cpp @@ -1038,10 +1038,13 @@ TEST(UnifiedSharedMemoryTransferCalls, givenHostAllocationThatIsSmallerThenTrans auto status = CL_SUCCESS; - auto hostMemory = clHostMemAllocINTEL(clContext, nullptr, 4u, 0u, &status); + const auto allocationSize = 4u; + const auto sizeLargerThanAllocationSize = allocationSize + 1; + + auto hostMemory = clHostMemAllocINTEL(clContext, nullptr, allocationSize, 0u, &status); ASSERT_EQ(CL_SUCCESS, status); - auto buffer = clCreateBuffer(clContext, CL_MEM_READ_WRITE, 4096u, nullptr, &status); + auto buffer = clCreateBuffer(clContext, CL_MEM_READ_WRITE, sizeLargerThanAllocationSize, nullptr, &status); ASSERT_EQ(CL_SUCCESS, status); cl_device_id clDevice = mockContext.getDevice(0u); @@ -1049,10 +1052,10 @@ TEST(UnifiedSharedMemoryTransferCalls, givenHostAllocationThatIsSmallerThenTrans auto commandQueue = clCreateCommandQueue(clContext, clDevice, 0u, &status); ASSERT_EQ(CL_SUCCESS, status); - status = clEnqueueWriteBuffer(commandQueue, buffer, false, 0u, 4096u, hostMemory, 0u, nullptr, nullptr); + status = clEnqueueWriteBuffer(commandQueue, buffer, false, 0u, sizeLargerThanAllocationSize, hostMemory, 0u, nullptr, nullptr); EXPECT_EQ(CL_INVALID_OPERATION, status); - status = clEnqueueReadBuffer(commandQueue, buffer, false, 0u, 4096u, hostMemory, 0u, nullptr, nullptr); + status = clEnqueueReadBuffer(commandQueue, buffer, false, 0u, sizeLargerThanAllocationSize, hostMemory, 0u, nullptr, nullptr); ASSERT_EQ(CL_INVALID_OPERATION, status); status = clReleaseMemObject(buffer);