mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Clarify meaning of ForceDeviceId debug flag
this flag can be used only to override device id in AUB/TBX mode Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
eea582355d
commit
99d63facb5
@ -115,29 +115,6 @@ TEST_F(DrmSimpleTests, GivenTwoOpenableDevicesWhenDiscoverDevicesThenCreateTwoHw
|
||||
EXPECT_EQ(2u, hwDeviceIds.size());
|
||||
}
|
||||
|
||||
TEST_F(DrmSimpleTests, GivenSelectedNotExistingDeviceUsingForceDeviceIdFlagWhenGetDeviceFdThenFail) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.ForceDeviceId.set("invalid");
|
||||
openFull = nullptr; // open shouldn't be called
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
auto hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
|
||||
EXPECT_TRUE(hwDeviceIds.empty());
|
||||
}
|
||||
|
||||
TEST_F(DrmSimpleTests, GivenSelectedExistingDeviceUsingForceDeviceIdFlagWhenGetDeviceFdThenReturnFd) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.ForceDeviceId.set("0000:00:02.0");
|
||||
VariableBackup<decltype(openFull)> backupOpenFull(&openFull);
|
||||
openFull = openWithCounter;
|
||||
openCounter = 10;
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
auto hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
|
||||
EXPECT_EQ(1u, hwDeviceIds.size());
|
||||
EXPECT_NE(nullptr, hwDeviceIds[0].get());
|
||||
EXPECT_STREQ("/dev/dri/by-path/platform-4010000000.pcie-pci-0000:00:02.0-render", lastOpenedPath.c_str());
|
||||
EXPECT_EQ(9, openCounter); // only one opened file
|
||||
}
|
||||
|
||||
TEST_F(DrmSimpleTests, GivenSelectedNotExistingDeviceUsingFilterBdfWhenGetDeviceFdThenFail) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.FilterBdfPath.set("invalid");
|
||||
|
@ -368,23 +368,6 @@ TEST(DeviceFactory, givenNonHwModeSelectedWhenIsHwModeSelectedIsCalledThenFalseI
|
||||
}
|
||||
}
|
||||
|
||||
TEST(DiscoverDevices, whenDiscoverDevicesAndForceDeviceIdIsDifferentFromTheExistingDeviceThenReturnNullptr) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.ForceDeviceId.set("invalid");
|
||||
ExecutionEnvironment executionEnviornment;
|
||||
auto hwDeviceIds = OSInterface::discoverDevices(executionEnviornment);
|
||||
EXPECT_TRUE(hwDeviceIds.empty());
|
||||
}
|
||||
|
||||
TEST(DiscoverDevices, whenDiscoverDevicesAndForceDeviceIdIsDifferentFromTheExistingDeviceThenPrepareDeviceEnvironmentsReturnsFalse) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.ForceDeviceId.set("invalid");
|
||||
ExecutionEnvironment executionEnviornment;
|
||||
|
||||
auto result = DeviceFactory::prepareDeviceEnvironments(executionEnviornment);
|
||||
EXPECT_FALSE(result);
|
||||
}
|
||||
|
||||
TEST(DiscoverDevices, whenDiscoverDevicesAndFilterDifferentFromTheExistingDeviceThenReturnNullptr) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.FilterDeviceId.set("invalid");
|
||||
|
@ -1383,15 +1383,6 @@ TEST_F(Wddm20Tests, givenWddmWhenDiscoverDevicesAndFilterDeviceIdIsTheSameAsTheE
|
||||
EXPECT_NE(nullptr, hwDeviceIds[0].get());
|
||||
}
|
||||
|
||||
TEST_F(Wddm20Tests, givenWddmWhenDiscoverDevicesAndForceDeviceIdIsTheSameAsTheExistingDeviceThenReturnTheAdapter) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.ForceDeviceId.set("1234"); // Existing device Id
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
auto hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
|
||||
EXPECT_EQ(1u, hwDeviceIds.size());
|
||||
EXPECT_NE(nullptr, hwDeviceIds[0].get());
|
||||
}
|
||||
|
||||
TEST_F(WddmTest, WhenFeatureFlagHwQueueIsDisabledThenReturnWddm20Version) {
|
||||
wddm->featureTable->flags.ftrWddmHwQueues = 0;
|
||||
EXPECT_EQ(WddmVersion::WDDM_2_0, wddm->getWddmVersion());
|
||||
|
@ -79,7 +79,7 @@ DECLARE_DEBUG_VARIABLE(bool, DisableForceToStateless, false, "If platform requir
|
||||
DECLARE_DEBUG_VARIABLE(bool, DebuggerDisableSingleAddressSbaTracking, false, "Disable SBA Tracking command programming in single address space mode")
|
||||
DECLARE_DEBUG_VARIABLE(bool, ForceTheoreticalMaxWorkGroupCount, false, "Do not apply any limitation to max cooperative/concurrent work-group count queries")
|
||||
DECLARE_DEBUG_VARIABLE(bool, DisableScratchPages, false, "Disable scratch pages during VM creations")
|
||||
DECLARE_DEBUG_VARIABLE(std::string, ForceDeviceId, std::string("unk"), "DeviceId selected for testing")
|
||||
DECLARE_DEBUG_VARIABLE(std::string, ForceDeviceId, std::string("unk"), "Override device id in AUB/TBX mode")
|
||||
DECLARE_DEBUG_VARIABLE(std::string, FilterDeviceId, std::string("unk"), "Device id filter, adapter matching device id will be opened. Ignored when unk.")
|
||||
DECLARE_DEBUG_VARIABLE(std::string, FilterBdfPath, std::string("unk"), "Linux-only, BDF path filter, only matching paths will be opened. Ignored when unk.")
|
||||
DECLARE_DEBUG_VARIABLE(std::string, LoadBinarySipFromFile, std::string("unk"), "Select binary file to load SIP kernel raw binary. When file named *_header.* exists, it is used as header")
|
||||
|
@ -526,11 +526,6 @@ std::vector<std::unique_ptr<HwDeviceId>> Drm::discoverDevices(ExecutionEnvironme
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (DebugManager.flags.ForceDeviceId.get() != "unk") {
|
||||
if (devicePathView.find(DebugManager.flags.ForceDeviceId.get().c_str()) == std::string::npos) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
int fileDescriptor = SysCalls::open(file->c_str(), O_RDWR);
|
||||
appendHwDeviceId(hwDeviceIds, fileDescriptor, pciPath.c_str());
|
||||
if (!hwDeviceIds.empty() && hwDeviceIds.size() == numRootDevices) {
|
||||
|
@ -25,8 +25,7 @@ bool canUseAdapterBasedOnDriverDesc(const char *driverDescription) {
|
||||
}
|
||||
|
||||
bool isAllowedDeviceId(uint32_t deviceId) {
|
||||
return DeviceFactory::isAllowedDeviceId(deviceId, DebugManager.flags.FilterDeviceId.get()) &&
|
||||
DeviceFactory::isAllowedDeviceId(deviceId, DebugManager.flags.ForceDeviceId.get());
|
||||
return DeviceFactory::isAllowedDeviceId(deviceId, DebugManager.flags.FilterDeviceId.get());
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
@ -130,28 +130,6 @@ TEST(IsAllowedDeviceId, whenDebugKeyNotSetThenReturnTrue) {
|
||||
EXPECT_TRUE(NEO::isAllowedDeviceId(0xdeadbeef));
|
||||
}
|
||||
|
||||
TEST(IsAllowedDeviceId, whenForceDeviceIdDebugKeySetThenExpectSpecificValue) {
|
||||
DebugManagerStateRestore rest;
|
||||
DebugManager.flags.ForceDeviceId.set("167");
|
||||
EXPECT_FALSE(NEO::isAllowedDeviceId(0xdeadbeef));
|
||||
|
||||
DebugManager.flags.ForceDeviceId.set("1678");
|
||||
EXPECT_FALSE(NEO::isAllowedDeviceId(0x167));
|
||||
|
||||
DebugManager.flags.ForceDeviceId.set("167");
|
||||
EXPECT_TRUE(NEO::isAllowedDeviceId(0x167));
|
||||
}
|
||||
|
||||
TEST(IsAllowedDeviceId, whenForceDeviceIdDebugKeySetThenTreatAsHex) {
|
||||
DebugManagerStateRestore rest;
|
||||
|
||||
DebugManager.flags.ForceDeviceId.set("167");
|
||||
EXPECT_FALSE(NEO::isAllowedDeviceId(167));
|
||||
|
||||
DebugManager.flags.ForceDeviceId.set("167");
|
||||
EXPECT_TRUE(NEO::isAllowedDeviceId(0x167));
|
||||
}
|
||||
|
||||
TEST(IsAllowedDeviceId, whenFilterDeviceIdDebugKeySetThenExpectSpecificValue) {
|
||||
DebugManagerStateRestore rest;
|
||||
DebugManager.flags.FilterDeviceId.set("167");
|
||||
|
Reference in New Issue
Block a user