mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-30 09:58:55 +08:00
AUB CSR flush to process residency in standalone mode only
This commit eliminates redundancy in calling processResidency() for AUB CSR twice in the HW CSR with AUB dump configuration. Change-Id: Ib49c80fa9d81a495dfb7261ff76e0b9b1422e42d
This commit is contained in:
committed by
sys_ocldev
parent
b2f964dcf2
commit
bb58c9fc2f
@@ -118,7 +118,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenMakeResidentC
|
||||
aubCsr->setMemoryManager(nullptr);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, flushShouldLeaveProperRingTailAlignment) {
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenFlushIsCalledThenItShouldLeaveProperRingTailAlignment) {
|
||||
auto aubCsr = new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true);
|
||||
auto memoryManager = aubCsr->createMemoryManager(false);
|
||||
|
||||
@@ -146,7 +146,7 @@ HWTEST_F(AubCommandStreamReceiverTests, flushShouldLeaveProperRingTailAlignment)
|
||||
delete memoryManager;
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, flushShouldCallMakeResidentOnCommandBufferAllocation) {
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneModeWhenFlushIsCalledThenItShouldCallMakeResidentOnCommandBufferAllocation) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
|
||||
@@ -173,7 +173,28 @@ HWTEST_F(AubCommandStreamReceiverTests, flushShouldCallMakeResidentOnCommandBuff
|
||||
aubCsr->setMemoryManager(nullptr);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, flushShouldCallMakeResidentOnResidencyAllocations) {
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNoneStandaloneModeWhenFlushIsCalledThenItShouldNotCallMakeResidentOnCommandBufferAllocation) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], false));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
auto engineType = OCLRT::ENGINE_RCS;
|
||||
|
||||
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
|
||||
|
||||
aubCsr->flush(batchBuffer, engineType, nullptr);
|
||||
|
||||
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
|
||||
|
||||
memoryManager->freeGraphicsMemoryImpl(commandBuffer);
|
||||
aubCsr->setMemoryManager(nullptr);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandaloneModeWhenFlushIsCalledThenItShouldCallMakeResidentOnResidencyAllocations) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
||||
@@ -208,6 +229,32 @@ HWTEST_F(AubCommandStreamReceiverTests, flushShouldCallMakeResidentOnResidencyAl
|
||||
aubCsr->setMemoryManager(nullptr);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNoneStandaloneModeWhenFlushIsCalledThenItShouldNotCallMakeResidentOnResidencyAllocations) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], false));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemory(sizeof(uint32_t), sizeof(uint32_t), false, false);
|
||||
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
auto engineType = OCLRT::ENGINE_RCS;
|
||||
ResidencyContainer allocationsForResidency = {gfxAllocation};
|
||||
|
||||
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount);
|
||||
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
|
||||
|
||||
aubCsr->flush(batchBuffer, engineType, &allocationsForResidency);
|
||||
|
||||
EXPECT_EQ(ObjectNotResident, gfxAllocation->residencyTaskCount);
|
||||
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
|
||||
|
||||
memoryManager->freeGraphicsMemoryImpl(commandBuffer);
|
||||
memoryManager->freeGraphicsMemoryImpl(gfxAllocation);
|
||||
aubCsr->setMemoryManager(nullptr);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphicsAllocationIsCreatedThenItDoesntHaveTypeNonAubWritable) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], true));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
@@ -284,27 +331,6 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphic
|
||||
EXPECT_FALSE(aubCsr->writeMemory(gfxAllocation));
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInNoneStandaloneModeWhenFlushIsCalledThenItShouldNotCallMakeResidentOnCommandBufferAllocation) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], false));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false));
|
||||
|
||||
GraphicsAllocation *commandBuffer = memoryManager->allocateGraphicsMemory(4096, 4096);
|
||||
ASSERT_NE(nullptr, commandBuffer);
|
||||
LinearStream cs(commandBuffer);
|
||||
|
||||
BatchBuffer batchBuffer{cs.getGraphicsAllocation(), 0, false, false, QueueThrottle::MEDIUM, cs.getUsed(), &cs};
|
||||
auto engineType = OCLRT::ENGINE_RCS;
|
||||
|
||||
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
|
||||
|
||||
aubCsr->flush(batchBuffer, engineType, nullptr);
|
||||
|
||||
EXPECT_EQ(ObjectNotResident, commandBuffer->residencyTaskCount);
|
||||
|
||||
memoryManager->freeGraphicsMemoryImpl(commandBuffer);
|
||||
aubCsr->setMemoryManager(nullptr);
|
||||
}
|
||||
|
||||
class OsAgnosticMemoryManagerForImagesWithNoHostPtr : public OsAgnosticMemoryManager {
|
||||
public:
|
||||
GraphicsAllocation *allocateGraphicsMemoryForImage(ImageInfo &imgInfo, Gmm *gmm) override {
|
||||
|
||||
Reference in New Issue
Block a user