mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Pass Blocking enqueue flag to Blit CSR
Change-Id: I2dcdd27eef338d3aca60a273bce15e5382673a93 Signed-off-by: Dunajski, Bartosz <bartosz.dunajski@intel.com> Related-To: NEO-3020
This commit is contained in:

committed by
sys_ocldev

parent
2e8e625024
commit
a2398e193b
@ -584,7 +584,7 @@ bool CommandQueue::bufferCpuCopyAllowed(Buffer *buffer, cl_command_type commandT
|
||||
buffer->isReadWriteOnCpuAllowed(blocking, numEventsInWaitList, ptr, size);
|
||||
}
|
||||
|
||||
cl_int CommandQueue::enqueueReadWriteBufferWithBlitTransfer(cl_command_type commandType, Buffer *buffer,
|
||||
cl_int CommandQueue::enqueueReadWriteBufferWithBlitTransfer(cl_command_type commandType, Buffer *buffer, bool blocking,
|
||||
size_t offset, size_t size, void *ptr, cl_uint numEventsInWaitList,
|
||||
const cl_event *eventWaitList, cl_event *event) {
|
||||
auto blitCommandStreamReceiver = context->getCommandStreamReceiverForBlitOperation(*buffer);
|
||||
@ -600,7 +600,7 @@ cl_int CommandQueue::enqueueReadWriteBufferWithBlitTransfer(cl_command_type comm
|
||||
|
||||
auto copyDirection = (CL_COMMAND_WRITE_BUFFER == commandType) ? BlitterConstants::BlitWithHostPtrDirection::FromHostPtr
|
||||
: BlitterConstants::BlitWithHostPtrDirection::ToHostPtr;
|
||||
blitCommandStreamReceiver->blitWithHostPtr(*buffer, ptr, true, offset, size, copyDirection, csrDependencies, *timestampPacketContainer);
|
||||
blitCommandStreamReceiver->blitWithHostPtr(*buffer, ptr, blocking, offset, size, copyDirection, csrDependencies, *timestampPacketContainer);
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -439,7 +439,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
|
||||
void *enqueueMapMemObject(TransferProperties &transferProperties, EventsRequest &eventsRequest, cl_int &errcodeRet);
|
||||
cl_int enqueueUnmapMemObject(TransferProperties &transferProperties, EventsRequest &eventsRequest);
|
||||
|
||||
cl_int enqueueReadWriteBufferWithBlitTransfer(cl_command_type commandType, Buffer *buffer,
|
||||
cl_int enqueueReadWriteBufferWithBlitTransfer(cl_command_type commandType, Buffer *buffer, bool blocking,
|
||||
size_t offset, size_t size, void *ptr, cl_uint numEventsInWaitList,
|
||||
const cl_event *eventWaitList, cl_event *event);
|
||||
|
||||
|
@ -55,7 +55,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueReadBuffer(
|
||||
return enqueueMarkerForReadWriteOperation(buffer, ptr, CL_COMMAND_READ_BUFFER, blockingRead,
|
||||
numEventsInWaitList, eventWaitList, event);
|
||||
} else if (blitOperationsSupported) {
|
||||
return enqueueReadWriteBufferWithBlitTransfer(CL_COMMAND_READ_BUFFER, buffer, offset, size, ptr,
|
||||
return enqueueReadWriteBufferWithBlitTransfer(CL_COMMAND_READ_BUFFER, buffer, !!blockingRead, offset, size, ptr,
|
||||
numEventsInWaitList, eventWaitList, event);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ cl_int CommandQueueHw<GfxFamily>::enqueueWriteBuffer(
|
||||
return enqueueMarkerForReadWriteOperation(buffer, const_cast<void *>(ptr), CL_COMMAND_WRITE_BUFFER, blockingWrite,
|
||||
numEventsInWaitList, eventWaitList, event);
|
||||
} else if (blitOperationsSupported) {
|
||||
return enqueueReadWriteBufferWithBlitTransfer(CL_COMMAND_WRITE_BUFFER, buffer, offset, size, const_cast<void *>(ptr),
|
||||
return enqueueReadWriteBufferWithBlitTransfer(CL_COMMAND_WRITE_BUFFER, buffer, !!blockingWrite, offset, size, const_cast<void *>(ptr),
|
||||
numEventsInWaitList, eventWaitList, event);
|
||||
}
|
||||
|
||||
|
@ -805,6 +805,37 @@ HWTEST_F(BcsBufferTests, givenOutputTimestampPacketWhenBlitCalledThenProgramMiFl
|
||||
EXPECT_TRUE(blitCmdFound);
|
||||
}
|
||||
|
||||
HWTEST_F(BcsBufferTests, givenBlockingEnqueueWhenUsingBcsThenCallWait) {
|
||||
class MyMockCsr : public UltCommandStreamReceiver<FamilyType> {
|
||||
public:
|
||||
using UltCommandStreamReceiver<FamilyType>::UltCommandStreamReceiver;
|
||||
|
||||
void waitForTaskCountWithKmdNotifyFallback(uint32_t taskCountToWait, FlushStamp flushStampToWait,
|
||||
bool useQuickKmdSleep, bool forcePowerSavingMode) override {
|
||||
waitForTaskCountWithKmdNotifyFallbackCalled++;
|
||||
}
|
||||
|
||||
uint32_t waitForTaskCountWithKmdNotifyFallbackCalled = 0;
|
||||
};
|
||||
|
||||
auto myMockCsr = new MyMockCsr(*device->getExecutionEnvironment());
|
||||
myMockCsr->initializeTagAllocation();
|
||||
myMockCsr->setupContext(*bcsMockContext->bcsOsContext);
|
||||
bcsMockContext->bcsCsr.reset(myMockCsr);
|
||||
|
||||
auto cmdQ = clUniquePtr(new MockCommandQueueHw<FamilyType>(bcsMockContext.get(), device.get(), nullptr));
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
|
||||
auto buffer = clUniquePtr<Buffer>(Buffer::create(bcsMockContext.get(), CL_MEM_READ_WRITE, 1, nullptr, retVal));
|
||||
buffer->forceDisallowCPUCopy = true;
|
||||
void *hostPtr = reinterpret_cast<void *>(0x12340000);
|
||||
|
||||
cmdQ->enqueueWriteBuffer(buffer.get(), false, 0, 1, hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(0u, myMockCsr->waitForTaskCountWithKmdNotifyFallbackCalled);
|
||||
cmdQ->enqueueWriteBuffer(buffer.get(), true, 0, 1, hostPtr, nullptr, 0, nullptr, nullptr);
|
||||
EXPECT_EQ(1u, myMockCsr->waitForTaskCountWithKmdNotifyFallbackCalled);
|
||||
}
|
||||
|
||||
TEST_F(RenderCompressedBuffersCopyHostMemoryTests, givenNonRenderCompressedBufferWhenCopyFromHostPtrIsRequiredThenDontCallWriteBuffer) {
|
||||
hwInfo->capabilityTable.ftrRenderCompressedBuffers = false;
|
||||
|
||||
|
Reference in New Issue
Block a user