mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
Move initialization of AubCenter to RootDeviceEnvironment
make RootDeviceEnvironments vector of unique_ptr Related-To: NEO-3857 Change-Id: I23998502198307c8535cdd5c9c4af5223a5d69a5 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
8cc6a65e69
commit
3e1b15c31d
@@ -80,7 +80,7 @@ TEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenTypeIsChe
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenItIsCreatedThenAubManagerAndHardwareContextAreNull) {
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.UseAubStream.set(false);
|
||||
MockExecutionEnvironment executionEnvironment(platformDevices[0], false);
|
||||
MockExecutionEnvironment executionEnvironment(platformDevices[0], false, 1);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, executionEnvironment, 0);
|
||||
@@ -118,40 +118,40 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipl
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipleInstancesAreCreatedThenTheyUseTheSameFileStream) {
|
||||
auto aubCsr1 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
auto streamProvider1 = pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter->getStreamProvider();
|
||||
auto streamProvider1 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getStreamProvider();
|
||||
EXPECT_NE(nullptr, streamProvider1);
|
||||
auto aubCsr2 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
auto streamProvider2 = pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter->getStreamProvider();
|
||||
auto streamProvider2 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getStreamProvider();
|
||||
EXPECT_NE(nullptr, streamProvider2);
|
||||
EXPECT_EQ(streamProvider1, streamProvider2);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipleInstancesAreCreatedThenTheyUseTheSamePhysicalAddressAllocator) {
|
||||
auto aubCsr1 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
auto physicalAddressAlocator1 = pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter->getPhysicalAddressAllocator();
|
||||
auto physicalAddressAlocator1 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getPhysicalAddressAllocator();
|
||||
EXPECT_NE(nullptr, physicalAddressAlocator1);
|
||||
auto aubCsr2 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
auto physicalAddressAlocator2 = pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter->getPhysicalAddressAllocator();
|
||||
auto physicalAddressAlocator2 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getPhysicalAddressAllocator();
|
||||
EXPECT_NE(nullptr, physicalAddressAlocator2);
|
||||
EXPECT_EQ(physicalAddressAlocator1, physicalAddressAlocator2);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipleInstancesAreCreatedThenTheyUseTheSameAddressMapper) {
|
||||
auto aubCsr1 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
auto addressMapper1 = pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter->getAddressMapper();
|
||||
auto addressMapper1 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getAddressMapper();
|
||||
EXPECT_NE(nullptr, addressMapper1);
|
||||
auto aubCsr2 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
auto addressMapper2 = pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter->getAddressMapper();
|
||||
auto addressMapper2 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getAddressMapper();
|
||||
EXPECT_NE(nullptr, addressMapper2);
|
||||
EXPECT_EQ(addressMapper1, addressMapper2);
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipleInstancesAreCreatedThenTheyUseTheSameSubCaptureCommon) {
|
||||
auto aubCsr1 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
auto subCaptureCommon1 = pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter->getSubCaptureCommon();
|
||||
auto subCaptureCommon1 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getSubCaptureCommon();
|
||||
EXPECT_NE(nullptr, subCaptureCommon1);
|
||||
auto aubCsr2 = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
auto subCaptureCommon2 = pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter->getSubCaptureCommon();
|
||||
auto subCaptureCommon2 = pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getSubCaptureCommon();
|
||||
EXPECT_NE(nullptr, subCaptureCommon2);
|
||||
EXPECT_EQ(subCaptureCommon1, subCaptureCommon2);
|
||||
}
|
||||
@@ -161,7 +161,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWithAubMana
|
||||
MockAubManager *mockManager = new MockAubManager();
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB);
|
||||
mockAubCenter->aubManager = std::unique_ptr<MockAubManager>(mockManager);
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(static_cast<AUBCommandStreamReceiverHw<FamilyType> *>(AUBCommandStreamReceiver::create(fileName, true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex())));
|
||||
ASSERT_NE(nullptr, aubCsr);
|
||||
@@ -177,7 +177,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenOsContextIsSetThenCreateH
|
||||
MockAubManager *mockManager = new MockAubManager();
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB);
|
||||
mockAubCenter->aubManager = std::unique_ptr<MockAubManager>(mockManager);
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(static_cast<AUBCommandStreamReceiverHw<FamilyType> *>(AUBCommandStreamReceiver::create(fileName, true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex())));
|
||||
EXPECT_EQ(nullptr, aubCsr->hardwareContextController.get());
|
||||
@@ -194,7 +194,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCsrWhenLowPriorityOsContextIsSet
|
||||
MockAubManager *mockManager = new MockAubManager();
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, fileName, CommandStreamReceiverType::CSR_AUB);
|
||||
mockAubCenter->aubManager = std::unique_ptr<MockAubManager>(mockManager);
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
|
||||
std::unique_ptr<AUBCommandStreamReceiverHw<FamilyType>> aubCsr(static_cast<AUBCommandStreamReceiverHw<FamilyType> *>(AUBCommandStreamReceiver::create(fileName, true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex())));
|
||||
EXPECT_EQ(nullptr, aubCsr->hardwareContextController.get());
|
||||
@@ -251,7 +251,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWhenMakeResidentC
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenMultipleInstancesInitializeTheirEnginesThenUniqueGlobalGttAdressesAreGenerated) {
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter.reset(new AubCenter());
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter.reset(new AubCenter());
|
||||
|
||||
auto engineInstance = HwHelper::get(platformDevices[0]->platform.eRenderCoreFamily).getGpgpuEngineInstances()[0];
|
||||
MockOsContext osContext(0, 1, engineInstance, PreemptionMode::Disabled, false);
|
||||
|
||||
@@ -648,7 +648,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenProcess
|
||||
}
|
||||
|
||||
HWTEST_F(AubCommandStreamReceiverTests, givenAubCommandStreamReceiverWhenWriteMemoryIsCalledThenGraphicsAllocationSizeIsReadCorrectly) {
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter.reset(new AubCenter());
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter.reset(new AubCenter());
|
||||
|
||||
auto aubCsr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", false, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
aubCsr->setupContext(*pDevice->getDefaultEngine().osContext);
|
||||
@@ -896,7 +896,7 @@ HWTEST_F(AubCommandStreamReceiverTests, givenCompressedGraphicsAllocationWritabl
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter(platformDevices[0], false, "aubfile", CommandStreamReceiverType::CSR_AUB);
|
||||
mockAubCenter->aubManager = std::make_unique<MockAubManager>();
|
||||
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter.reset(mockAubCenter);
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter.reset(mockAubCenter);
|
||||
MockAubCsr<FamilyType> aubCsr("", true, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex());
|
||||
MockOsContext osContext(0, 1, aub_stream::ENGINE_RCS, PreemptionMode::Disabled, false);
|
||||
aubCsr.setupContext(osContext);
|
||||
@@ -1032,3 +1032,21 @@ HWTEST_F(AubCommandStreamReceiverTests, givenGraphicsAllocationWritableWhenDumpA
|
||||
|
||||
memoryManager->freeGraphicsMemory(gfxAllocation);
|
||||
}
|
||||
|
||||
using SimulatedCsrTest = ::testing::Test;
|
||||
HWTEST_F(SimulatedCsrTest, givenAubCsrTypeWhenCreateCommandStreamReceiverThenProperAubCenterIsInitalized) {
|
||||
uint32_t expectedRootDeviceIndex = 10;
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
executionEnvironment.prepareRootDeviceEnvironments(expectedRootDeviceIndex + 2);
|
||||
|
||||
auto rootDeviceEnvironment = new MockRootDeviceEnvironment(executionEnvironment);
|
||||
executionEnvironment.rootDeviceEnvironments[expectedRootDeviceIndex].reset(rootDeviceEnvironment);
|
||||
|
||||
EXPECT_EQ(nullptr, executionEnvironment.rootDeviceEnvironments[expectedRootDeviceIndex]->aubCenter.get());
|
||||
EXPECT_FALSE(rootDeviceEnvironment->initAubCenterCalled);
|
||||
|
||||
auto csr = std::make_unique<AUBCommandStreamReceiverHw<FamilyType>>("", true, executionEnvironment, expectedRootDeviceIndex);
|
||||
EXPECT_TRUE(rootDeviceEnvironment->initAubCenterCalled);
|
||||
EXPECT_NE(nullptr, executionEnvironment.rootDeviceEnvironments[expectedRootDeviceIndex]->aubCenter.get());
|
||||
}
|
||||
|
||||
@@ -227,6 +227,7 @@ HWTEST_F(CommandStreamReceiverTest, givenCsrWhenAllocateHeapMemoryIsCalledThenHe
|
||||
|
||||
TEST(CommandStreamReceiverSimpleTest, givenCSRWithoutTagAllocationWhenGetTagAllocationIsCalledThenNullptrIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
MockCommandStreamReceiver csr(executionEnvironment, 0);
|
||||
EXPECT_EQ(nullptr, csr.getTagAllocation());
|
||||
@@ -337,6 +338,7 @@ TEST(CommandStreamReceiverSimpleTest, givenNullHardwareDebugModeWhenInitializeTa
|
||||
|
||||
TEST(CommandStreamReceiverSimpleTest, givenVariousDataSetsWhenVerifyingMemoryThenCorrectValueIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
MockCommandStreamReceiver csr(executionEnvironment, 0);
|
||||
|
||||
@@ -593,6 +595,7 @@ HWTEST_P(CommandStreamReceiverWithAubSubCaptureTest, givenCommandStreamReceiverW
|
||||
bool isActive = status.second;
|
||||
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
MyMockCsr mockCsr(executionEnvironment, 0);
|
||||
|
||||
@@ -615,20 +618,22 @@ INSTANTIATE_TEST_CASE_P(
|
||||
testing::ValuesIn(aubSubCaptureStatus));
|
||||
|
||||
TEST(CommandStreamReceiverDeviceIndexTest, givenCsrWithOsContextWhenGetDeviceIndexThenGetHighestEnabledBitInDeviceBitfield) {
|
||||
ExecutionEnvironment executioneEnvironment;
|
||||
executioneEnvironment.initializeMemoryManager();
|
||||
MockCommandStreamReceiver csr(executioneEnvironment, 0);
|
||||
auto osContext = executioneEnvironment.memoryManager->createAndRegisterOsContext(&csr, aub_stream::EngineType::ENGINE_RCS, 0b10, PreemptionMode::Disabled, false);
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
MockCommandStreamReceiver csr(executionEnvironment, 0);
|
||||
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, aub_stream::EngineType::ENGINE_RCS, 0b10, PreemptionMode::Disabled, false);
|
||||
|
||||
csr.setupContext(*osContext);
|
||||
EXPECT_EQ(1u, csr.getDeviceIndex());
|
||||
}
|
||||
|
||||
TEST(CommandStreamReceiverDeviceIndexTest, givenOsContextWithNoDeviceBitfieldWhenGettingDeviceIndexThenZeroIsReturned) {
|
||||
ExecutionEnvironment executioneEnvironment;
|
||||
executioneEnvironment.initializeMemoryManager();
|
||||
MockCommandStreamReceiver csr(executioneEnvironment, 0);
|
||||
auto osContext = executioneEnvironment.memoryManager->createAndRegisterOsContext(&csr, aub_stream::EngineType::ENGINE_RCS, 0b00, PreemptionMode::Disabled, false);
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
MockCommandStreamReceiver csr(executionEnvironment, 0);
|
||||
auto osContext = executionEnvironment.memoryManager->createAndRegisterOsContext(&csr, aub_stream::EngineType::ENGINE_RCS, 0b00, PreemptionMode::Disabled, false);
|
||||
|
||||
csr.setupContext(*osContext);
|
||||
EXPECT_EQ(0u, csr.getDeviceIndex());
|
||||
@@ -639,7 +644,7 @@ TEST(CommandStreamReceiverRootDeviceIndexTest, commandStreamGraphicsAllocationsH
|
||||
|
||||
// Setup
|
||||
auto executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->rootDeviceEnvironments.resize(2 * expectedRootDeviceIndex);
|
||||
executionEnvironment->prepareRootDeviceEnvironments(2 * expectedRootDeviceIndex);
|
||||
auto memoryManager = new MockMemoryManager(false, false, *executionEnvironment);
|
||||
executionEnvironment->memoryManager.reset(memoryManager);
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, expectedRootDeviceIndex));
|
||||
|
||||
@@ -153,7 +153,7 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenAubManagerAvailableWhe
|
||||
MockAubManager *mockManager = new MockAubManager();
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter(*platformDevices, false, fileName, CommandStreamReceiverType::CSR_TBX_WITH_AUB);
|
||||
mockAubCenter->aubManager = std::unique_ptr<MockAubManager>(mockManager);
|
||||
executionEnvironment->rootDeviceEnvironments[0].aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
|
||||
CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> csrWithAubDump("aubfile", *executionEnvironment, 0);
|
||||
ASSERT_EQ(nullptr, csrWithAubDump.aubCSR);
|
||||
@@ -167,17 +167,51 @@ HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenAubManagerAvailableWhe
|
||||
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
executionEnvironment->rootDeviceEnvironments[0].aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
|
||||
CommandStreamReceiverWithAUBDump<UltCommandStreamReceiver<FamilyType>> csrWithAubDump("aubfile", *executionEnvironment, 0);
|
||||
ASSERT_NE(nullptr, csrWithAubDump.aubCSR);
|
||||
}
|
||||
|
||||
using SimulatedCsrTest = ::testing::Test;
|
||||
HWTEST_F(SimulatedCsrTest, givenHwWithAubDumpCsrTypeWhenCreateCommandStreamReceiverThenProperAubCenterIsInitialized) {
|
||||
uint32_t expectedRootDeviceIndex = 10;
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
executionEnvironment.prepareRootDeviceEnvironments(expectedRootDeviceIndex + 2);
|
||||
|
||||
auto rootDeviceEnvironment = new MockRootDeviceEnvironment(executionEnvironment);
|
||||
executionEnvironment.rootDeviceEnvironments[expectedRootDeviceIndex].reset(rootDeviceEnvironment);
|
||||
|
||||
EXPECT_EQ(nullptr, executionEnvironment.rootDeviceEnvironments[expectedRootDeviceIndex]->aubCenter.get());
|
||||
EXPECT_FALSE(rootDeviceEnvironment->initAubCenterCalled);
|
||||
|
||||
auto csr = std::make_unique<CommandStreamReceiverWithAUBDump<UltCommandStreamReceiver<FamilyType>>>("", executionEnvironment, expectedRootDeviceIndex);
|
||||
EXPECT_TRUE(rootDeviceEnvironment->initAubCenterCalled);
|
||||
EXPECT_NE(nullptr, rootDeviceEnvironment->aubCenter.get());
|
||||
}
|
||||
HWTEST_F(SimulatedCsrTest, givenTbxWithAubDumpCsrTypeWhenCreateCommandStreamReceiverThenProperAubCenterIsInitialized) {
|
||||
uint32_t expectedRootDeviceIndex = 10;
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
executionEnvironment.prepareRootDeviceEnvironments(expectedRootDeviceIndex + 2);
|
||||
|
||||
auto rootDeviceEnvironment = new MockRootDeviceEnvironment(executionEnvironment);
|
||||
executionEnvironment.rootDeviceEnvironments[expectedRootDeviceIndex].reset(rootDeviceEnvironment);
|
||||
|
||||
EXPECT_EQ(nullptr, executionEnvironment.rootDeviceEnvironments[expectedRootDeviceIndex]->aubCenter.get());
|
||||
EXPECT_FALSE(rootDeviceEnvironment->initAubCenterCalled);
|
||||
|
||||
auto csr = std::make_unique<CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>>>("", executionEnvironment, expectedRootDeviceIndex);
|
||||
EXPECT_TRUE(rootDeviceEnvironment->initAubCenterCalled);
|
||||
EXPECT_NE(nullptr, rootDeviceEnvironment->aubCenter.get());
|
||||
}
|
||||
|
||||
HWTEST_F(CommandStreamReceiverWithAubDumpSimpleTest, givenNullAubManagerAvailableWhenTbxCsrWithAubDumpIsCreatedThenAubCsrIsCreated) {
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter();
|
||||
ExecutionEnvironment *executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
executionEnvironment->rootDeviceEnvironments[0].aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
executionEnvironment->rootDeviceEnvironments[0]->aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
|
||||
CommandStreamReceiverWithAUBDump<TbxCommandStreamReceiverHw<FamilyType>> csrWithAubDump("aubfile", *executionEnvironment, 0);
|
||||
EXPECT_NE(nullptr, csrWithAubDump.aubCSR);
|
||||
|
||||
@@ -25,7 +25,7 @@ HWTEST_P(CreateCommandStreamReceiverTest, givenCreateCommandStreamWhenCsrIsSetTo
|
||||
DebugManagerStateRestore stateRestorer;
|
||||
HardwareInfo *hwInfo = nullptr;
|
||||
ExecutionEnvironment *executionEnvironment = getExecutionEnvironmentImpl(hwInfo);
|
||||
MockAubCenterFixture::setMockAubCenter(executionEnvironment);
|
||||
MockAubCenterFixture::setMockAubCenter(*executionEnvironment->rootDeviceEnvironments[0]);
|
||||
|
||||
CommandStreamReceiverType csrType = GetParam();
|
||||
|
||||
|
||||
@@ -359,7 +359,7 @@ TEST(ExperimentalCommandBufferRootDeviceIndexTest, experimentalCommandBufferGrap
|
||||
|
||||
// Setup
|
||||
auto executionEnvironment = platformImpl->peekExecutionEnvironment();
|
||||
executionEnvironment->rootDeviceEnvironments.resize(2 * expectedRootDeviceIndex);
|
||||
executionEnvironment->prepareRootDeviceEnvironments(2 * expectedRootDeviceIndex);
|
||||
auto memoryManager = new MockMemoryManager(false, false, *executionEnvironment);
|
||||
executionEnvironment->memoryManager.reset(memoryManager);
|
||||
std::unique_ptr<MockDevice> device(Device::create<MockDevice>(executionEnvironment, expectedRootDeviceIndex));
|
||||
|
||||
@@ -59,7 +59,7 @@ struct TbxFixture : public TbxCommandStreamFixture,
|
||||
|
||||
void SetUp() {
|
||||
DeviceFixture::SetUp();
|
||||
setMockAubCenter(pDevice->getExecutionEnvironment());
|
||||
setMockAubCenter(*pDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]);
|
||||
TbxCommandStreamFixture::SetUp(pDevice);
|
||||
MockAubCenterFixture::SetUp();
|
||||
}
|
||||
@@ -460,11 +460,11 @@ HWTEST_F(TbxCommandSteamSimpleTest, givenTbxCommandStreamReceiverWhenPhysicalAdd
|
||||
HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenItIsCreatedWithUseAubStreamFalseThenDontInitializeAubManager) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.UseAubStream.set(false);
|
||||
MockExecutionEnvironment executionEnvironment(platformDevices[0], false);
|
||||
MockExecutionEnvironment executionEnvironment(platformDevices[0], false, 1);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
auto tbxCsr = std::make_unique<TbxCommandStreamReceiverHw<FamilyType>>(executionEnvironment, 0);
|
||||
EXPECT_EQ(nullptr, executionEnvironment.rootDeviceEnvironments[0].aubCenter->getAubManager());
|
||||
EXPECT_EQ(nullptr, executionEnvironment.rootDeviceEnvironments[0]->aubCenter->getAubManager());
|
||||
}
|
||||
|
||||
HWTEST_F(TbxCommandStreamTests, givenTbxCommandStreamReceiverWhenFlushIsCalledThenItShouldCallTheExpectedHwContextFunctions) {
|
||||
@@ -559,7 +559,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenHardwareContextIsCreatedThenTbxSt
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter(pDevice->executionEnvironment->getHardwareInfo(), false, "", CommandStreamReceiverType::CSR_TBX);
|
||||
mockAubCenter->aubManager = std::unique_ptr<MockAubManager>(mockManager);
|
||||
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
auto tbxCsr = std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>>(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(
|
||||
TbxCommandStreamReceiverHw<FamilyType>::create("", false, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex())));
|
||||
|
||||
@@ -575,7 +575,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenOsContextIsSetThenCreateHardwareC
|
||||
MockAubCenter *mockAubCenter = new MockAubCenter(hwInfo, false, fileName, CommandStreamReceiverType::CSR_TBX);
|
||||
mockAubCenter->aubManager = std::unique_ptr<MockAubManager>(mockManager);
|
||||
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter = std::unique_ptr<MockAubCenter>(mockAubCenter);
|
||||
|
||||
std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>> tbxCsr(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(TbxCommandStreamReceiver::create(fileName, false, *pDevice->executionEnvironment, pDevice->getRootDeviceIndex())));
|
||||
EXPECT_EQ(nullptr, tbxCsr->hardwareContextController.get());
|
||||
@@ -598,12 +598,13 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpThenFileNameIsE
|
||||
executionEnvironment.setHwInfo(*platformDevices);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
setMockAubCenter(&executionEnvironment, CommandStreamReceiverType::CSR_TBX);
|
||||
auto rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment *>(executionEnvironment.rootDeviceEnvironments[0].get());
|
||||
setMockAubCenter(*rootDeviceEnvironment, CommandStreamReceiverType::CSR_TBX);
|
||||
|
||||
auto fullName = AUBCommandStreamReceiver::createFullFilePath(*platformDevices[0], "aubfile");
|
||||
|
||||
std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>> tbxCsr(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(TbxCommandStreamReceiver::create("aubfile", true, executionEnvironment, 0)));
|
||||
EXPECT_STREQ(fullName.c_str(), executionEnvironment.aubFileNameReceived.c_str());
|
||||
EXPECT_STREQ(fullName.c_str(), rootDeviceEnvironment->aubFileNameReceived.c_str());
|
||||
}
|
||||
|
||||
HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpThenOpenIsCalledOnAubManagerToOpenFileStream) {
|
||||
@@ -616,6 +617,24 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpThenOpenIsCalle
|
||||
EXPECT_TRUE(tbxCsrWithAubDump->aubManager->isOpen());
|
||||
}
|
||||
|
||||
using SimulatedCsrTest = ::testing::Test;
|
||||
HWTEST_F(SimulatedCsrTest, givenTbxCsrTypeWhenCreateCommandStreamReceiverThenProperAubCenterIsInitalized) {
|
||||
uint32_t expectedRootDeviceIndex = 10;
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
executionEnvironment.prepareRootDeviceEnvironments(expectedRootDeviceIndex + 2);
|
||||
|
||||
auto rootDeviceEnvironment = new MockRootDeviceEnvironment(executionEnvironment);
|
||||
executionEnvironment.rootDeviceEnvironments[expectedRootDeviceIndex].reset(rootDeviceEnvironment);
|
||||
|
||||
EXPECT_EQ(nullptr, executionEnvironment.rootDeviceEnvironments[expectedRootDeviceIndex]->aubCenter.get());
|
||||
EXPECT_FALSE(rootDeviceEnvironment->initAubCenterCalled);
|
||||
|
||||
auto csr = std::make_unique<TbxCommandStreamReceiverHw<FamilyType>>(executionEnvironment, expectedRootDeviceIndex);
|
||||
EXPECT_NE(nullptr, executionEnvironment.rootDeviceEnvironments[expectedRootDeviceIndex]->aubCenter.get());
|
||||
EXPECT_TRUE(rootDeviceEnvironment->initAubCenterCalled);
|
||||
}
|
||||
|
||||
HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpInSubCaptureModeThenCreateSubCaptureManagerAndGenerateSubCaptureFileName) {
|
||||
DebugManagerStateRestore dbgRestore;
|
||||
DebugManager.flags.AUBDumpSubCaptureMode.set(static_cast<int32_t>(AubSubCaptureManager::SubCaptureMode::Filter));
|
||||
@@ -636,7 +655,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpInSubCaptureMod
|
||||
}
|
||||
|
||||
HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpSeveralTimesThenOpenIsCalledOnAubManagerOnceOnly) {
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices, true);
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices, true, 1);
|
||||
executionEnvironment.setHwInfo(*platformDevices);
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
|
||||
@@ -646,7 +665,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrWhenCreatedWithAubDumpSeveralTimesThe
|
||||
auto tbxCsrWithAubDump2 = std::unique_ptr<TbxCommandStreamReceiverHw<FamilyType>>(reinterpret_cast<TbxCommandStreamReceiverHw<FamilyType> *>(
|
||||
TbxCommandStreamReceiverHw<FamilyType>::create("aubfile", true, executionEnvironment, 0)));
|
||||
|
||||
auto mockManager = reinterpret_cast<MockAubManager *>(executionEnvironment.rootDeviceEnvironments[0].aubCenter->getAubManager());
|
||||
auto mockManager = reinterpret_cast<MockAubManager *>(executionEnvironment.rootDeviceEnvironments[0]->aubCenter->getAubManager());
|
||||
EXPECT_EQ(1u, mockManager->openCalledCnt);
|
||||
}
|
||||
|
||||
@@ -667,7 +686,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndS
|
||||
|
||||
tbxCsr.flush(batchBuffer, allocationsForResidency);
|
||||
|
||||
auto mockAubManager = reinterpret_cast<MockAubManager *>(pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter->getAubManager());
|
||||
auto mockAubManager = reinterpret_cast<MockAubManager *>(pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getAubManager());
|
||||
EXPECT_TRUE(mockAubManager->isPaused);
|
||||
|
||||
pDevice->executionEnvironment->memoryManager->freeGraphicsMemory(commandBuffer);
|
||||
@@ -691,7 +710,7 @@ HWTEST_F(TbxCommandStreamTests, givenTbxCsrInSubCaptureModeWhenFlushIsCalledAndS
|
||||
|
||||
tbxCsr.flush(batchBuffer, allocationsForResidency);
|
||||
|
||||
auto mockAubManager = reinterpret_cast<MockAubManager *>(pDevice->executionEnvironment->rootDeviceEnvironments[0].aubCenter->getAubManager());
|
||||
auto mockAubManager = reinterpret_cast<MockAubManager *>(pDevice->executionEnvironment->rootDeviceEnvironments[0]->aubCenter->getAubManager());
|
||||
EXPECT_FALSE(mockAubManager->isPaused);
|
||||
|
||||
pDevice->executionEnvironment->memoryManager->freeGraphicsMemory(commandBuffer);
|
||||
|
||||
Reference in New Issue
Block a user