Flush AUB before HW or TBX.

Change-Id: Ia997c6c05b2a1cb5c1968113b94ca66fbf1efe89
This commit is contained in:
Piotr Fusik
2018-10-12 10:36:32 +02:00
committed by sys_ocldev
parent 6ee094acfe
commit 7543c1fb2a
5 changed files with 19 additions and 17 deletions

View File

@@ -426,7 +426,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount[0u]);
}
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNoneStandaloneModeWhenFlushIsCalledThenItShouldNotCallMakeResidentOnCommandBufferAllocation) {
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNonStandaloneModeWhenFlushIsCalledThenItShouldNotCallMakeResidentOnCommandBufferAllocation) {
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(false, true, false);
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
auto allocationsForResidency = aubCsr->getResidencyAllocations();
@@ -476,7 +476,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
memoryManager->freeGraphicsMemory(gfxAllocation);
}
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNoneStandaloneModeWhenFlushIsCalledThenItShouldNotCallMakeResidentOnResidencyAllocations) {
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNonStandaloneModeWhenFlushIsCalledThenItShouldCallMakeResidentOnResidencyAllocations) {
auto aubExecutionEnvironment = getEnvironment<AUBCommandStreamReceiverHw<FamilyType>>(true, true, false);
auto aubCsr = aubExecutionEnvironment->template getCsr<AUBCommandStreamReceiverHw<FamilyType>>();
auto memoryManager = aubExecutionEnvironment->executionEnvironment->memoryManager.get();
@@ -494,7 +494,9 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNoneStand
aubCsr->flush(batchBuffer, engineType, allocationsForResidency, *pDevice->getOsContext());
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount[0u]);
EXPECT_NE(ObjectNotResident, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ((int)aubCsr->peekTaskCount() + 1, gfxAllocation->residencyTaskCount[0u]);
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount[0u]);
memoryManager->freeGraphicsMemoryImpl(gfxAllocation);

View File

@@ -26,6 +26,7 @@ struct MyMockCsr : UltCommandStreamReceiver<DEFAULT_TEST_FAMILY_NAME> {
flushParametrization.receivedBatchBuffer = &batchBuffer;
flushParametrization.receivedEngine = engineOrdinal;
flushParametrization.receivedAllocationsForResidency = &allocationsForResidency;
processResidency(allocationsForResidency, osContext);
return flushParametrization.flushStampToReturn;
}
@@ -174,13 +175,20 @@ HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAub
memoryManager->freeGraphicsMemoryImpl(gfxAllocation);
}
HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenProcessResidencyIsCalledThenBothBaseAndAubCsrProcessResidencyIsCalled) {
HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenFlushIsCalledThenBothBaseAndAubCsrProcessResidencyIsCalled) {
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096);
ASSERT_NE(nullptr, commandBuffer);
LinearStream cs(commandBuffer);
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, 0, nullptr, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
auto engineType = OCLRT::ENGINE_RCS;
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
ASSERT_NE(nullptr, gfxAllocation);
ResidencyContainer allocationsForResidency = {gfxAllocation};
OsContext osContext(nullptr, 0u);
csrWithAubDump->processResidency(allocationsForResidency, osContext);
FlushStamp flushStamp = csrWithAubDump->flush(batchBuffer, engineType, allocationsForResidency, osContext);
EXPECT_EQ(flushStamp, csrWithAubDump->flushParametrization.flushStampToReturn);
EXPECT_TRUE(csrWithAubDump->processResidencyParameterization.wasCalled);
EXPECT_EQ(&allocationsForResidency, csrWithAubDump->processResidencyParameterization.receivedAllocationsForResidency);
@@ -191,6 +199,7 @@ HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAub
}
memoryManager->freeGraphicsMemoryImpl(gfxAllocation);
memoryManager->freeGraphicsMemoryImpl(commandBuffer);
}
HWTEST_P(CommandStreamReceiverWithAubDumpTest, givenCommandStreamReceiverWithAubDumpWhenMakeNonResidentIsCalledThenBothBaseAndAubCsrMakeNonResidentIsCalled) {