diff --git a/opencl/source/api/api.cpp b/opencl/source/api/api.cpp index 8945037d23..4d10cb355f 100644 --- a/opencl/source/api/api.cpp +++ b/opencl/source/api/api.cpp @@ -2389,27 +2389,17 @@ cl_int CL_API_CALL clEnqueueReadBuffer(cl_command_queue commandQueue, TRACING_EXIT(ClEnqueueReadBuffer, &retVal); return retVal; } - if (pCommandQueue->isValidForStagingTransfer(pBuffer, ptr, cb, CL_COMMAND_READ_BUFFER, blockingRead, numEventsInWaitList > 0)) { - retVal = pCommandQueue->enqueueStagingBufferTransfer( - CL_COMMAND_READ_BUFFER, - pBuffer, - blockingRead, - offset, - cb, - ptr, - event); - } else { - retVal = pCommandQueue->enqueueReadBuffer( - pBuffer, - blockingRead, - offset, - cb, - ptr, - nullptr, - numEventsInWaitList, - eventWaitList, - event); - } + + retVal = pCommandQueue->enqueueReadBuffer( + pBuffer, + blockingRead, + offset, + cb, + ptr, + nullptr, + numEventsInWaitList, + eventWaitList, + event); } DBG_LOG_INPUTS("event", getClFileLogger().getEvents(reinterpret_cast(event), 1u)); @@ -2552,8 +2542,7 @@ cl_int CL_API_CALL clEnqueueWriteBuffer(cl_command_queue commandQueue, } if (pCommandQueue->isValidForStagingTransfer(pBuffer, ptr, cb, CL_COMMAND_WRITE_BUFFER, blockingWrite, numEventsInWaitList > 0)) { - retVal = pCommandQueue->enqueueStagingBufferTransfer( - CL_COMMAND_WRITE_BUFFER, + retVal = pCommandQueue->enqueueStagingWriteBuffer( pBuffer, blockingWrite, offset, diff --git a/opencl/source/command_queue/command_queue.h b/opencl/source/command_queue/command_queue.h index 7bb7a55eaf..6ecb4436df 100644 --- a/opencl/source/command_queue/command_queue.h +++ b/opencl/source/command_queue/command_queue.h @@ -140,9 +140,6 @@ class CommandQueue : public BaseObject<_cl_command_queue> { virtual cl_int enqueueReadBuffer(Buffer *buffer, cl_bool blockingRead, size_t offset, size_t size, void *ptr, GraphicsAllocation *mapAllocation, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) = 0; - virtual cl_int enqueueReadBufferImpl(Buffer *buffer, cl_bool blockingRead, size_t offset, size_t size, - void *ptr, GraphicsAllocation *mapAllocation, cl_uint numEventsInWaitList, - const cl_event *eventWaitList, cl_event *event, CommandStreamReceiver &csr) = 0; virtual cl_int enqueueReadImage(Image *srcImage, cl_bool blockingRead, const size_t *origin, const size_t *region, size_t rowPitch, size_t slicePitch, void *ptr, GraphicsAllocation *mapAllocation, @@ -405,7 +402,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> { cl_int enqueueStagingBufferMemcpy(cl_bool blockingCopy, void *dstPtr, const void *srcPtr, size_t size, cl_event *event); cl_int enqueueStagingImageTransfer(cl_command_type commandType, Image *dstImage, cl_bool blockingCopy, const size_t *globalOrigin, const size_t *globalRegion, size_t inputRowPitch, size_t inputSlicePitch, const void *ptr, cl_event *event); - cl_int enqueueStagingBufferTransfer(cl_command_type commandType, Buffer *buffer, cl_bool blockingCopy, size_t offset, size_t size, const void *ptr, cl_event *event); + cl_int enqueueStagingWriteBuffer(Buffer *buffer, cl_bool blockingCopy, size_t offset, size_t size, const void *ptr, cl_event *event); bool isValidForStagingBufferCopy(Device &device, void *dstPtr, const void *srcPtr, size_t size, bool hasDependencies); bool isValidForStagingTransfer(MemObj *memObj, const void *ptr, size_t size, cl_command_type commandType, bool isBlocking, bool hasDependencies); diff --git a/opencl/source/command_queue/command_queue_hw.h b/opencl/source/command_queue/command_queue_hw.h index 895133d98d..05195325d3 100644 --- a/opencl/source/command_queue/command_queue_hw.h +++ b/opencl/source/command_queue/command_queue_hw.h @@ -243,16 +243,6 @@ class CommandQueueHw : public CommandQueue { const cl_event *eventWaitList, cl_event *event) override; - cl_int enqueueReadBufferImpl(Buffer *buffer, - cl_bool blockingRead, - size_t offset, - size_t size, - void *ptr, - GraphicsAllocation *mapAllocation, - cl_uint numEventsInWaitList, - const cl_event *eventWaitList, - cl_event *event, CommandStreamReceiver &csr) override; - cl_int enqueueReadBufferRect(Buffer *buffer, cl_bool blockingRead, const size_t *bufferOrigin, diff --git a/opencl/source/command_queue/command_queue_staging.cpp b/opencl/source/command_queue/command_queue_staging.cpp index 27a1d420bc..96be5ffbf9 100644 --- a/opencl/source/command_queue/command_queue_staging.cpp +++ b/opencl/source/command_queue/command_queue_staging.cpp @@ -83,9 +83,8 @@ cl_int CommandQueue::enqueueStagingImageTransfer(cl_command_type commandType, Im return postStagingTransferSync(ret, event, profilingEvent, isSingleTransfer, blockingCopy, commandType); } -cl_int CommandQueue::enqueueStagingBufferTransfer(cl_command_type commandType, Buffer *buffer, cl_bool blockingCopy, size_t offset, size_t size, const void *ptr, cl_event *event) { - auto isRead = commandType == CL_COMMAND_READ_BUFFER; - CsrSelectionArgs csrSelectionArgs{commandType, isRead ? buffer : nullptr, isRead ? nullptr : buffer, this->getDevice().getRootDeviceIndex(), &size}; +cl_int CommandQueue::enqueueStagingWriteBuffer(Buffer *buffer, cl_bool blockingCopy, size_t offset, size_t size, const void *ptr, cl_event *event) { + CsrSelectionArgs csrSelectionArgs{CL_COMMAND_WRITE_BUFFER, {}, buffer, this->getDevice().getRootDeviceIndex(), &size}; CommandStreamReceiver &csr = selectCsrForBuiltinOperation(csrSelectionArgs); cl_event profilingEvent = nullptr; @@ -95,26 +94,14 @@ cl_int CommandQueue::enqueueStagingBufferTransfer(cl_command_type commandType, B auto isLastTransfer = (offset + size == chunkOffset + chunkSize); isSingleTransfer = isFirstTransfer && isLastTransfer; cl_event *outEvent = assignEventForStaging(event, &profilingEvent, isFirstTransfer, isLastTransfer); - cl_int ret = 0; - if (isRead) { - ret = this->enqueueReadBufferImpl(buffer, false, chunkOffset, chunkSize, stagingBuffer, nullptr, 0, nullptr, outEvent, csr); - } else { - ret = this->enqueueWriteBufferImpl(buffer, false, chunkOffset, chunkSize, stagingBuffer, nullptr, 0, nullptr, outEvent, csr); - } + + auto ret = this->enqueueWriteBufferImpl(buffer, false, chunkOffset, chunkSize, stagingBuffer, nullptr, 0, nullptr, outEvent, csr); ret |= this->flush(); return ret; }; auto stagingBufferManager = this->context->getStagingBufferManager(); auto ret = stagingBufferManager->performBufferTransfer(ptr, offset, size, chunkWrite, &csr, false); - - if (isRead && context->isProvidingPerformanceHints()) { - context->providePerformanceHintForMemoryTransfer(commandType, true, static_cast(buffer), ptr); - if (!isL3Capable(ptr, size)) { - context->providePerformanceHint(CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL, CL_ENQUEUE_READ_BUFFER_DOESNT_MEET_ALIGNMENT_RESTRICTIONS, ptr, size, MemoryConstants::pageSize, MemoryConstants::pageSize); - } - } - - return postStagingTransferSync(ret, event, profilingEvent, isSingleTransfer, blockingCopy, commandType); + return postStagingTransferSync(ret, event, profilingEvent, isSingleTransfer, blockingCopy, CL_COMMAND_WRITE_BUFFER); } /* diff --git a/opencl/source/command_queue/enqueue_read_buffer.h b/opencl/source/command_queue/enqueue_read_buffer.h index 95e0ecd120..494b2b839d 100644 --- a/opencl/source/command_queue/enqueue_read_buffer.h +++ b/opencl/source/command_queue/enqueue_read_buffer.h @@ -34,28 +34,11 @@ cl_int CommandQueueHw::enqueueReadBuffer( cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) { + const cl_command_type cmdType = CL_COMMAND_READ_BUFFER; CsrSelectionArgs csrSelectionArgs{cmdType, buffer, {}, device->getRootDeviceIndex(), &size}; CommandStreamReceiver &csr = selectCsrForBuiltinOperation(csrSelectionArgs); - return enqueueReadBufferImpl(buffer, blockingRead, offset, size, ptr, mapAllocation, numEventsInWaitList, eventWaitList, event, csr); -} - -template -cl_int CommandQueueHw::enqueueReadBufferImpl( - Buffer *buffer, - cl_bool blockingRead, - size_t offset, - size_t size, - void *ptr, - GraphicsAllocation *mapAllocation, - cl_uint numEventsInWaitList, - const cl_event *eventWaitList, - cl_event *event, CommandStreamReceiver &csr) { - - const cl_command_type cmdType = CL_COMMAND_READ_BUFFER; - - CsrSelectionArgs csrSelectionArgs{cmdType, buffer, {}, device->getRootDeviceIndex(), &size}; if (nullptr == mapAllocation) { notifyEnqueueReadBuffer(buffer, !!blockingRead, EngineHelpers::isBcs(csr.getOsContext().getEngineType())); diff --git a/opencl/test/unit_test/api/cl_enqueue_read_buffer_tests.inl b/opencl/test/unit_test/api/cl_enqueue_read_buffer_tests.inl index 8800c49d4a..d7661cb6a9 100644 --- a/opencl/test/unit_test/api/cl_enqueue_read_buffer_tests.inl +++ b/opencl/test/unit_test/api/cl_enqueue_read_buffer_tests.inl @@ -21,13 +21,10 @@ using ClEnqueueReadBufferTests = ApiTests; namespace ULT { TEST_F(ClEnqueueReadBufferTests, GivenCorrectArgumentsWhenReadingBufferThenSuccessIsReturned) { - MockContext context{}; - MockGraphicsAllocation allocation{}; - MockBuffer buffer{&context, allocation}; - MockCommandQueue commandQueue{context}; + MockBuffer buffer{}; auto data = 1; auto retVal = clEnqueueReadBuffer( - &commandQueue, + pCommandQueue, &buffer, false, 0, 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 07a627c73f..a6d1884b11 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 @@ -855,160 +855,3 @@ HWTEST_F(EnqueueReadBufferHw, givenHostPtrIsFromMappedBufferWhenReadBufferIsCall EXPECT_EQ(CL_SUCCESS, retVal); EXPECT_EQ(1u, csr.createAllocationForHostSurfaceCalled); } - -struct ReadBufferStagingBufferTest : public EnqueueReadBufferHw { - void SetUp() override { - REQUIRE_SVM_OR_SKIP(defaultHwInfo); - EnqueueReadBufferHw::SetUp(); - } - - void TearDown() override { - if (defaultHwInfo->capabilityTable.ftrSvm == false) { - return; - } - EnqueueReadBufferHw::TearDown(); - } - constexpr static size_t chunkSize = MemoryConstants::megaByte * 2; - - unsigned char ptr[MemoryConstants::cacheLineSize]; - MockBuffer buffer; - cl_queue_properties props = {}; -}; - -HWTEST_F(ReadBufferStagingBufferTest, whenEnqueueStagingReadBufferCalledThenReturnSuccess) { - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &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); - EXPECT_EQ(1ul, mockCommandQueueHw.enqueueReadBufferCounter); - auto &csr = device->getUltCommandStreamReceiver(); - EXPECT_EQ(0u, csr.createAllocationForHostSurfaceCalled); -} - -HWTEST_F(ReadBufferStagingBufferTest, whenHostPtrRegisteredThenDontUseStagingUntilEventCompleted) { - DebugManagerStateRestore restorer; - debugManager.flags.EnableCopyWithStagingBuffers.set(1); - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); - - cl_event event; - auto retVal = mockCommandQueueHw.enqueueReadBuffer(&buffer, - CL_FALSE, - 0, - MemoryConstants::cacheLineSize, - ptr, - nullptr, - 0, - nullptr, - &event); - EXPECT_EQ(CL_SUCCESS, retVal); - auto pEvent = castToObjectOrAbort(event); - - 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)); - - pEvent->updateExecutionStatus(); - EXPECT_TRUE(mockCommandQueueHw.isValidForStagingTransfer(&buffer, ptr, MemoryConstants::cacheLineSize, CL_COMMAND_READ_BUFFER, false, false)); - - pEvent->release(); -} - -HWTEST_F(ReadBufferStagingBufferTest, whenHostPtrRegisteredThenDontUseStagingUntilFinishCalled) { - DebugManagerStateRestore restorer; - debugManager.flags.EnableCopyWithStagingBuffers.set(1); - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &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)); - - mockCommandQueueHw.finish(); - EXPECT_TRUE(mockCommandQueueHw.isValidForStagingTransfer(&buffer, ptr, MemoryConstants::cacheLineSize, CL_COMMAND_READ_BUFFER, false, false)); -} - -HWTEST_F(ReadBufferStagingBufferTest, whenEnqueueStagingReadBufferCalledWithLargeSizeThenSplitTransfer) { - auto hostPtr = new unsigned char[chunkSize * 4]; - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); - auto retVal = CL_SUCCESS; - std::unique_ptr buffer = std::unique_ptr(Buffer::create(context.get(), - 0, - chunkSize * 4, - nullptr, - retVal)); - auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_READ_BUFFER, buffer.get(), false, 0, chunkSize * 4, hostPtr, nullptr); - EXPECT_TRUE(mockCommandQueueHw.flushCalled); - EXPECT_EQ(retVal, CL_SUCCESS); - EXPECT_EQ(res, CL_SUCCESS); - EXPECT_EQ(4ul, mockCommandQueueHw.enqueueReadBufferCounter); - auto &csr = device->getUltCommandStreamReceiver(); - EXPECT_EQ(0u, csr.createAllocationForHostSurfaceCalled); - - delete[] hostPtr; -} - -HWTEST_F(ReadBufferStagingBufferTest, whenEnqueueStagingReadBufferCalledWithEventThenReturnValidEvent) { - constexpr cl_command_type expectedLastCmd = CL_COMMAND_READ_BUFFER; - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); - cl_event event; - auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_READ_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); - EXPECT_EQ(res, CL_SUCCESS); - - auto pEvent = (Event *)event; - EXPECT_EQ(expectedLastCmd, mockCommandQueueHw.lastCommandType); - EXPECT_EQ(expectedLastCmd, pEvent->getCommandType()); - - clReleaseEvent(event); -} - -HWTEST_F(ReadBufferStagingBufferTest, givenOutOfOrderQueueWhenEnqueueStagingReadBufferCalledWithSingleTransferThenNoBarrierEnqueued) { - constexpr cl_command_type expectedLastCmd = CL_COMMAND_READ_BUFFER; - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); - mockCommandQueueHw.setOoqEnabled(); - cl_event event; - auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_READ_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); - EXPECT_EQ(res, CL_SUCCESS); - - auto pEvent = (Event *)event; - EXPECT_EQ(expectedLastCmd, mockCommandQueueHw.lastCommandType); - EXPECT_EQ(expectedLastCmd, pEvent->getCommandType()); - - clReleaseEvent(event); -} - -HWTEST_F(ReadBufferStagingBufferTest, givenCmdQueueWithProfilingWhenEnqueueStagingReadBufferThenTimestampsSetCorrectly) { - cl_event event; - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); - mockCommandQueueHw.setProfilingEnabled(); - auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_READ_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); - EXPECT_EQ(res, CL_SUCCESS); - - auto pEvent = (Event *)event; - EXPECT_FALSE(pEvent->isCPUProfilingPath()); - EXPECT_TRUE(pEvent->isProfilingEnabled()); - - clReleaseEvent(event); -} - -HWTEST_F(ReadBufferStagingBufferTest, whenEnqueueStagingReadBufferFailedThenPropagateErrorCode) { - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); - mockCommandQueueHw.enqueueReadBufferCallBase = false; - auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_READ_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, nullptr); - - EXPECT_EQ(res, CL_INVALID_OPERATION); - EXPECT_EQ(1ul, mockCommandQueueHw.enqueueReadBufferCounter); -} - -HWTEST_F(ReadBufferStagingBufferTest, whenIsValidForStagingTransferCalledThenReturnCorrectValue) { - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); - auto isStagingBuffersEnabled = device->getProductHelper().isStagingBuffersEnabled(); - unsigned char ptr[16]; - - EXPECT_EQ(isStagingBuffersEnabled, mockCommandQueueHw.isValidForStagingTransfer(&buffer, ptr, 16, CL_COMMAND_READ_BUFFER, false, false)); -} - -HWTEST_F(ReadBufferStagingBufferTest, whenIsValidForStagingTransferCalledAndCpuCopyAllowedThenReturnCorrectValue) { - DebugManagerStateRestore dbgRestore; - debugManager.flags.DoCpuCopyOnReadBuffer.set(1); - MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); - unsigned char ptr[16]; - - EXPECT_FALSE(mockCommandQueueHw.isValidForStagingTransfer(&buffer, ptr, 16, CL_COMMAND_READ_BUFFER, true, false)); -} \ No newline at end of file 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 8a564853f0..1d7022b05e 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 @@ -652,7 +652,7 @@ struct WriteBufferStagingBufferTest : public EnqueueWriteBufferHw { HWTEST_F(WriteBufferStagingBufferTest, whenEnqueueStagingWriteBufferCalledThenReturnSuccess) { MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); - auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_WRITE_BUFFER, &buffer, false, 0, buffer.getSize(), ptr, nullptr); + auto res = mockCommandQueueHw.enqueueStagingWriteBuffer(&buffer, false, 0, buffer.getSize(), ptr, nullptr); EXPECT_TRUE(mockCommandQueueHw.flushCalled); EXPECT_EQ(res, CL_SUCCESS); EXPECT_EQ(1ul, mockCommandQueueHw.enqueueWriteBufferCounter); @@ -708,7 +708,7 @@ HWTEST_F(WriteBufferStagingBufferTest, whenEnqueueStagingWriteBufferCalledWithLa chunkSize * 4, nullptr, retVal)); - auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_WRITE_BUFFER, buffer.get(), false, 0, chunkSize * 4, hostPtr, nullptr); + auto res = mockCommandQueueHw.enqueueStagingWriteBuffer(buffer.get(), false, 0, chunkSize * 4, hostPtr, nullptr); EXPECT_TRUE(mockCommandQueueHw.flushCalled); EXPECT_EQ(retVal, CL_SUCCESS); EXPECT_EQ(res, CL_SUCCESS); @@ -723,7 +723,7 @@ HWTEST_F(WriteBufferStagingBufferTest, whenEnqueueStagingWriteBufferCalledWithEv constexpr cl_command_type expectedLastCmd = CL_COMMAND_WRITE_BUFFER; MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); cl_event event; - auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_WRITE_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); + auto res = mockCommandQueueHw.enqueueStagingWriteBuffer(&buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); EXPECT_EQ(res, CL_SUCCESS); auto pEvent = (Event *)event; @@ -738,7 +738,7 @@ HWTEST_F(WriteBufferStagingBufferTest, givenOutOfOrderQueueWhenEnqueueStagingWri MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); mockCommandQueueHw.setOoqEnabled(); cl_event event; - auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_WRITE_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); + auto res = mockCommandQueueHw.enqueueStagingWriteBuffer(&buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); EXPECT_EQ(res, CL_SUCCESS); auto pEvent = (Event *)event; @@ -752,7 +752,7 @@ HWTEST_F(WriteBufferStagingBufferTest, givenCmdQueueWithProfilingWhenEnqueueStag cl_event event; MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); mockCommandQueueHw.setProfilingEnabled(); - auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_WRITE_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); + auto res = mockCommandQueueHw.enqueueStagingWriteBuffer(&buffer, false, 0, MemoryConstants::cacheLineSize, ptr, &event); EXPECT_EQ(res, CL_SUCCESS); auto pEvent = (Event *)event; @@ -765,7 +765,7 @@ HWTEST_F(WriteBufferStagingBufferTest, givenCmdQueueWithProfilingWhenEnqueueStag HWTEST_F(WriteBufferStagingBufferTest, whenEnqueueStagingWriteBufferFailedThenPropagateErrorCode) { MockCommandQueueHw mockCommandQueueHw(context.get(), device.get(), &props); mockCommandQueueHw.enqueueWriteBufferCallBase = false; - auto res = mockCommandQueueHw.enqueueStagingBufferTransfer(CL_COMMAND_WRITE_BUFFER, &buffer, false, 0, MemoryConstants::cacheLineSize, ptr, nullptr); + auto res = mockCommandQueueHw.enqueueStagingWriteBuffer(&buffer, false, 0, MemoryConstants::cacheLineSize, ptr, nullptr); EXPECT_EQ(res, CL_INVALID_OPERATION); EXPECT_EQ(1ul, mockCommandQueueHw.enqueueWriteBufferCounter); diff --git a/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp b/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp index 289d5187fd..274a71ce6f 100644 --- a/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp +++ b/opencl/test/unit_test/context/driver_diagnostics_enqueue_tests.cpp @@ -100,26 +100,6 @@ TEST_P(PerformanceHintEnqueueReadBufferTest, GivenHostPtrAndSizeAlignmentsWhenEn alignedFree(ptr); } -TEST_P(PerformanceHintEnqueueReadBufferTest, GivenHostPtrAndSizeAlignmentsWhenEnqueueStagingReadBufferIsCalledThenContextProvidesHintsAboutAlignments) { - REQUIRE_SVM_OR_SKIP(pPlatform->getClDevice(0)); - void *ptr = alignedMalloc(2 * MemoryConstants::cacheLineSize, MemoryConstants::cacheLineSize); - uintptr_t addressForReadBuffer = (uintptr_t)ptr; - size_t sizeForReadBuffer = MemoryConstants::cacheLineSize; - if (!alignedAddress) { - addressForReadBuffer++; - } - if (!alignedSize) { - sizeForReadBuffer--; - } - pCmdQ->enqueueStagingBufferTransfer(CL_COMMAND_READ_BUFFER, buffer, CL_FALSE, - 0, sizeForReadBuffer, (void *)addressForReadBuffer, nullptr); - snprintf(expectedHint, DriverDiagnostics::maxHintStringSize, DriverDiagnostics::hintFormat[CL_ENQUEUE_READ_BUFFER_REQUIRES_COPY_DATA], static_cast(buffer), addressForReadBuffer); - EXPECT_TRUE(containsHint(expectedHint, userData)); - snprintf(expectedHint, DriverDiagnostics::maxHintStringSize, DriverDiagnostics::hintFormat[CL_ENQUEUE_READ_BUFFER_DOESNT_MEET_ALIGNMENT_RESTRICTIONS], addressForReadBuffer, sizeForReadBuffer, MemoryConstants::pageSize, MemoryConstants::pageSize); - EXPECT_EQ(!(alignedSize && alignedAddress), containsHint(expectedHint, userData)); - alignedFree(ptr); -} - TEST_F(PerformanceHintEnqueueBufferTest, GivenNonBlockingReadAndNotSharedMemWhenEnqueueReadBufferRectIsCallingThenContextProvidesProperHint) { size_t bufferOrigin[] = {0, 0, 0}; diff --git a/opencl/test/unit_test/mocks/mock_command_queue.h b/opencl/test/unit_test/mocks/mock_command_queue.h index ab51fb4b12..66c4d0a603 100644 --- a/opencl/test/unit_test/mocks/mock_command_queue.h +++ b/opencl/test/unit_test/mocks/mock_command_queue.h @@ -190,12 +190,6 @@ class MockCommandQueue : public CommandQueue { GraphicsAllocation *mapAllocation, cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event) override { return CL_SUCCESS; } - cl_int enqueueReadBufferImpl(Buffer *buffer, cl_bool blockingRead, size_t offset, size_t cb, - void *ptr, GraphicsAllocation *mapAllocation, cl_uint numEventsInWaitList, - const cl_event *eventWaitList, cl_event *event, CommandStreamReceiver &csr) override { - return CL_SUCCESS; - } - cl_int enqueueReadImage(Image *srcImage, cl_bool blockingRead, const size_t *origin, const size_t *region, size_t rowPitch, size_t slicePitch, void *ptr, GraphicsAllocation *mapAllocation, cl_uint numEventsInWaitList, @@ -439,16 +433,6 @@ class MockCommandQueueHw : public CommandQueueHw { return CL_INVALID_OPERATION; } - cl_int enqueueReadBufferImpl(Buffer *buffer, cl_bool blockingRead, size_t offset, size_t size, void *ptr, GraphicsAllocation *mapAllocation, - cl_uint numEventsInWaitList, const cl_event *eventWaitList, cl_event *event, CommandStreamReceiver &csr) override { - enqueueReadBufferCounter++; - blockingReadBuffer = blockingRead == CL_TRUE; - if (enqueueReadBufferCallBase) { - return BaseClass::enqueueReadBufferImpl(buffer, blockingRead, offset, size, ptr, mapAllocation, numEventsInWaitList, eventWaitList, event, csr); - } - return CL_INVALID_OPERATION; - } - void enqueueHandlerHook(const unsigned int commandType, const MultiDispatchInfo &dispatchInfo) override { kernelParams = dispatchInfo.peekBuiltinOpParams(); lastCommandType = commandType; @@ -556,11 +540,8 @@ class MockCommandQueueHw : public CommandQueueHw { bool enqueueReadImageCallBase = true; size_t enqueueWriteBufferCounter = 0; bool enqueueWriteBufferCallBase = true; - size_t enqueueReadBufferCounter = 0; - bool enqueueReadBufferCallBase = true; size_t requestedCmdStreamSize = 0; bool blockingWriteBuffer = false; - bool blockingReadBuffer = false; bool storeMultiDispatchInfo = false; bool notifyEnqueueReadBufferCalled = false; bool notifyEnqueueReadImageCalled = false;