mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-18 13:54:58 +08:00
Wait on timestamps in Event::wait
Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
af4e3d510e
commit
f91047f2ee
@@ -1195,6 +1195,13 @@ bool CommandQueue::isWaitForTimestampsEnabled() const {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
void CommandQueue::clearDeferredTimestampPackets() {
|
||||
TimestampPacketContainer nodesToRelease;
|
||||
if (deferredTimestampPackets) {
|
||||
deferredTimestampPackets->swapNodes(nodesToRelease);
|
||||
}
|
||||
}
|
||||
|
||||
WaitStatus CommandQueue::waitForAllEngines(bool blockedQueue, PrintfHandler *printfHandler, bool cleanTemporaryAllocationsList) {
|
||||
if (blockedQueue) {
|
||||
while (isQueueBlocked()) {
|
||||
@@ -1214,11 +1221,6 @@ WaitStatus CommandQueue::waitForAllEngines(bool blockedQueue, PrintfHandler *pri
|
||||
return WaitStatus::GpuHang;
|
||||
}
|
||||
|
||||
TimestampPacketContainer nodesToRelease;
|
||||
if (deferredTimestampPackets) {
|
||||
deferredTimestampPackets->swapNodes(nodesToRelease);
|
||||
}
|
||||
|
||||
waitStatus = waitUntilComplete(taskCount, activeBcsStates, flushStamp->peekStamp(), false, cleanTemporaryAllocationsList, waitedOnTimestamps);
|
||||
|
||||
if (printfHandler) {
|
||||
@@ -1227,6 +1229,8 @@ WaitStatus CommandQueue::waitForAllEngines(bool blockedQueue, PrintfHandler *pri
|
||||
}
|
||||
}
|
||||
|
||||
this->clearDeferredTimestampPackets();
|
||||
|
||||
return waitStatus;
|
||||
}
|
||||
|
||||
|
||||
@@ -357,6 +357,8 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
|
||||
|
||||
TimestampPacketContainer *getDeferredTimestampPackets() const { return deferredTimestampPackets.get(); }
|
||||
|
||||
MOCKABLE_VIRTUAL void clearDeferredTimestampPackets();
|
||||
|
||||
uint64_t dispatchHints = 0;
|
||||
|
||||
bool isTextureCacheFlushNeeded(uint32_t commandType) const;
|
||||
|
||||
@@ -428,7 +428,9 @@ inline WaitStatus Event::wait(bool blocking, bool useQuickKmdSleep) {
|
||||
}
|
||||
|
||||
Range<CopyEngineState> states{&bcsState, bcsState.isValid() ? 1u : 0u};
|
||||
const auto waitStatus = cmdQueue->waitUntilComplete(taskCount.load(), states, flushStamp->peekStamp(), useQuickKmdSleep);
|
||||
auto waitStatus = WaitStatus::NotReady;
|
||||
auto waitedOnTimestamps = cmdQueue->waitForTimestamps(states, taskCount.load(), waitStatus);
|
||||
waitStatus = cmdQueue->waitUntilComplete(taskCount.load(), states, flushStamp->peekStamp(), useQuickKmdSleep, true, waitedOnTimestamps);
|
||||
if (waitStatus == WaitStatus::GpuHang) {
|
||||
return WaitStatus::GpuHang;
|
||||
}
|
||||
@@ -439,6 +441,8 @@ inline WaitStatus Event::wait(bool blocking, bool useQuickKmdSleep) {
|
||||
auto *allocationStorage = cmdQueue->getGpgpuCommandStreamReceiver().getInternalAllocationStorage();
|
||||
allocationStorage->cleanAllocationList(this->taskCount, TEMPORARY_ALLOCATION);
|
||||
|
||||
cmdQueue->clearDeferredTimestampPackets();
|
||||
|
||||
return WaitStatus::Ready;
|
||||
}
|
||||
|
||||
|
||||
@@ -909,6 +909,18 @@ TEST_F(InternalsEventTest, givenPassingEventWhenWaitingForEventsThenWaititingIsS
|
||||
EXPECT_NE(Event::executionAbortedDueToGpuHang, passingEvent.peekExecutionStatus());
|
||||
}
|
||||
|
||||
TEST_F(InternalsEventTest, givenEventWhenWaitThenWaitForTimestampsCalled) {
|
||||
MockCommandQueue cmdQ(mockContext, pClDevice, nullptr, false);
|
||||
MockEvent<Event> event(&cmdQ, CL_COMMAND_NDRANGE_KERNEL, 0, 0);
|
||||
EXPECT_FALSE(cmdQ.waitForTimestampsCalled);
|
||||
EXPECT_FALSE(cmdQ.clearDeferredTimestampPacketsCalled);
|
||||
|
||||
event.wait(false, false);
|
||||
|
||||
EXPECT_TRUE(cmdQ.waitForTimestampsCalled);
|
||||
EXPECT_TRUE(cmdQ.clearDeferredTimestampPacketsCalled);
|
||||
}
|
||||
|
||||
TEST_F(InternalsEventTest, GivenProfilingWHENMapOperationTHENTimesSet) {
|
||||
const cl_queue_properties props[3] = {CL_QUEUE_PROPERTIES, CL_QUEUE_PROFILING_ENABLE, 0};
|
||||
MockCommandQueue *pCmdQ = new MockCommandQueue(mockContext, pClDevice, props, false);
|
||||
|
||||
@@ -212,10 +212,19 @@ class MockCommandQueue : public CommandQueue {
|
||||
|
||||
bool obtainTimestampPacketForCacheFlush(bool isCacheFlushRequired) const override { return isCacheFlushRequired; }
|
||||
|
||||
bool waitForTimestamps(Range<CopyEngineState> copyEnginesToWait, uint32_t taskCount, WaitStatus &status) override { return false; };
|
||||
bool waitForTimestamps(Range<CopyEngineState> copyEnginesToWait, uint32_t taskCount, WaitStatus &status) override {
|
||||
waitForTimestampsCalled = true;
|
||||
return false;
|
||||
};
|
||||
|
||||
void clearDeferredTimestampPackets() override {
|
||||
CommandQueue::clearDeferredTimestampPackets();
|
||||
clearDeferredTimestampPacketsCalled = true;
|
||||
}
|
||||
|
||||
bool releaseIndirectHeapCalled = false;
|
||||
|
||||
bool waitForTimestampsCalled = false;
|
||||
bool clearDeferredTimestampPacketsCalled = false;
|
||||
cl_int writeBufferRetValue = CL_SUCCESS;
|
||||
uint32_t writeBufferCounter = 0;
|
||||
bool writeBufferBlocking = false;
|
||||
|
||||
Reference in New Issue
Block a user