mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 23:56:39 +08:00
AUB CSR to update hardware tag in standalone mode
This commit introduces a software controlled HW Tag in the configuration of AUB CSR in standalone mode (i.e. with no execution on real HW). Change-Id: Ic470957d58e6568b13dda3d61cb230498d8f2691
This commit is contained in:
@@ -378,6 +378,7 @@ FlushStamp AUBCommandStreamReceiverHw<GfxFamily>::flush(BatchBuffer &batchBuffer
|
|||||||
|
|
||||||
if (this->standalone) {
|
if (this->standalone) {
|
||||||
pollForCompletion(engineType);
|
pollForCompletion(engineType);
|
||||||
|
*this->tagAddress = this->peekLatestSentTaskCount();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ CommandStreamReceiver *createCommandStreamImpl(const HardwareInfo *pHwInfo) {
|
|||||||
pHwInfo->pWaTable,
|
pHwInfo->pWaTable,
|
||||||
pHwInfo->pSysInfo);
|
pHwInfo->pSysInfo);
|
||||||
commandStreamReceiver = AUBCommandStreamReceiver::create(*pHwInfo, "aubfile", true);
|
commandStreamReceiver = AUBCommandStreamReceiver::create(*pHwInfo, "aubfile", true);
|
||||||
initialHardwareTag = -1;
|
|
||||||
break;
|
break;
|
||||||
case CSR_TBX:
|
case CSR_TBX:
|
||||||
Gmm::initContext(pHwInfo->pPlatform,
|
Gmm::initContext(pHwInfo->pPlatform,
|
||||||
|
|||||||
@@ -55,6 +55,14 @@ struct MockAubCsr : public AUBCommandStreamReceiverHw<GfxFamily> {
|
|||||||
return this->dispatchMode;
|
return this->dispatchMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GraphicsAllocation *getTagAllocation() const {
|
||||||
|
return this->tagAllocation;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setLatestSentTaskCount(uint32_t latestSentTaskCount) {
|
||||||
|
this->latestSentTaskCount = latestSentTaskCount;
|
||||||
|
}
|
||||||
|
|
||||||
MOCK_METHOD2(flattenBatchBuffer, void *(BatchBuffer &batchBuffer, size_t &sizeBatchBuffer));
|
MOCK_METHOD2(flattenBatchBuffer, void *(BatchBuffer &batchBuffer, size_t &sizeBatchBuffer));
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -125,9 +133,12 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenMakeResidentC
|
|||||||
|
|
||||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenItShouldLeaveProperRingTailAlignment) {
|
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenItShouldLeaveProperRingTailAlignment) {
|
||||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], true));
|
||||||
memoryManager.reset(aubCsr->createMemoryManager(false));
|
memoryManager.reset(aubCsr->createMemoryManager(false));
|
||||||
|
|
||||||
|
aubCsr->setTagAllocation(pDevice->getTagAllocation());
|
||||||
|
ASSERT_NE(nullptr, aubCsr->getTagAllocation());
|
||||||
|
|
||||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
||||||
ASSERT_NE(nullptr, commandBuffer);
|
ASSERT_NE(nullptr, commandBuffer);
|
||||||
LinearStream cs(commandBuffer);
|
LinearStream cs(commandBuffer);
|
||||||
@@ -150,11 +161,42 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenFlushIs
|
|||||||
memoryManager->freeGraphicsMemory(commandBuffer);
|
memoryManager->freeGraphicsMemory(commandBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneModeWhenFlushIsCalledThenItShouldUpdateHwTagWithLatestSentTaskCount) {
|
||||||
|
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||||
|
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], true));
|
||||||
|
memoryManager.reset(aubCsr->createMemoryManager(false));
|
||||||
|
|
||||||
|
auto commandBuffer = memoryManager->allocateGraphicsMemory(4096, 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;
|
||||||
|
ResidencyContainer allocationsForResidency = {};
|
||||||
|
|
||||||
|
aubCsr->setTagAllocation(pDevice->getTagAllocation());
|
||||||
|
ASSERT_NE(nullptr, aubCsr->getTagAllocation());
|
||||||
|
EXPECT_EQ(initialHardwareTag, *aubCsr->getTagAddress());
|
||||||
|
|
||||||
|
aubCsr->setLatestSentTaskCount(aubCsr->peekTaskCount() + 1);
|
||||||
|
|
||||||
|
EXPECT_NE(aubCsr->peekLatestSentTaskCount(), *aubCsr->getTagAddress());
|
||||||
|
|
||||||
|
aubCsr->flush(batchBuffer, engineType, &allocationsForResidency);
|
||||||
|
|
||||||
|
EXPECT_EQ(aubCsr->peekLatestSentTaskCount(), *aubCsr->getTagAddress());
|
||||||
|
|
||||||
|
memoryManager->freeGraphicsMemory(commandBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneModeWhenFlushIsCalledThenItShouldCallMakeResidentOnCommandBufferAllocation) {
|
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneModeWhenFlushIsCalledThenItShouldCallMakeResidentOnCommandBufferAllocation) {
|
||||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], true));
|
||||||
memoryManager.reset(aubCsr->createMemoryManager(false));
|
memoryManager.reset(aubCsr->createMemoryManager(false));
|
||||||
|
|
||||||
|
aubCsr->setTagAllocation(pDevice->getTagAllocation());
|
||||||
|
ASSERT_NE(nullptr, aubCsr->getTagAllocation());
|
||||||
|
|
||||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
||||||
ASSERT_NE(nullptr, commandBuffer);
|
ASSERT_NE(nullptr, commandBuffer);
|
||||||
LinearStream cs(commandBuffer);
|
LinearStream cs(commandBuffer);
|
||||||
@@ -201,10 +243,14 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNoneStand
|
|||||||
|
|
||||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneModeWhenFlushIsCalledThenItShouldCallMakeResidentOnResidencyAllocations) {
|
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneModeWhenFlushIsCalledThenItShouldCallMakeResidentOnResidencyAllocations) {
|
||||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], true));
|
||||||
memoryManager.reset(aubCsr->createMemoryManager(false));
|
memoryManager.reset(aubCsr->createMemoryManager(false));
|
||||||
|
|
||||||
|
aubCsr->setTagAllocation(pDevice->getTagAllocation());
|
||||||
|
ASSERT_NE(nullptr, aubCsr->getTagAllocation());
|
||||||
|
|
||||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
||||||
|
ASSERT_NE(nullptr, gfxAllocation);
|
||||||
|
|
||||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
||||||
ASSERT_NE(nullptr, commandBuffer);
|
ASSERT_NE(nullptr, commandBuffer);
|
||||||
@@ -387,11 +433,14 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
|
|||||||
memoryManager->freeGraphicsMemory(commandBuffer);
|
memoryManager->freeGraphicsMemory(commandBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenDefaultDebugConfigThenExpectxpectFlattenBatchBufferIsNotCalled) {
|
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenDefaultDebugConfigThenExpectFlattenBatchBufferIsNotCalled) {
|
||||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||||
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], true));
|
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], true));
|
||||||
memoryManager.reset(aubCsr->createMemoryManager(false));
|
memoryManager.reset(aubCsr->createMemoryManager(false));
|
||||||
|
|
||||||
|
aubCsr->setTagAllocation(pDevice->getTagAllocation());
|
||||||
|
ASSERT_NE(nullptr, aubCsr->getTagAllocation());
|
||||||
|
|
||||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
||||||
ASSERT_NE(nullptr, commandBuffer);
|
ASSERT_NE(nullptr, commandBuffer);
|
||||||
LinearStream cs(commandBuffer);
|
LinearStream cs(commandBuffer);
|
||||||
@@ -415,6 +464,9 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF
|
|||||||
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], true));
|
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], true));
|
||||||
memoryManager.reset(aubCsr->createMemoryManager(false));
|
memoryManager.reset(aubCsr->createMemoryManager(false));
|
||||||
|
|
||||||
|
aubCsr->setTagAllocation(pDevice->getTagAllocation());
|
||||||
|
ASSERT_NE(nullptr, aubCsr->getTagAllocation());
|
||||||
|
|
||||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
||||||
ASSERT_NE(nullptr, commandBuffer);
|
ASSERT_NE(nullptr, commandBuffer);
|
||||||
LinearStream cs(commandBuffer);
|
LinearStream cs(commandBuffer);
|
||||||
@@ -436,7 +488,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF
|
|||||||
memoryManager->freeGraphicsMemory(chainedBatchBuffer);
|
memoryManager->freeGraphicsMemory(chainedBatchBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedFlattenBatchBufferAndImmediateDispatchModeAndTheresNoChainedBatchBufferThenExpectFlattenBatchBufferIsCalledAnyway) {
|
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedFlattenBatchBufferAndImmediateDispatchModeAndThereIsNoChainedBatchBufferThenExpectFlattenBatchBufferIsCalledAnyway) {
|
||||||
DebugManagerStateRestore dbgRestore;
|
DebugManagerStateRestore dbgRestore;
|
||||||
DebugManager.flags.FlattenBatchBufferForAUBDump.set(true);
|
DebugManager.flags.FlattenBatchBufferForAUBDump.set(true);
|
||||||
DebugManager.flags.CsrDispatchMode.set(CommandStreamReceiver::DispatchMode::ImmediateDispatch);
|
DebugManager.flags.CsrDispatchMode.set(CommandStreamReceiver::DispatchMode::ImmediateDispatch);
|
||||||
@@ -445,6 +497,9 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedF
|
|||||||
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], true));
|
std::unique_ptr<MockAubCsr<FamilyType>> aubCsr(new MockAubCsr<FamilyType>(*platformDevices[0], true));
|
||||||
memoryManager.reset(aubCsr->createMemoryManager(false));
|
memoryManager.reset(aubCsr->createMemoryManager(false));
|
||||||
|
|
||||||
|
aubCsr->setTagAllocation(pDevice->getTagAllocation());
|
||||||
|
ASSERT_NE(nullptr, aubCsr->getTagAllocation());
|
||||||
|
|
||||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
||||||
ASSERT_NE(nullptr, commandBuffer);
|
ASSERT_NE(nullptr, commandBuffer);
|
||||||
LinearStream cs(commandBuffer);
|
LinearStream cs(commandBuffer);
|
||||||
@@ -467,6 +522,9 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenDispatc
|
|||||||
memoryManager.reset(aubCsr->createMemoryManager(false));
|
memoryManager.reset(aubCsr->createMemoryManager(false));
|
||||||
aubCsr->overrideDispatchPolicy(CommandStreamReceiver::DispatchMode::BatchedDispatch);
|
aubCsr->overrideDispatchPolicy(CommandStreamReceiver::DispatchMode::BatchedDispatch);
|
||||||
|
|
||||||
|
aubCsr->setTagAllocation(pDevice->getTagAllocation());
|
||||||
|
ASSERT_NE(nullptr, aubCsr->getTagAllocation());
|
||||||
|
|
||||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
||||||
ASSERT_NE(nullptr, commandBuffer);
|
ASSERT_NE(nullptr, commandBuffer);
|
||||||
LinearStream cs(commandBuffer);
|
LinearStream cs(commandBuffer);
|
||||||
|
|||||||
Reference in New Issue
Block a user