diff --git a/runtime/command_queue/enqueue_read_buffer.h b/runtime/command_queue/enqueue_read_buffer.h index 3d52b51dc0..b5bd6091d0 100644 --- a/runtime/command_queue/enqueue_read_buffer.h +++ b/runtime/command_queue/enqueue_read_buffer.h @@ -33,7 +33,9 @@ cl_int CommandQueueHw::enqueueReadBuffer( const cl_event *eventWaitList, cl_event *event) { - notifyEnqueueReadBuffer(buffer, !!blockingRead); + if (nullptr == mapAllocation) { + notifyEnqueueReadBuffer(buffer, !!blockingRead); + } cl_int retVal = CL_SUCCESS; bool isMemTransferNeeded = buffer->isMemObjZeroCopy() ? buffer->checkIfMemoryTransferIsRequired(offset, 0, ptr, CL_COMMAND_READ_BUFFER) : true; diff --git a/unit_tests/command_queue/enqueue_read_buffer_tests.cpp b/unit_tests/command_queue/enqueue_read_buffer_tests.cpp index e100b75ab7..b94d9eb3dd 100644 --- a/unit_tests/command_queue/enqueue_read_buffer_tests.cpp +++ b/unit_tests/command_queue/enqueue_read_buffer_tests.cpp @@ -465,6 +465,24 @@ HWTEST_F(EnqueueReadBufferTypeTest, givenCommandQueueWhenEnqueueReadBufferIsCall EXPECT_TRUE(mockCmdQ->notifyEnqueueReadBufferCalled); } +HWTEST_F(EnqueueReadBufferTypeTest, givenCommandQueueWhenEnqueueReadBufferWithMapAllocationIsCalledThenItDoesntCallNotifyFunction) { + auto mockCmdQ = std::make_unique>(context, pDevice, nullptr); + void *ptr = nonZeroCopyBuffer->getCpuAddressForMemoryTransfer(); + GraphicsAllocation mapAllocation{GraphicsAllocation::AllocationType::UNKNOWN, nullptr, 0, 0, 0, MemoryPool::MemoryNull, false}; + auto retVal = mockCmdQ->enqueueReadBuffer(srcBuffer.get(), + CL_TRUE, + 0, + MemoryConstants::cacheLineSize, + ptr, + &mapAllocation, + 0, + nullptr, + nullptr); + + EXPECT_EQ(CL_SUCCESS, retVal); + EXPECT_FALSE(mockCmdQ->notifyEnqueueReadBufferCalled); +} + HWTEST_F(EnqueueReadBufferTypeTest, givenEnqueueReadBufferCalledWhenLockedPtrInTransferPropertisIsAvailableThenItIsNotUnlocked) { DebugManagerStateRestore dbgRestore; DebugManager.flags.DoCpuCopyOnReadBuffer.set(true);