Resubmit fix for task count hang

Signed-off-by: John Falkowski <john.falkowski@intel.com>
This commit is contained in:
John Falkowski
2022-05-27 03:58:07 +00:00
committed by Compute-Runtime-Automation
parent c303c218be
commit 620bb970f4
18 changed files with 203 additions and 50 deletions

View File

@@ -148,9 +148,9 @@ class UltCommandStreamReceiver : public CommandStreamReceiverHw<GfxFamily>, publ
return nullptr;
}
void makeSurfacePackNonResident(ResidencyContainer &allocationsForResidency) override {
void makeSurfacePackNonResident(ResidencyContainer &allocationsForResidency, bool clearAllocations) override {
makeSurfacePackNonResidentCalled++;
BaseClass::makeSurfacePackNonResident(allocationsForResidency);
BaseClass::makeSurfacePackNonResident(allocationsForResidency, clearAllocations);
}
NEO::SubmissionStatus flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override {

View File

@@ -197,6 +197,15 @@ class MockCommandStreamReceiverWithOutOfMemorySubmitBatch : public MockCommandSt
}
};
class MockCommandStreamReceiverWithFailingFlush : public MockCommandStreamReceiver {
public:
MockCommandStreamReceiverWithFailingFlush(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex, const DeviceBitfield deviceBitfield)
: MockCommandStreamReceiver(executionEnvironment, rootDeviceIndex, deviceBitfield) {}
SubmissionStatus flush(BatchBuffer &batchBuffer, ResidencyContainer &allocationsForResidency) override {
return SubmissionStatus::FAILED;
}
};
template <typename GfxFamily>
class MockCsrHw2 : public CommandStreamReceiverHw<GfxFamily> {
public:

View File

@@ -557,7 +557,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
EXPECT_TRUE(commandBuffer->isResident(aubCsr->getOsContext().getContextId()));
EXPECT_EQ(aubCsr->peekTaskCount() + 1, commandBuffer->getResidencyTaskCount(aubCsr->getOsContext().getContextId()));
aubCsr->makeSurfacePackNonResident(allocationsForResidency);
aubCsr->makeSurfacePackNonResident(allocationsForResidency, true);
EXPECT_FALSE(commandBuffer->isResident(aubCsr->getOsContext().getContextId()));
}
@@ -603,7 +603,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
EXPECT_TRUE(commandBuffer->isResident(aubCsr->getOsContext().getContextId()));
EXPECT_EQ(aubCsr->peekTaskCount() + 1, commandBuffer->getResidencyTaskCount(aubCsr->getOsContext().getContextId()));
aubCsr->makeSurfacePackNonResident(allocationsForResidency);
aubCsr->makeSurfacePackNonResident(allocationsForResidency, true);
EXPECT_FALSE(gfxAllocation->isResident(aubCsr->getOsContext().getContextId()));
EXPECT_FALSE(commandBuffer->isResident(aubCsr->getOsContext().getContextId()));
@@ -673,7 +673,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
EXPECT_TRUE(commandBuffer->isResident(aubCsr->getOsContext().getContextId()));
EXPECT_EQ(aubCsr->peekTaskCount() + 1, commandBuffer->getResidencyTaskCount(aubCsr->getOsContext().getContextId()));
aubCsr->makeSurfacePackNonResident(allocationsForResidency);
aubCsr->makeSurfacePackNonResident(allocationsForResidency, true);
EXPECT_FALSE(gfxAllocation->isResident(aubCsr->getOsContext().getContextId()));
EXPECT_FALSE(commandBuffer->isResident(aubCsr->getOsContext().getContextId()));

View File

@@ -494,6 +494,28 @@ TEST(CommandStreamReceiverSimpleTest, givenCsrWhenSubmitiingBatchBufferThenTaskC
executionEnvironment.memoryManager->freeGraphicsMemoryImpl(commandBuffer);
}
TEST(CommandStreamReceiverSimpleTest, givenCsrWhenSubmittingBatchBufferAndFlushFailThenTaskCountIsNotIncremented) {
MockExecutionEnvironment executionEnvironment;
executionEnvironment.prepareRootDeviceEnvironments(1);
executionEnvironment.initializeMemoryManager();
DeviceBitfield deviceBitfield(1);
MockCommandStreamReceiverWithFailingFlush csr(executionEnvironment, 0, deviceBitfield);
GraphicsAllocation *commandBuffer = executionEnvironment.memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{csr.getRootDeviceIndex(), MemoryConstants::pageSize});
ASSERT_NE(nullptr, commandBuffer);
LinearStream cs(commandBuffer);
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, QueueSliceCount::defaultSliceCount, cs.getUsed(), &cs, nullptr, false};
ResidencyContainer residencyList;
auto expectedTaskCount = csr.peekTaskCount();
csr.submitBatchBuffer(batchBuffer, residencyList);
EXPECT_EQ(expectedTaskCount, csr.peekTaskCount());
EXPECT_EQ(expectedTaskCount, csr.peekLatestFlushedTaskCount());
executionEnvironment.memoryManager->freeGraphicsMemoryImpl(commandBuffer);
}
HWTEST_F(CommandStreamReceiverTest, givenUpdateTaskCountFromWaitWhenSubmitiingBatchBufferThenTaskCountIsIncrementedAndLatestsValuesSetCorrectly) {
DebugManagerStateRestore restorer;
DebugManager.flags.UpdateTaskCountFromWait.set(3);

View File

@@ -326,7 +326,7 @@ HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCsrWhenCallingMakeSurfacePackNonResi
ResidencyContainer allocationsForResidency{&allocation1, &allocation2, &allocation3};
tbxCsr.makeSurfacePackNonResident(allocationsForResidency);
tbxCsr.makeSurfacePackNonResident(allocationsForResidency, true);
std::set<GraphicsAllocation *> expectedAllocationsForDownload = {&allocation1, &allocation3};
EXPECT_EQ(expectedAllocationsForDownload, tbxCsr.allocationsForDownload);
}