Disallow creating unsupported devices

Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
Bartosz Dunajski
2021-07-01 14:28:56 +00:00
committed by Compute-Runtime-Automation
parent 2acc0fb3f6
commit 8f21e46302
4 changed files with 93 additions and 4 deletions

View File

@ -299,3 +299,4 @@ EnableUserFenceUseCtxId = -1
EnableResourceTags = 0
SetKmdWaitTimeout = -1
OverrideNotifyEnableForTagUpdatePostSync = -1
Force32BitDriverSupport = -1

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019-2020 Intel Corporation
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
@ -7,12 +7,18 @@
#include "shared/source/execution_environment/execution_environment.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/os_interface/hw_info_config.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
#include "shared/test/common/test_macros/test_checks_shared.h"
#include "test.h"
using namespace NEO;
namespace NEO {
bool prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment);
using PrepareDeviceEnvironmentsTests = ::testing::Test;
@ -35,3 +41,50 @@ HWTEST_F(PrepareDeviceEnvironmentsTests, whenPrepareDeviceEnvironmentsIsCalledTh
EXPECT_TRUE(returnValue);
EXPECT_NE(nullptr, executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper());
}
HWTEST_F(PrepareDeviceEnvironmentsTests, Given32bitApplicationWhenPrepareDeviceEnvironmentsIsCalledThenFalseIsReturned) {
REQUIRE_32BIT_OR_SKIP();
DebugManagerStateRestore restore;
DebugManager.flags.NodeOrdinal.set(0); // Dont disable RCS
NEO::ExecutionEnvironment executionEnviornment;
auto returnValue = NEO::prepareDeviceEnvironments(executionEnviornment);
switch (::productFamily) {
case IGFX_UNKNOWN:
#ifdef SUPPORT_XEHP
case IGFX_XE_HP_SDV:
#endif
EXPECT_FALSE(returnValue);
break;
default:
EXPECT_TRUE(returnValue);
break;
}
}
HWTEST_F(PrepareDeviceEnvironmentsTests, givenRcsAndCcsNotSupportedWhenInitializingThenReturnFalse) {
REQUIRE_64BIT_OR_SKIP();
NEO::ExecutionEnvironment executionEnviornment;
HardwareInfo hwInfo = *defaultHwInfo;
auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily);
hwInfoConfig->configureHardwareCustom(&hwInfo, nullptr);
bool expectedValue = false;
if (hwInfo.featureTable.ftrRcsNode || hwInfo.featureTable.ftrCCSNode) {
expectedValue = true;
}
EXPECT_EQ(expectedValue, NEO::prepareDeviceEnvironments(executionEnviornment));
}
HWTEST_F(PrepareDeviceEnvironmentsTests, Given32bitApplicationWhenDebugKeyIsSetThenSupportIsReported) {
NEO::ExecutionEnvironment executionEnviornment;
DebugManagerStateRestore restorer;
DebugManager.flags.Force32BitDriverSupport.set(true);
EXPECT_TRUE(NEO::prepareDeviceEnvironments(executionEnviornment));
}
} // namespace NEO