Store default engine index per root device

Resolves: NEO-5768
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2021-04-20 12:24:04 +00:00
committed by Compute-Runtime-Automation
parent 8da0838ba4
commit 9a22d06efe
7 changed files with 27 additions and 20 deletions

View File

@@ -192,9 +192,10 @@ HWTEST_F(DeviceTest, givenNoHwCsrTypeAndModifiedDefaultEngineIndexWhenIsSimulati
HWTEST_F(DeviceTest, givenDeviceWithoutSubDevicesWhenCreatingContextsThenMemoryManagerDefaultContextIsSetCorrectly) {
UltDeviceFactory factory(1, 1);
MockDevice &device = *factory.rootDevices[0];
auto rootDeviceIndex = device.getRootDeviceIndex();
MockMemoryManager *memoryManager = static_cast<MockMemoryManager *>(device.getMemoryManager());
OsContext *defaultOsContextMemoryManager = memoryManager->registeredEngines[memoryManager->defaultEngineIndex].osContext;
OsContext *defaultOsContextMemoryManager = memoryManager->registeredEngines[memoryManager->defaultEngineIndex[rootDeviceIndex]].osContext;
OsContext *defaultOsContextRootDevice = device.getDefaultEngine().osContext;
EXPECT_EQ(defaultOsContextRootDevice, defaultOsContextMemoryManager);
}
@@ -202,9 +203,10 @@ HWTEST_F(DeviceTest, givenDeviceWithoutSubDevicesWhenCreatingContextsThenMemoryM
HWTEST_F(DeviceTest, givenDeviceWithSubDevicesWhenCreatingContextsThenMemoryManagerDefaultContextIsSetCorrectly) {
UltDeviceFactory factory(1, 2);
MockDevice &device = *factory.rootDevices[0];
auto rootDeviceIndex = device.getRootDeviceIndex();
MockMemoryManager *memoryManager = static_cast<MockMemoryManager *>(device.getMemoryManager());
OsContext *defaultOsContextMemoryManager = memoryManager->registeredEngines[memoryManager->defaultEngineIndex].osContext;
OsContext *defaultOsContextMemoryManager = memoryManager->registeredEngines[memoryManager->defaultEngineIndex[rootDeviceIndex]].osContext;
OsContext *defaultOsContextRootDevice = device.getDefaultEngine().osContext;
EXPECT_EQ(defaultOsContextRootDevice, defaultOsContextMemoryManager);
}
@@ -214,9 +216,11 @@ HWTEST_F(DeviceTest, givenMultiDeviceWhenCreatingContextsThenMemoryManagerDefaul
MockDevice &device = *factory.rootDevices[2];
MockMemoryManager *memoryManager = static_cast<MockMemoryManager *>(device.getMemoryManager());
OsContext *defaultOsContextMemoryManager = memoryManager->registeredEngines[memoryManager->defaultEngineIndex].osContext;
OsContext *defaultOsContextRootDevice = device.getDefaultEngine().osContext;
EXPECT_EQ(defaultOsContextRootDevice, defaultOsContextMemoryManager);
for (auto &pRootDevice : factory.rootDevices) {
OsContext *defaultOsContextMemoryManager = memoryManager->registeredEngines[memoryManager->defaultEngineIndex[pRootDevice->getRootDeviceIndex()]].osContext;
OsContext *defaultOsContextRootDevice = pRootDevice->getDefaultEngine().osContext;
EXPECT_EQ(defaultOsContextRootDevice, defaultOsContextMemoryManager);
}
}
TEST(DeviceCleanup, givenDeviceWhenItIsDestroyedThenFlushBatchedSubmissionsIsCalled) {

View File

@@ -380,7 +380,7 @@ TEST_F(DrmMemoryManagerTest, givenDrmContextIdWhenAllocationIsCreatedThenPinWith
for (auto engine : memoryManager->registeredEngines) {
engine.osContext->incRefInternal();
}
auto drmContextId = memoryManager->getDefaultDrmContextId();
auto drmContextId = memoryManager->getDefaultDrmContextId(rootDeviceIndex);
ASSERT_NE(nullptr, memoryManager->pinBBs[rootDeviceIndex]);
EXPECT_NE(0u, drmContextId);