Adjust GmmHelper to be HW aware

Related-To: NEO-6523
Signed-off-by: Krzysztof Gibala <krzysztof.gibala@intel.com>
This commit is contained in:
Krzysztof Gibala
2022-06-08 08:23:02 +00:00
committed by Compute-Runtime-Automation
parent 6d43e96dee
commit c229ace4df
77 changed files with 264 additions and 31 deletions

View File

@@ -354,6 +354,7 @@ TEST(DrmBufferObject, givenDrmIoctlReturnsErrorNotSupportedThenBufferObjectRetur
executionEnvironment->setDebuggingEnabled();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
@@ -380,6 +381,7 @@ TEST(DrmBufferObject, givenPerContextVmRequiredWhenBoBoundAndUnboundThenCorrectB
executionEnvironment->setDebuggingEnabled();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
@@ -422,6 +424,7 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindSucceedsThenPr
executionEnvironment->setDebuggingEnabled();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
@@ -474,6 +477,7 @@ TEST(DrmBufferObject, givenPrintBOBindingResultWhenBOBindAndUnbindFailsThenPrint
executionEnvironment->setDebuggingEnabled();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
@@ -564,9 +568,9 @@ TEST_F(DrmBufferObjectTest, givenAsyncDebugFlagWhenFillingExecObjectThenFlagIsSe
}
TEST_F(DrmBufferObjectTest, given47bitAddressWhenSetThenIsAddressNotCanonized) {
VariableBackup<uint32_t> backup(&MockGmmHelper::addressWidth, 48);
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper()->setAddressWidth(48);
DrmMock drm(*(executionEnvironment.rootDeviceEnvironments[0].get()));
uint64_t address = maxNBitValue(47) - maxNBitValue(5);
@@ -576,11 +580,12 @@ TEST_F(DrmBufferObjectTest, given47bitAddressWhenSetThenIsAddressNotCanonized) {
auto boAddress = bo.peekAddress();
EXPECT_EQ(boAddress, address);
}
TEST_F(DrmBufferObjectTest, given48bitAddressWhenSetThenAddressIsCanonized) {
MockExecutionEnvironment executionEnvironment(defaultHwInfo.get());
DrmMock drm(*(executionEnvironment.rootDeviceEnvironments[0].get()));
executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper()->setAddressWidth(48);
VariableBackup<uint32_t> backup(&MockGmmHelper::addressWidth, 48);
DrmMock drm(*(executionEnvironment.rootDeviceEnvironments[0].get()));
uint64_t address = maxNBitValue(48) - maxNBitValue(5);
uint64_t expectedAddress = std::numeric_limits<uint64_t>::max() - maxNBitValue(5);

View File

@@ -82,10 +82,10 @@ HWTEST_F(DrmCommandStreamMMTest, givenExecutionEnvironmentWithMoreThanOneRootDev
for (uint32_t rootDeviceIndex = 0; rootDeviceIndex < executionEnvironment.rootDeviceEnvironments.size(); rootDeviceIndex++) {
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get());
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->osInterface = std::make_unique<OSInterface>();
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->initGmm();
auto drm = new DrmMockCustom(*executionEnvironment.rootDeviceEnvironments[0]);
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->osInterface->setDriverModel(std::unique_ptr<DriverModel>(drm));
executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = DrmMemoryOperationsHandler::create(*drm, 0u);
executionEnvironment.rootDeviceEnvironments[0]->initGmm();
}
auto memoryManager = new TestedDrmMemoryManager(false, true, false, executionEnvironment);

View File

@@ -396,6 +396,7 @@ struct DrmImplicitScalingCommandStreamTest : ::testing::Test {
hwInfo->gtSystemInfo.MultiTileArchInfo.IsValid = true;
hwInfo->gtSystemInfo.MultiTileArchInfo.TileCount = 0b11;
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(hwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
constexpr int mockFd = 33;
drm = new DrmMock(mockFd, *executionEnvironment->rootDeviceEnvironments[0]);

View File

@@ -198,6 +198,7 @@ TEST(DrmPrelimTest, givenContextDebugAvailableWhenCheckedForSupportThenTrueIsRet
executionEnvironment->setDebuggingEnabled();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
@@ -221,6 +222,7 @@ TEST(DrmPrelimTest, givenContextDebugNotAvailableWhenCheckedForSupportThenTrueIs
executionEnvironment->setDebuggingEnabled();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
@@ -315,6 +317,7 @@ TEST(DrmPrelimTest, givenProgramDebuggingAndContextDebugAvailableAndCCSEnginesWh
executionEnvironment->setDebuggingEnabled();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
@@ -336,6 +339,7 @@ TEST(DrmPrelimTest, givenProgramDebuggingAndContextDebugAvailableAndCCSEnginesWh
executionEnvironment->setDebuggingEnabled();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();

View File

@@ -25,6 +25,8 @@ TEST(DrmTest, givenEngineQuerySupportedWhenQueryingEngineInfoThenEngineInfoIsIni
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
auto hwInfo = drm->rootDeviceEnvironment.getHardwareInfo();
ASSERT_NE(nullptr, drm);
@@ -68,6 +70,8 @@ TEST(DrmTest, givenEngineQueryNotSupportedWhenQueryingEngineInfoThenFailGraceful
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm);
drm->i915QuerySuccessCount = 0;
@@ -80,6 +84,8 @@ TEST(DrmTest, givenMemRegionQueryNotSupportedWhenQueryingMemRegionInfoThenFailGr
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm);
drm->i915QuerySuccessCount = 1;
@@ -92,6 +98,8 @@ TEST(DrmTest, givenDistanceQueryNotSupportedWhenQueryingDistanceInfoThenFailGrac
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm);
drm->i915QuerySuccessCount = 2;
@@ -111,6 +119,8 @@ TEST(DrmTest, givenDistanceQueryFailsWhenQueryingDistanceInfoThenFailGracefully)
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm);
drm->context.failDistanceInfoQuery = true;
@@ -156,6 +166,8 @@ TEST(DrmTest, givenRcsEngineWhenBindingDrmContextThenContextParamEngineIsSet) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
auto hwInfo = drm->rootDeviceEnvironment.getHardwareInfo();
@@ -194,6 +206,8 @@ HWCMDTEST_F(IGFX_XE_HP_CORE, DrmTestXeHPAndLater, givenBcsEngineWhenBindingDrmCo
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
givenEngineTypeWhenBindingDrmContextThenContextParamEngineIsSet(drm, aub_stream::ENGINE_BCS, I915_ENGINE_CLASS_COPY);
auto hwInfo = drm->rootDeviceEnvironment.getHardwareInfo();
@@ -456,6 +470,8 @@ TEST(DrmTest, givenOneCcsEngineWhenBindingDrmContextThenContextParamEngineIsSet)
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
givenEngineTypeWhenBindingDrmContextThenContextParamEngineIsSet(drm, aub_stream::ENGINE_CCS, DrmPrelimHelper::getComputeEngineClass());
}
@@ -465,6 +481,8 @@ TEST(DrmTest, givenVirtualEnginesEnabledWhenCreatingContextThenEnableLoadBalanci
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
auto &ccsInfo = drm->rootDeviceEnvironment.getMutableHardwareInfo()->gtSystemInfo.CCSInfo;
ccsInfo.IsValid = true;
@@ -507,6 +525,8 @@ TEST(DrmTest, givenVirtualEnginesEnabledWhenCreatingContextThenEnableLoadBalanci
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
auto &ccsInfo = drm->rootDeviceEnvironment.getMutableHardwareInfo()->gtSystemInfo.CCSInfo;
ccsInfo.IsValid = true;
@@ -546,6 +566,8 @@ TEST(DrmTest, givenDisabledCcsSupportWhenQueryingThenResetHwInfoParams) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
drm->context.disableCcsSupport = true;
@@ -573,6 +595,8 @@ TEST(DrmTest, givenVirtualEnginesDisabledWhenCreatingContextThenDontEnableLoadBa
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
auto &ccsInfo = drm->rootDeviceEnvironment.getMutableHardwareInfo()->gtSystemInfo.CCSInfo;
ccsInfo.IsValid = true;
@@ -604,6 +628,8 @@ TEST(DrmTest, givenEngineInstancedDeviceWhenCreatingContextThenDontUseVirtualEng
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
auto &ccsInfo = drm->rootDeviceEnvironment.getMutableHardwareInfo()->gtSystemInfo.CCSInfo;
ccsInfo.IsValid = true;
@@ -635,6 +661,8 @@ TEST(DrmTest, givenVirtualEnginesEnabledAndNotEnoughCcsEnginesWhenCreatingContex
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
auto &ccsInfo = drm->rootDeviceEnvironment.getMutableHardwareInfo()->gtSystemInfo.CCSInfo;
ccsInfo.IsValid = true;
@@ -663,6 +691,8 @@ TEST(DrmTest, givenVirtualEnginesEnabledAndNonCcsEnginesWhenCreatingContextThenD
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
drm->rootDeviceEnvironment.getMutableHardwareInfo()->featureTable.ftrBcsInfo = 1;
@@ -688,6 +718,8 @@ TEST(DrmTest, givenInvalidTileWhenBindingDrmContextThenErrorIsReturned) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm);
@@ -707,6 +739,8 @@ TEST(DrmTest, givenInvalidEngineTypeWhenBindingDrmContextThenExceptionIsThrown)
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm);
@@ -725,6 +759,8 @@ TEST(DrmTest, givenSetParamEnginesFailsWhenBindingDrmContextThenCallUnrecoverabl
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm);
@@ -746,6 +782,8 @@ TEST(DrmTest, whenQueryingEngineInfoThenMultiTileArchInfoIsUnchanged) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm);
@@ -764,6 +802,8 @@ TEST(DrmTest, givenNewMemoryInfoQuerySupportedWhenQueryingEngineInfoThenEngineIn
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm);

View File

@@ -20,6 +20,7 @@ TEST(MemoryInfoPrelim, givenMemoryRegionQueryNotSupportedWhenQueryingMemoryInfoT
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm);
@@ -36,6 +37,7 @@ TEST(MemoryInfoPrelim, givenMemoryRegionQueryWhenQueryingFailsThenMemoryInfoIsNo
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm);
@@ -66,6 +68,7 @@ TEST(MemoryInfoPrelim, givenNewMemoryInfoQuerySupportedWhenQueryingMemoryInfoThe
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
auto drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_NE(nullptr, drm);
@@ -87,7 +90,6 @@ struct DrmVmTestFixture {
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(NEO::defaultHwInfo.get());
testHwInfo = executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo();
testHwInfo->gtSystemInfo.MultiTileArchInfo.IsValid = true;
testHwInfo->gtSystemInfo.MultiTileArchInfo.TileCount = tileCount;
testHwInfo->gtSystemInfo.MultiTileArchInfo.Tile0 =
@@ -95,6 +97,7 @@ struct DrmVmTestFixture {
testHwInfo->gtSystemInfo.MultiTileArchInfo.Tile2 =
testHwInfo->gtSystemInfo.MultiTileArchInfo.Tile3 = 1;
testHwInfo->gtSystemInfo.MultiTileArchInfo.TileMask = 0b1111;
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
drm = std::make_unique<DrmQueryMock>(*executionEnvironment->rootDeviceEnvironments[0], testHwInfo);
ASSERT_NE(nullptr, drm);
@@ -182,6 +185,8 @@ struct MultiTileMemoryInfoFixture : public ::testing::Test {
executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
pHwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
}

View File

@@ -88,6 +88,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenMultiRootDeviceEnvironmentAnd
executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber);
for (uint32_t i = 0; i < rootDevicesNumber; i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
auto mock = new DrmQueryMock(*executionEnvironment->rootDeviceEnvironments[i]);
std::vector<MemoryRegion> regionInfo(2);
@@ -137,6 +138,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenMultiRootDeviceEnvironmentAnd
executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber);
for (uint32_t i = 0; i < rootDevicesNumber; i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
auto mock = new DrmQueryMock(*executionEnvironment->rootDeviceEnvironments[i]);
std::vector<MemoryRegion> regionInfo(2);
@@ -176,6 +178,7 @@ TEST_F(DrmMemoryManagerUsmSharedHandlePrelimTest, givenMultiRootDeviceEnvironmen
executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber);
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]->initGmm();
auto mock = new DrmQueryMock(*executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]);
std::vector<MemoryRegion> regionInfo(2);
@@ -210,6 +213,7 @@ TEST_F(DrmMemoryManagerLocalMemoryPrelimTest, givenMultiRootDeviceEnvironmentAnd
executionEnvironment->prepareRootDeviceEnvironments(rootDevicesNumber);
for (uint32_t i = 0; i < rootDevicesNumber; i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
auto mock = new DrmQueryMock(*executionEnvironment->rootDeviceEnvironments[i]);
mock->memoryInfo.reset(nullptr);
@@ -2032,6 +2036,8 @@ TEST(AllocationInfoLogging, givenDrmGraphicsAllocationWithMultipleBOsWhenGetting
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
DrmQueryMock drm{*executionEnvironment->rootDeviceEnvironments[0]};
BufferObject bo0(&drm, 3, 0, 0, 1), bo1(&drm, 3, 1, 0, 1),
bo2(&drm, 3, 2, 0, 1), bo3(&drm, 3, 3, 0, 1);

View File

@@ -61,6 +61,7 @@ struct DrmMemoryOperationsHandlerBindFixture : public ::testing::Test {
executionEnvironment->prepareRootDeviceEnvironments(numRootDevices);
for (uint32_t i = 0u; i < numRootDevices; i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
}
executionEnvironment->calculateMaxOsContextCount();
for (uint32_t i = 0u; i < numRootDevices; i++) {

View File

@@ -59,6 +59,8 @@ TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoFalseThenSystem
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
DrmMockToQuerySystemInfo drm(*executionEnvironment->rootDeviceEnvironments[0]);
HardwareInfo hwInfo = *defaultHwInfo;
@@ -126,6 +128,8 @@ TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoFailsThenSystem
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
DrmMockEngine drm(*executionEnvironment->rootDeviceEnvironments[0]);
HardwareInfo hwInfo = *defaultHwInfo;
@@ -147,6 +151,8 @@ TEST(DrmSystemInfoTest, givenSetupHardwareInfoWhenQuerySystemInfoSucceedsThenSys
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
DrmMockEngine drm(*executionEnvironment->rootDeviceEnvironments[0]);
HardwareInfo hwInfo = *defaultHwInfo;

View File

@@ -184,6 +184,7 @@ TEST(DrmTest, givenDrmWhenOsContextIsCreatedThenCreateAndDestroyNewDrmOsContext)
executionEnvironment->prepareRootDeviceEnvironments(1);
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
{
OsContextLinux osContext1(drmMock, 0u, EngineDescriptorHelper::getDefaultDescriptor());
@@ -209,6 +210,8 @@ TEST(DrmTest, whenCreatingDrmContextWithVirtualMemoryAddressSpaceThenProperVmIdI
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
ASSERT_EQ(1u, drmMock.virtualMemoryIds.size());
@@ -223,6 +226,8 @@ TEST(DrmTest, whenCreatingDrmContextWithNoVirtualMemoryAddressSpaceThenProperCon
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
drmMock.destroyVirtualMemoryAddressSpace();
@@ -238,6 +243,8 @@ TEST(DrmTest, givenDrmAndNegativeCheckNonPersistentContextsSupportWhenOsContextI
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
auto expectedCount = 0u;
@@ -264,6 +271,8 @@ TEST(DrmTest, givenDrmPreemptionEnabledAndLowPriorityEngineWhenCreatingOsContext
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
drmMock.preemptionSupported = false;
@@ -474,6 +483,8 @@ TEST(DrmTest, givenDrmWhenCreatingOsContextThenCreateDrmContextWithVmId) {
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
OsContextLinux osContext(drmMock, 0u, EngineDescriptorHelper::getDefaultDescriptor());
osContext.ensureContextInitialized();
@@ -574,6 +585,8 @@ TEST(DrmTest, givenNoPerContextVmsDrmWhenCreatingOsContextsThenVmIdIsNotQueriedA
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
DrmMock drmMock(*executionEnvironment->rootDeviceEnvironments[0]);
EXPECT_FALSE(drmMock.requirePerContextVM);
@@ -592,6 +605,7 @@ TEST(DrmTest, givenProgramDebuggingAndContextDebugAvailableWhenCreatingContextTh
executionEnvironment->setDebuggingEnabled();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
@@ -611,6 +625,7 @@ TEST(DrmTest, givenProgramDebuggingAndContextDebugAvailableWhenCreatingContextFo
executionEnvironment->setDebuggingEnabled();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
@@ -627,6 +642,7 @@ TEST(DrmTest, givenNotEnabledDebuggingOrContextDebugUnsupportedWhenCreatingConte
auto executionEnvironment = std::make_unique<ExecutionEnvironment>();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
@@ -704,6 +720,7 @@ TEST(DrmTest, givenProgramDebuggingWhenCreatingContextThenUnrecoverableContextIs
executionEnvironment->setDebuggingEnabled();
executionEnvironment->prepareRootDeviceEnvironments(1);
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
executionEnvironment->calculateMaxOsContextCount();
executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique<OSInterface>();
@@ -1042,6 +1059,7 @@ TEST(DrmTest, GivenCompletionFenceDebugFlagWhenCreatingDrmObjectThenExpectCorrec
executionEnvironment->prepareRootDeviceEnvironments(1);
HardwareInfo *hwInfo = defaultHwInfo.get();
executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(hwInfo);
executionEnvironment->rootDeviceEnvironments[0]->initGmm();
DrmMock drmDefault{*executionEnvironment->rootDeviceEnvironments[0]};
drmDefault.callBaseIsVmBindAvailable = true;

View File

@@ -26,6 +26,7 @@ struct MultipleDeviceUuidTest : public ::testing::Test {
executionEnvironment->prepareRootDeviceEnvironments(numRootDevices);
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get());
executionEnvironment->rootDeviceEnvironments[i]->initGmm();
}
deviceFactory = std::make_unique<UltDeviceFactory>(numRootDevices, numSubDevices, *executionEnvironment);
@@ -694,4 +695,4 @@ TEST(PmtUtilTest, givenDataPtrIsNullWhenPmtUtilReadTelemIsCalledThenVerifyZeroIs
});
EXPECT_TRUE(0 == PmtUtil::readTelem("dummy", 16, 0, nullptr));
}
}