mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 12:23:05 +08:00
User event code path improvements.
- is queue blocked to release virtual event when it is submitted - do not wait on completion after ndr submit. Change-Id: I63c54e6940f6241b32f0dbdd5880f849c46fd12e Signed-off-by: Mrozek, Michal <michal.mrozek@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
cf63b25aff
commit
64403ef630
@@ -141,7 +141,7 @@ bool CommandQueue::isQueueBlocked() {
|
||||
TakeOwnershipWrapper<CommandQueue> takeOwnershipWrapper(*this);
|
||||
//check if we have user event and if so, if it is in blocked state.
|
||||
if (this->virtualEvent) {
|
||||
if (this->virtualEvent->peekExecutionStatus() <= CL_COMPLETE) {
|
||||
if (this->virtualEvent->peekExecutionStatus() <= CL_SUBMITTED) {
|
||||
UNRECOVERABLE_IF(this->virtualEvent == nullptr);
|
||||
|
||||
if (this->virtualEvent->isStatusCompletedByTermination() == false) {
|
||||
|
||||
@@ -226,8 +226,8 @@ CompletionStamp &CommandComputeKernel::submit(uint32_t taskLevel, bool terminate
|
||||
dispatchFlags,
|
||||
commandQueue.getDevice());
|
||||
|
||||
commandQueue.waitUntilComplete(completionStamp.taskCount, completionStamp.flushStamp, false);
|
||||
if (printfHandler) {
|
||||
commandQueue.waitUntilComplete(completionStamp.taskCount, completionStamp.flushStamp, false);
|
||||
printfHandler.get()->printEnqueueOutput();
|
||||
}
|
||||
|
||||
|
||||
@@ -842,22 +842,11 @@ HWTEST_F(CommandQueueHwTest, givenBlockedInOrderCmdQueueAndAsynchronouslyComplet
|
||||
size_t offset = 0;
|
||||
size_t size = 1;
|
||||
|
||||
class MockEventWithSetCompleteOnUpdate : public Event {
|
||||
public:
|
||||
MockEventWithSetCompleteOnUpdate(CommandQueue *cmdQueue, cl_command_type cmdType,
|
||||
uint32_t taskLevel, uint32_t taskCount) : Event(cmdQueue, cmdType, taskLevel, taskCount) {
|
||||
}
|
||||
void updateExecutionStatus() override {
|
||||
setStatus(CL_COMPLETE);
|
||||
}
|
||||
};
|
||||
|
||||
auto event = new Event(cmdQHw, CL_COMMAND_NDRANGE_KERNEL, 10, 0);
|
||||
|
||||
uint32_t virtualEventTaskLevel = 77;
|
||||
uint32_t virtualEventTaskCount = 80;
|
||||
auto virtualEvent = new MockEventWithSetCompleteOnUpdate(cmdQHw, CL_COMMAND_NDRANGE_KERNEL, virtualEventTaskLevel, virtualEventTaskCount);
|
||||
virtualEvent->setStatus(CL_SUBMITTED);
|
||||
auto virtualEvent = new Event(cmdQHw, CL_COMMAND_NDRANGE_KERNEL, virtualEventTaskLevel, virtualEventTaskCount);
|
||||
|
||||
cl_event blockedEvent = event;
|
||||
|
||||
@@ -866,20 +855,23 @@ HWTEST_F(CommandQueueHwTest, givenBlockedInOrderCmdQueueAndAsynchronouslyComplet
|
||||
virtualEvent->incRefInternal();
|
||||
cmdQHw->virtualEvent = virtualEvent;
|
||||
|
||||
*mockCSR->getTagAddress() = 0u;
|
||||
cmdQHw->taskLevel = 23;
|
||||
cmdQHw->enqueueKernel(mockKernel, 1, &offset, &size, &size, 1, &blockedEvent, nullptr);
|
||||
//new virtual event is created on enqueue, bind it to the created virtual event
|
||||
EXPECT_NE(cmdQHw->virtualEvent, virtualEvent);
|
||||
|
||||
EXPECT_EQ(virtualEvent->peekExecutionStatus(), CL_QUEUED);
|
||||
event->setStatus(CL_SUBMITTED);
|
||||
EXPECT_EQ(virtualEvent->peekExecutionStatus(), CL_SUBMITTED);
|
||||
|
||||
virtualEvent->Event::updateExecutionStatus();
|
||||
EXPECT_FALSE(cmdQHw->isQueueBlocked());
|
||||
// +1 for next level after virtualEvent is unblocked
|
||||
// +1 as virtualEvent was a parent for event with actual command that is being submitted
|
||||
EXPECT_EQ(virtualEventTaskLevel + 2, cmdQHw->taskLevel);
|
||||
//command being submitted was dependant only on virtual event hence only +1
|
||||
EXPECT_EQ(virtualEventTaskLevel + 1, mockCSR->lastTaskLevelToFlushTask);
|
||||
*mockCSR->getTagAddress() = initialHardwareTag;
|
||||
virtualEvent->decRefInternal();
|
||||
event->decRefInternal();
|
||||
}
|
||||
@@ -911,7 +903,6 @@ HWTEST_F(OOQueueHwTest, givenBlockedOutOfOrderCmdQueueAndAsynchronouslyCompleted
|
||||
uint32_t virtualEventTaskLevel = 77;
|
||||
uint32_t virtualEventTaskCount = 80;
|
||||
MockEventWithSetCompleteOnUpdate virtualEvent(cmdQHw, CL_COMMAND_NDRANGE_KERNEL, virtualEventTaskLevel, virtualEventTaskCount);
|
||||
virtualEvent.setStatus(CL_SUBMITTED);
|
||||
|
||||
cl_event blockedEvent = &event;
|
||||
|
||||
|
||||
@@ -574,6 +574,8 @@ TEST_F(InternalsEventTest, givenBlockedKernelWithPrintfWhenSubmittedThenPrintOut
|
||||
|
||||
event.submitCommand(false);
|
||||
|
||||
EXPECT_EQ(1u, cmdQ.latestTaskCountWaited);
|
||||
|
||||
std::string output = testing::internal::GetCapturedStdout();
|
||||
EXPECT_STREQ("test", output.c_str());
|
||||
EXPECT_FALSE(surface->isResident(pDevice->getDefaultEngine().osContext->getContextId()));
|
||||
|
||||
Reference in New Issue
Block a user