mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Remove redundant parameter from getDevices functions
Change-Id: I3da50a69adb8ec64fd1d09021142b278e34c4cbe Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:

committed by
sys_ocldev

parent
819896bca2
commit
0f3730f5d9
@ -42,40 +42,19 @@ struct DeviceFactoryTest : public ::testing::Test {
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
};
|
||||
|
||||
TEST_F(DeviceFactoryTest, GetDevices_Expect_True_If_Returned) {
|
||||
size_t numDevices = 0;
|
||||
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
|
||||
|
||||
EXPECT_TRUE((numDevices > 0) ? success : !success);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, GetDevices_Check_HwInfo_Null) {
|
||||
size_t numDevices = 0;
|
||||
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
|
||||
EXPECT_TRUE((numDevices > 0) ? success : !success);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, GetDevices_Check_HwInfo_Platform) {
|
||||
const HardwareInfo *refHwinfo = *platformDevices;
|
||||
size_t numDevices = 0;
|
||||
|
||||
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
|
||||
bool success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
EXPECT_TRUE(success);
|
||||
const HardwareInfo *hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
||||
|
||||
EXPECT_TRUE((numDevices > 0) ? success : !success);
|
||||
|
||||
if (numDevices > 0) {
|
||||
|
||||
EXPECT_EQ(refHwinfo->platform.eDisplayCoreFamily, hwInfo->platform.eDisplayCoreFamily);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, overrideKmdNotifySettings) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
|
||||
size_t numDevices = 0;
|
||||
|
||||
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
|
||||
bool success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
||||
ASSERT_TRUE(success);
|
||||
auto refEnableKmdNotify = hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify;
|
||||
@ -96,7 +75,7 @@ TEST_F(DeviceFactoryTest, overrideKmdNotifySettings) {
|
||||
|
||||
platformsImpl.clear();
|
||||
executionEnvironment = constructPlatform()->peekExecutionEnvironment();
|
||||
success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
|
||||
success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
ASSERT_TRUE(success);
|
||||
hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
||||
|
||||
@ -117,9 +96,7 @@ TEST_F(DeviceFactoryTest, getEngineTypeDebugOverride) {
|
||||
int32_t debugEngineType = 2;
|
||||
DebugManager.flags.NodeOrdinal.set(debugEngineType);
|
||||
|
||||
size_t numDevices = 0;
|
||||
|
||||
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
|
||||
bool success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
ASSERT_TRUE(success);
|
||||
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
||||
|
||||
@ -128,8 +105,7 @@ TEST_F(DeviceFactoryTest, getEngineTypeDebugOverride) {
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenPointerToHwInfoWhenGetDevicedCalledThenRequiedSurfaceSizeIsSettedProperly) {
|
||||
size_t numDevices = 0;
|
||||
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
|
||||
bool success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
ASSERT_TRUE(success);
|
||||
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
||||
|
||||
@ -141,32 +117,17 @@ TEST_F(DeviceFactoryTest, givenCreateMultipleRootDevicesDebugFlagWhenGetDevicesI
|
||||
auto requiredDeviceCount = 2u;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(requiredDeviceCount);
|
||||
|
||||
size_t numDevices = 0;
|
||||
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
|
||||
bool success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
|
||||
ASSERT_TRUE(success);
|
||||
EXPECT_EQ(requiredDeviceCount, numDevices);
|
||||
EXPECT_EQ(requiredDeviceCount, executionEnvironment->rootDeviceEnvironments.size());
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenCreateMultipleRootDevicesDebugFlagWhenGetDevicesForProductFamilyOverrideIsCalledThenNumberOfReturnedDevicesIsEqualToDebugVariable) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
auto requiredDeviceCount = 2u;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(requiredDeviceCount);
|
||||
|
||||
size_t numDevices = 0;
|
||||
bool success = DeviceFactory::getDevicesForProductFamilyOverride(numDevices, *executionEnvironment);
|
||||
|
||||
ASSERT_TRUE(success);
|
||||
EXPECT_EQ(requiredDeviceCount, numDevices);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenDebugFlagSetWhenGetDevicesIsCalledThenOverrideGpuAddressSpace) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.OverrideGpuAddressSpace.set(12);
|
||||
|
||||
size_t numDevices = 0;
|
||||
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
|
||||
bool success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(maxNBitValue(12), executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.gpuAddressSpace);
|
||||
@ -176,8 +137,7 @@ TEST_F(DeviceFactoryTest, givenDebugFlagSetWhenGetDevicesForProductFamilyOverrid
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.OverrideGpuAddressSpace.set(12);
|
||||
|
||||
size_t numDevices = 0;
|
||||
bool success = DeviceFactory::getDevicesForProductFamilyOverride(numDevices, *executionEnvironment);
|
||||
bool success = DeviceFactory::getDevicesForProductFamilyOverride(*executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(maxNBitValue(12), executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.gpuAddressSpace);
|
||||
@ -190,10 +150,8 @@ TEST_F(DeviceFactoryTest, whenGetDevicesIsCalledThenAllRootDeviceEnvironmentMemb
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices, true, requiredDeviceCount);
|
||||
|
||||
size_t numDevices = 0;
|
||||
bool success = DeviceFactory::getDevices(numDevices, executionEnvironment);
|
||||
bool success = DeviceFactory::getDevices(executionEnvironment);
|
||||
ASSERT_TRUE(success);
|
||||
EXPECT_EQ(requiredDeviceCount, numDevices);
|
||||
|
||||
std::set<MemoryOperationsHandler *> memoryOperationHandlers;
|
||||
std::set<OSInterface *> osInterfaces;
|
||||
@ -218,8 +176,7 @@ TEST_F(DeviceFactoryTest, givenInvalidHwConfigStringGetDevicesForProductFamilyOv
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
|
||||
size_t numDevices = 0;
|
||||
bool success = DeviceFactory::getDevicesForProductFamilyOverride(numDevices, executionEnvironment);
|
||||
bool success = DeviceFactory::getDevicesForProductFamilyOverride(executionEnvironment);
|
||||
EXPECT_FALSE(success);
|
||||
}
|
||||
|
||||
@ -229,13 +186,11 @@ TEST_F(DeviceFactoryTest, givenValidHwConfigStringGetDevicesForProductFamilyOver
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
|
||||
size_t numDevices = 0;
|
||||
EXPECT_ANY_THROW(DeviceFactory::getDevicesForProductFamilyOverride(numDevices, executionEnvironment));
|
||||
EXPECT_ANY_THROW(DeviceFactory::getDevicesForProductFamilyOverride(executionEnvironment));
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenGetDevicesCallWhenItIsDoneThenOsInterfaceIsAllocated) {
|
||||
size_t numDevices = 0;
|
||||
bool success = DeviceFactory::getDevices(numDevices, *executionEnvironment);
|
||||
bool success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_NE(nullptr, executionEnvironment->rootDeviceEnvironments[0]->osInterface);
|
||||
}
|
||||
@ -269,9 +224,8 @@ TEST(DiscoverDevices, whenDiscoverDevicesAndForceDeviceIdIsDifferentFromTheExist
|
||||
TEST(DiscoverDevices, whenDiscoverDevicesAndForceDeviceIdIsDifferentFromTheExistingDeviceThenGetDevicesReturnsFalse) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.ForceDeviceId.set("invalid");
|
||||
size_t numDevices = 0u;
|
||||
ExecutionEnvironment executionEnviornment;
|
||||
|
||||
auto result = DeviceFactory::getDevices(numDevices, executionEnviornment);
|
||||
auto result = DeviceFactory::getDevices(executionEnviornment);
|
||||
EXPECT_FALSE(result);
|
||||
}
|
||||
|
@ -14,16 +14,14 @@
|
||||
|
||||
TEST_F(DeviceFactoryLinuxTest, GetDevicesCheckEUCntSSCnt) {
|
||||
const HardwareInfo *refHwinfo = *platformDevices;
|
||||
size_t numDevices = 0;
|
||||
|
||||
pDrm->StoredEUVal = 11;
|
||||
pDrm->StoredSSVal = 8;
|
||||
|
||||
bool success = DeviceFactory::getDevices(numDevices, executionEnvironment);
|
||||
bool success = DeviceFactory::getDevices(executionEnvironment);
|
||||
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo();
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ((int)numDevices, 1);
|
||||
EXPECT_NE(hwInfo, nullptr);
|
||||
EXPECT_EQ(refHwinfo->platform.eDisplayCoreFamily, hwInfo->platform.eDisplayCoreFamily);
|
||||
EXPECT_EQ((int)hwInfo->gtSystemInfo.EUCount, 11);
|
||||
@ -34,19 +32,17 @@ TEST_F(DeviceFactoryLinuxTest, GetDevicesCheckEUCntSSCnt) {
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryLinuxTest, GetDevicesDrmCreateFailedConfigureHwInfo) {
|
||||
size_t numDevices = 0;
|
||||
|
||||
pDrm->StoredRetValForDeviceID = -1;
|
||||
|
||||
bool success = DeviceFactory::getDevices(numDevices, executionEnvironment);
|
||||
bool success = DeviceFactory::getDevices(executionEnvironment);
|
||||
EXPECT_FALSE(success);
|
||||
|
||||
pDrm->StoredRetValForDeviceID = 0;
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryLinuxTest, givenGetDeviceCallWhenItIsDoneThenOsInterfaceIsAllocatedAndItContainDrm) {
|
||||
size_t numDevices = 0;
|
||||
bool success = DeviceFactory::getDevices(numDevices, executionEnvironment);
|
||||
bool success = DeviceFactory::getDevices(executionEnvironment);
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_NE(nullptr, executionEnvironment.rootDeviceEnvironments[0]->osInterface);
|
||||
EXPECT_NE(nullptr, pDrm);
|
||||
@ -56,8 +52,7 @@ TEST_F(DeviceFactoryLinuxTest, givenGetDeviceCallWhenItIsDoneThenOsInterfaceIsAl
|
||||
TEST_F(DeviceFactoryLinuxTest, whenDrmIsNotCretedThenGetDevicesFails) {
|
||||
delete pDrm;
|
||||
pDrm = nullptr;
|
||||
size_t numDevices = 0;
|
||||
|
||||
bool success = DeviceFactory::getDevices(numDevices, executionEnvironment);
|
||||
bool success = DeviceFactory::getDevices(executionEnvironment);
|
||||
EXPECT_FALSE(success);
|
||||
}
|
||||
|
@ -1875,9 +1875,8 @@ TEST(WddmMemoryManager, givenMultipleRootDeviceWhenMemoryManagerGetsWddmThenWddm
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(4);
|
||||
VariableBackup<UltHwConfig> backup{&ultHwConfig};
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
size_t numRootDevices;
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
getDevices(numRootDevices, *executionEnvironment);
|
||||
getDevices(*executionEnvironment);
|
||||
|
||||
MockWddmMemoryManager wddmMemoryManager(*executionEnvironment);
|
||||
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
|
||||
@ -1892,10 +1891,8 @@ TEST(WddmMemoryManager, givenMultipleRootDeviceWhenCreateMemoryManagerThenTakeMa
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
|
||||
VariableBackup<UltHwConfig> backup{&ultHwConfig};
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
size_t numRootDevicesReturned;
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
getDevices(numRootDevicesReturned, *executionEnvironment);
|
||||
EXPECT_EQ(static_cast<uint32_t>(numRootDevicesReturned), numRootDevices);
|
||||
getDevices(*executionEnvironment);
|
||||
for (auto i = 0u; i < numRootDevices; i++) {
|
||||
auto wddm = static_cast<WddmMock *>(executionEnvironment->rootDeviceEnvironments[i]->osInterface->get()->getWddm());
|
||||
wddm->minAddress = i * (numRootDevices - i);
|
||||
@ -1912,23 +1909,21 @@ TEST(WddmMemoryManager, givenNoLocalMemoryOnAnyDeviceWhenIsCpuCopyRequiredIsCall
|
||||
VariableBackup<UltHwConfig> backup{&ultHwConfig};
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
size_t numRootDevicesReturned;
|
||||
getDevices(numRootDevicesReturned, *executionEnvironment);
|
||||
getDevices(*executionEnvironment);
|
||||
MockWddmMemoryManager wddmMemoryManager(*executionEnvironment);
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&restorer));
|
||||
}
|
||||
|
||||
TEST(WddmMemoryManager, givenLocalPointerPassedToIsCpuCopyRequiredThenFalseIsReturned) {
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
size_t numRootDevicesReturned;
|
||||
VariableBackup<UltHwConfig> backup{&ultHwConfig};
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
getDevices(numRootDevicesReturned, *executionEnvironment);
|
||||
getDevices(*executionEnvironment);
|
||||
MockWddmMemoryManager wddmMemoryManager(*executionEnvironment);
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&numRootDevicesReturned));
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&backup));
|
||||
//call multiple times to make sure that result is constant
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&numRootDevicesReturned));
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&numRootDevicesReturned));
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&numRootDevicesReturned));
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&numRootDevicesReturned));
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&backup));
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&backup));
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&backup));
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&backup));
|
||||
}
|
||||
|
Reference in New Issue
Block a user