mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Reverse logic of creating Memory Manager - part 1
-remove CSR::createMemoryManager method -create MM from platform before creating devices Change-Id: I0e7f091c53b0e60ae7101e82a305253af626330e Signed-off-by: Jobczyk, Lukasz <lukasz.jobczyk@intel.com>
This commit is contained in:
@@ -129,7 +129,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenItIsCreatedWithDebugSetti
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenItIsCreatedThenMemoryManagerIsNotNull) {
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(**platformDevices, "", true, *pDevice->executionEnvironment));
|
||||
std::unique_ptr<MemoryManager> memoryManager(aubCsr->createMemoryManager(false, false));
|
||||
std::unique_ptr<MemoryManager> memoryManager(new OsAgnosticMemoryManager(false, false, *pDevice->executionEnvironment));
|
||||
EXPECT_NE(nullptr, memoryManager.get());
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenMakeResidentCalledMultipleTimesAffectsResidencyOnce) {
|
||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
memoryManager.reset(new OsAgnosticMemoryManager(false, false, *pDevice->executionEnvironment));
|
||||
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
@@ -693,8 +693,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe
|
||||
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
memoryManager.reset(new OsAgnosticMemoryManager(false, false, *pDevice->executionEnvironment));
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
@@ -718,7 +717,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMe
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcessResidencyIsCalledOnBufferAndImageAllocationsThenAllocationsTypesShouldBeMadeNonAubWritable) {
|
||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
memoryManager.reset(new OsAgnosticMemoryManager(false, false, *pDevice->executionEnvironment));
|
||||
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
@@ -739,7 +738,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInSubCaptur
|
||||
DebugManagerStateRestore stateRestore;
|
||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||
std::unique_ptr<MockAubCsrToTestDumpAubNonWritable<FamilyType>> aubCsr(new MockAubCsrToTestDumpAubNonWritable<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
memoryManager.reset(new OsAgnosticMemoryManager(false, false, *pDevice->executionEnvironment));
|
||||
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
@@ -764,7 +763,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
|
||||
DebugManagerStateRestore stateRestore;
|
||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||
std::unique_ptr<MockAubCsrToTestDumpAubNonWritable<FamilyType>> aubCsr(new MockAubCsrToTestDumpAubNonWritable<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
memoryManager.reset(new OsAgnosticMemoryManager(false, false, *pDevice->executionEnvironment));
|
||||
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
auto gfxBufferAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize, GraphicsAllocation::AllocationType::BUFFER});
|
||||
@@ -803,7 +802,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphic
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
memoryManager.reset(new OsAgnosticMemoryManager(false, false, *pDevice->executionEnvironment));
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
@@ -815,7 +814,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphic
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGraphicsAllocationTypeIsNonAubWritableThenWriteMemoryIsNotAllowed) {
|
||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
memoryManager.reset(new OsAgnosticMemoryManager(false, false, *pDevice->executionEnvironment));
|
||||
|
||||
auto gfxAllocation = memoryManager->allocateGraphicsMemoryWithProperties(MockAllocationProperties{MemoryConstants::pageSize});
|
||||
|
||||
|
||||
@@ -51,9 +51,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverInStandalon
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedBatchBufferFlatteningInImmediateDispatchModeThenNewCombinedBatchBufferIsCreated) {
|
||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
std::unique_ptr<MemoryManager> memoryManager(new OsAgnosticMemoryManager(false, false, *pDevice->executionEnvironment));
|
||||
auto flatBatchBufferHelper = new FlatBatchBufferHelperHw<FamilyType>(*pDevice->executionEnvironment);
|
||||
aubCsr->overwriteFlatBatchBufferHelper(flatBatchBufferHelper);
|
||||
|
||||
@@ -81,9 +80,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedBatchBufferInImmediateDispatchModeAndNoChainedBatchBufferThenCombinedBatchBufferIsNotCreated) {
|
||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
std::unique_ptr<MemoryManager> memoryManager(new OsAgnosticMemoryManager(false, false, *pDevice->executionEnvironment));
|
||||
auto flatBatchBufferHelper = new FlatBatchBufferHelperHw<FamilyType>(*pDevice->executionEnvironment);
|
||||
aubCsr->overwriteFlatBatchBufferHelper(flatBatchBufferHelper);
|
||||
|
||||
@@ -105,9 +103,8 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedB
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenForcedBatchBufferAndNotImmediateOrBatchedDispatchModeThenCombinedBatchBufferIsNotCreated) {
|
||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
std::unique_ptr<MemoryManager> memoryManager(new OsAgnosticMemoryManager(false, false, *pDevice->executionEnvironment));
|
||||
auto flatBatchBufferHelper = new FlatBatchBufferHelperHw<FamilyType>(*pDevice->executionEnvironment);
|
||||
aubCsr->overwriteFlatBatchBufferHelper(flatBatchBufferHelper);
|
||||
|
||||
@@ -389,9 +386,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGetIndi
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenGetIndirectPatchCommandsIsCalledForNonEmptyPatchInfoListThenIndirectPatchCommandBufferIsCreated) {
|
||||
typedef typename FamilyType::MI_STORE_DATA_IMM MI_STORE_DATA_IMM;
|
||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
|
||||
PatchInfoData patchInfo1(0xA000, 0u, PatchInfoAllocationType::KernelArg, 0x6000, 0x100, PatchInfoAllocationType::IndirectObjectHeap);
|
||||
PatchInfoData patchInfo2(0xB000, 0u, PatchInfoAllocationType::KernelArg, 0x6000, 0x200, PatchInfoAllocationType::IndirectObjectHeap);
|
||||
@@ -416,9 +411,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenAddBatc
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.FlattenBatchBufferForAUBDump.set(true);
|
||||
|
||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(new AUBCommandStreamReceiverHw<FamilyType>(*platformDevices[0], "", true, *pDevice->executionEnvironment));
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
|
||||
MI_BATCH_BUFFER_START bbStart;
|
||||
|
||||
@@ -657,11 +650,10 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMemoryIsCalledThenGraphicsAllocationSizeIsReadCorrectly) {
|
||||
std::unique_ptr<MemoryManager> memoryManager(nullptr);
|
||||
pDevice->executionEnvironment->aubCenter.reset(new AubCenter());
|
||||
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>(*platformDevices[0], "", false, *pDevice->executionEnvironment);
|
||||
memoryManager.reset(aubCsr->createMemoryManager(false, false));
|
||||
std::unique_ptr<MemoryManager> memoryManager(new OsAgnosticMemoryManager(false, false, *pDevice->executionEnvironment));
|
||||
|
||||
PhysicalAddressAllocator allocator;
|
||||
struct PpgttMock : std::conditional<is64bit, PML4, PDPE>::type {
|
||||
|
||||
@@ -388,8 +388,6 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, CreateCommandStreamReceiverHw) {
|
||||
auto csrHw = CommandStreamReceiverHw<FamilyType>::create(hwInfo, executionEnvironment);
|
||||
EXPECT_NE(nullptr, csrHw);
|
||||
|
||||
MemoryManager *mm = csrHw->createMemoryManager(false, false);
|
||||
EXPECT_EQ(nullptr, mm);
|
||||
GmmPageTableMngr *ptm = csrHw->createPageTableManager();
|
||||
EXPECT_EQ(nullptr, ptm);
|
||||
delete csrHw;
|
||||
|
||||
@@ -105,8 +105,8 @@ struct CommandStreamReceiverWithAubDumpTest : public ::testing::TestWithParam<bo
|
||||
createAubCSR = GetParam();
|
||||
csrWithAubDump = new MyMockCsrWithAubDump<MyMockCsr>(DEFAULT_TEST_PLATFORM::hwInfo, createAubCSR, executionEnvironment);
|
||||
ASSERT_NE(nullptr, csrWithAubDump);
|
||||
memoryManager = csrWithAubDump->createMemoryManager(false, false);
|
||||
executionEnvironment.memoryManager.reset(memoryManager);
|
||||
executionEnvironment.initializeMemoryManager(false, false);
|
||||
memoryManager = executionEnvironment.memoryManager.get();
|
||||
ASSERT_NE(nullptr, memoryManager);
|
||||
|
||||
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(csrWithAubDump,
|
||||
|
||||
@@ -49,7 +49,7 @@ HWTEST_P(CreateCommandStreamReceiverTest, givenCreateCommandStreamWhenCsrIsSetTo
|
||||
|
||||
if (csrType < CommandStreamReceiverType::CSR_TYPES_NUM) {
|
||||
EXPECT_NE(nullptr, executionEnvironment->commandStreamReceivers[0][0].get());
|
||||
executionEnvironment->memoryManager.reset(executionEnvironment->commandStreamReceivers[0][0]->createMemoryManager(false, false));
|
||||
executionEnvironment->initializeMemoryManager(false, false);
|
||||
EXPECT_NE(nullptr, executionEnvironment->memoryManager.get());
|
||||
} else {
|
||||
EXPECT_EQ(nullptr, executionEnvironment->commandStreamReceivers[0][0]);
|
||||
|
||||
@@ -22,7 +22,7 @@ void TbxCommandStreamFixture::SetUp(MockDevice *pDevice) {
|
||||
const auto &hwInfo = pDevice->getHardwareInfo();
|
||||
pCommandStreamReceiver = TbxCommandStreamReceiver::create(hwInfo, "", false, *pDevice->executionEnvironment);
|
||||
ASSERT_NE(nullptr, pCommandStreamReceiver);
|
||||
mmTbx = pCommandStreamReceiver->createMemoryManager(false, false);
|
||||
mmTbx = new TbxMemoryManager(false, false, *pDevice->executionEnvironment);
|
||||
pDevice->resetCommandStreamReceiver(pCommandStreamReceiver);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user