Disallow creating unsupported devices
Signed-off-by: Bartosz Dunajski <bartosz.dunajski@intel.com>
This commit is contained in:
parent
2acc0fb3f6
commit
8f21e46302
|
@ -1,11 +1,13 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019-2020 Intel Corporation
|
* Copyright (C) 2019-2021 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "shared/source/execution_environment/execution_environment.h"
|
#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/os_interface/device_factory.h"
|
#include "shared/source/os_interface/device_factory.h"
|
||||||
|
|
||||||
#include "opencl/source/command_stream/create_command_stream_impl.h"
|
#include "opencl/source/command_stream/create_command_stream_impl.h"
|
||||||
|
@ -13,7 +15,39 @@
|
||||||
namespace NEO {
|
namespace NEO {
|
||||||
|
|
||||||
bool prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment) {
|
bool prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment) {
|
||||||
return prepareDeviceEnvironmentsImpl(executionEnvironment);
|
auto returnValue = prepareDeviceEnvironmentsImpl(executionEnvironment);
|
||||||
|
|
||||||
|
if (DebugManager.flags.Force32BitDriverSupport.get() != -1) {
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (returnValue) {
|
||||||
|
auto i = 0u;
|
||||||
|
while (i < executionEnvironment.rootDeviceEnvironments.size()) {
|
||||||
|
bool unsupportedDeviceDetected = false;
|
||||||
|
|
||||||
|
auto &featureTable = executionEnvironment.rootDeviceEnvironments[i]->getHardwareInfo()->featureTable;
|
||||||
|
if (!featureTable.ftrRcsNode && !featureTable.ftrCCSNode) {
|
||||||
|
unsupportedDeviceDetected = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is32bit) {
|
||||||
|
#ifdef SUPPORT_XEHP
|
||||||
|
if (executionEnvironment.rootDeviceEnvironments[i]->getHardwareInfo()->platform.eProductFamily == IGFX_XE_HP_SDV) {
|
||||||
|
unsupportedDeviceDetected = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unsupportedDeviceDetected) {
|
||||||
|
executionEnvironment.rootDeviceEnvironments.erase(executionEnvironment.rootDeviceEnvironments.begin() + i);
|
||||||
|
} else {
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnValue && executionEnvironment.rootDeviceEnvironments.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace NEO
|
} // namespace NEO
|
||||||
|
|
|
@ -299,3 +299,4 @@ EnableUserFenceUseCtxId = -1
|
||||||
EnableResourceTags = 0
|
EnableResourceTags = 0
|
||||||
SetKmdWaitTimeout = -1
|
SetKmdWaitTimeout = -1
|
||||||
OverrideNotifyEnableForTagUpdatePostSync = -1
|
OverrideNotifyEnableForTagUpdatePostSync = -1
|
||||||
|
Force32BitDriverSupport = -1
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019-2020 Intel Corporation
|
* Copyright (C) 2019-2021 Intel Corporation
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*
|
*
|
||||||
|
@ -7,12 +7,18 @@
|
||||||
|
|
||||||
#include "shared/source/execution_environment/execution_environment.h"
|
#include "shared/source/execution_environment/execution_environment.h"
|
||||||
#include "shared/source/execution_environment/root_device_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/helpers/hw_info.h"
|
||||||
#include "shared/source/os_interface/device_factory.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"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace NEO;
|
namespace NEO {
|
||||||
|
bool prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment);
|
||||||
|
|
||||||
using PrepareDeviceEnvironmentsTests = ::testing::Test;
|
using PrepareDeviceEnvironmentsTests = ::testing::Test;
|
||||||
|
|
||||||
|
@ -35,3 +41,50 @@ HWTEST_F(PrepareDeviceEnvironmentsTests, whenPrepareDeviceEnvironmentsIsCalledTh
|
||||||
EXPECT_TRUE(returnValue);
|
EXPECT_TRUE(returnValue);
|
||||||
EXPECT_NE(nullptr, executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper());
|
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
|
|
@ -282,6 +282,7 @@ DECLARE_DEBUG_VARIABLE(int32_t, EnableUserFenceForCompletionWait, -1, "-1: defau
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, EnableUserFenceUseCtxId, -1, "-1: default (enabled), 0: disable, 1: enable : Use Context Id in Wait User Fence when waiting for completion tag")
|
DECLARE_DEBUG_VARIABLE(int32_t, EnableUserFenceUseCtxId, -1, "-1: default (enabled), 0: disable, 1: enable : Use Context Id in Wait User Fence when waiting for completion tag")
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, SetKmdWaitTimeout, -1, "-1: default (infinity), >0: amount of time units for wait function timeout")
|
DECLARE_DEBUG_VARIABLE(int32_t, SetKmdWaitTimeout, -1, "-1: default (infinity), >0: amount of time units for wait function timeout")
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, OverrideNotifyEnableForTagUpdatePostSync, -1, "-1: default (usage determined by user fence wait call), 0: disable use of NotifyEnable flag, 1: enable use NotifyEnable flag")
|
DECLARE_DEBUG_VARIABLE(int32_t, OverrideNotifyEnableForTagUpdatePostSync, -1, "-1: default (usage determined by user fence wait call), 0: disable use of NotifyEnable flag, 1: enable use NotifyEnable flag")
|
||||||
|
DECLARE_DEBUG_VARIABLE(int32_t, Force32BitDriverSupport, -1, "-1: default, 0: disable, 1: enable, Forces the driver to support 32 bit.")
|
||||||
|
|
||||||
/*EXPERIMENTAL TOGGLES*/
|
/*EXPERIMENTAL TOGGLES*/
|
||||||
DECLARE_DEBUG_VARIABLE(int32_t, ExperimentalEnableCustomLocalMemoryAlignment, 0, "Align local memory allocations to a given value. Works only with allocations at least as big as the value. 0: no effect, 2097152: 2 megabytes, 1073741824: 1 gigabyte")
|
DECLARE_DEBUG_VARIABLE(int32_t, ExperimentalEnableCustomLocalMemoryAlignment, 0, "Align local memory allocations to a given value. Works only with allocations at least as big as the value. 0: no effect, 2097152: 2 megabytes, 1073741824: 1 gigabyte")
|
||||||
|
|
Loading…
Reference in New Issue