Add missing tbx calls to timestamp wait logic

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2022-04-19 11:43:40 +00:00
committed by Compute-Runtime-Automation
parent 4909b5b768
commit 6fdcb83020
10 changed files with 27 additions and 13 deletions

View File

@ -1033,13 +1033,6 @@ WaitStatus CommandQueue::waitForAllEngines(bool blockedQueue, PrintfHandler *pri
}
}
auto waitedOnTimestamps = waitForTimestamps(taskCount);
TimestampPacketContainer nodesToRelease;
if (deferredTimestampPackets) {
deferredTimestampPackets->swapNodes(nodesToRelease);
}
StackVec<CopyEngineState, bcsInfoMaskSize> activeBcsStates{};
for (CopyEngineState &state : this->bcsStates) {
if (state.isValid()) {
@ -1047,6 +1040,13 @@ WaitStatus CommandQueue::waitForAllEngines(bool blockedQueue, PrintfHandler *pri
}
}
auto waitedOnTimestamps = waitForTimestamps(activeBcsStates, taskCount);
TimestampPacketContainer nodesToRelease;
if (deferredTimestampPackets) {
deferredTimestampPackets->swapNodes(nodesToRelease);
}
const auto waitStatus = waitUntilComplete(taskCount, activeBcsStates, flushStamp->peekStamp(), false, cleanTemporaryAllocationsList, waitedOnTimestamps);
if (printfHandler) {

View File

@ -205,7 +205,7 @@ class CommandQueue : public BaseObject<_cl_command_queue> {
bool isCompleted(uint32_t gpgpuTaskCount, CopyEngineState bcsState) const;
bool isWaitForTimestampsEnabled() const;
virtual bool waitForTimestamps(uint32_t taskCount) = 0;
virtual bool waitForTimestamps(Range<CopyEngineState> copyEnginesToWait, uint32_t taskCount) = 0;
MOCKABLE_VIRTUAL bool isQueueBlocked();

View File

@ -446,7 +446,7 @@ class CommandQueueHw : public CommandQueue {
bool isCacheFlushCommand(uint32_t commandType) const override;
bool waitForTimestamps(uint32_t taskCount) override;
bool waitForTimestamps(Range<CopyEngineState> copyEnginesToWait, uint32_t taskCount) override;
MOCKABLE_VIRTUAL bool isCacheFlushForBcsRequired() const;

View File

@ -160,7 +160,7 @@ inline bool waitForTimestampsWithinContainer(TimestampPacketContainer *container
}
template <typename Family>
bool CommandQueueHw<Family>::waitForTimestamps(uint32_t taskCount) {
bool CommandQueueHw<Family>::waitForTimestamps(Range<CopyEngineState> copyEnginesToWait, uint32_t taskCount) {
using TSPacketType = typename Family::TimestampPacketType;
bool waited = false;
@ -169,6 +169,14 @@ bool CommandQueueHw<Family>::waitForTimestamps(uint32_t taskCount) {
if (isOOQEnabled()) {
waitForTimestampsWithinContainer<TSPacketType>(deferredTimestampPackets.get(), getGpgpuCommandStreamReceiver());
}
if (waited) {
getGpgpuCommandStreamReceiver().downloadAllocations();
for (const auto &copyEngine : copyEnginesToWait) {
auto bcsCsr = getBcsCommandStreamReceiver(copyEngine.engineType);
bcsCsr->downloadAllocations();
}
}
}
return waited;

View File

@ -49,7 +49,7 @@ HWTEST_F(CommandQueueHwTest, givenNoTimestampPacketsWhenWaitForTimestampsThenNoW
MockCommandQueueHw<FamilyType> cmdQ(context, device.get(), nullptr);
auto taskCount = device->getUltCommandStreamReceiver<FamilyType>().peekLatestFlushedTaskCount();
cmdQ.waitForTimestamps(101u);
cmdQ.waitForTimestamps({}, 101u);
EXPECT_EQ(device->getUltCommandStreamReceiver<FamilyType>().peekLatestFlushedTaskCount(), taskCount);
}

View File

@ -833,11 +833,13 @@ HWTEST_F(TimestampPacketTests, givenTimestampWaitEnabledWhenEnqueueWithEventThen
EXPECT_TRUE(event2.isCompleted());
EXPECT_EQ(csr.waitForCompletionWithTimeoutTaskCountCalled, 0u);
EXPECT_TRUE(csr.downloadAllocationCalled);
EXPECT_TRUE(csr.downloadAllocationsCalled);
for (CopyEngineState &state : cmdQ->bcsStates) {
if (state.isValid()) {
auto bcsCsr = static_cast<UltCommandStreamReceiver<FamilyType> *>(cmdQ->getBcsCommandStreamReceiver(state.engineType));
EXPECT_EQ(bcsCsr->waitForCompletionWithTimeoutTaskCountCalled, 0u);
EXPECT_TRUE(csr.downloadAllocationsCalled);
}
}

View File

@ -212,7 +212,7 @@ class MockCommandQueue : public CommandQueue {
bool obtainTimestampPacketForCacheFlush(bool isCacheFlushRequired) const override { return isCacheFlushRequired; }
bool waitForTimestamps(uint32_t taskCount) override { return false; };
bool waitForTimestamps(Range<CopyEngineState> copyEnginesToWait, uint32_t taskCount) override { return false; };
bool releaseIndirectHeapCalled = false;