mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 14:33:04 +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
@@ -49,11 +49,11 @@ CommandStreamReceiver *createCommandStreamImpl(ExecutionEnvironment &executionEn
|
||||
return commandStreamReceiver;
|
||||
}
|
||||
|
||||
bool getDevicesImpl(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment) {
|
||||
bool getDevicesImpl(ExecutionEnvironment &executionEnvironment) {
|
||||
if (DeviceFactory::isHwModeSelected()) {
|
||||
return DeviceFactory::getDevices(numDevicesReturned, executionEnvironment);
|
||||
return DeviceFactory::getDevices(executionEnvironment);
|
||||
}
|
||||
return DeviceFactory::getDevicesForProductFamilyOverride(numDevicesReturned, executionEnvironment);
|
||||
return DeviceFactory::getDevicesForProductFamilyOverride(executionEnvironment);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
namespace NEO {
|
||||
class ExecutionEnvironment;
|
||||
extern CommandStreamReceiver *createCommandStreamImpl(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex);
|
||||
extern bool getDevicesImpl(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment);
|
||||
extern bool getDevicesImpl(ExecutionEnvironment &executionEnvironment);
|
||||
} // namespace NEO
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment) {
|
||||
return getDevicesImpl(numDevicesReturned, executionEnvironment);
|
||||
bool getDevices(ExecutionEnvironment &executionEnvironment) {
|
||||
return getDevicesImpl(executionEnvironment);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -34,7 +34,6 @@ struct GetDevicesTest : ::testing::Test {
|
||||
void TearDown() override {
|
||||
}
|
||||
int i = 0;
|
||||
size_t numDevices = 0;
|
||||
const HardwareInfo *hwInfo = nullptr;
|
||||
|
||||
VariableBackup<UltHwConfig> backup{&ultHwConfig};
|
||||
@@ -65,7 +64,8 @@ HWTEST_F(GetDevicesTest, givenGetDevicesWhenCsrIsSetToVariousTypesThenTheFunctio
|
||||
platformsImpl.clear();
|
||||
ExecutionEnvironment *exeEnv = constructPlatform()->peekExecutionEnvironment();
|
||||
|
||||
const auto ret = getDevices(numDevices, *exeEnv);
|
||||
const auto ret = getDevices(*exeEnv);
|
||||
EXPECT_EQ(expectedDevices, exeEnv->rootDeviceEnvironments.size());
|
||||
for (auto i = 0u; i < expectedDevices; i++) {
|
||||
hwInfo = exeEnv->rootDeviceEnvironments[i]->getHardwareInfo();
|
||||
|
||||
@@ -74,14 +74,12 @@ HWTEST_F(GetDevicesTest, givenGetDevicesWhenCsrIsSetToVariousTypesThenTheFunctio
|
||||
case CSR_HW_WITH_AUB:
|
||||
EXPECT_TRUE(ret);
|
||||
EXPECT_NE(nullptr, hwInfo);
|
||||
EXPECT_EQ(expectedDevices, numDevices);
|
||||
break;
|
||||
case CSR_AUB:
|
||||
case CSR_TBX:
|
||||
case CSR_TBX_WITH_AUB: {
|
||||
EXPECT_TRUE(ret);
|
||||
EXPECT_NE(nullptr, hwInfo);
|
||||
EXPECT_EQ(expectedDevices, numDevices);
|
||||
for (i = 0; i < IGFX_MAX_PRODUCT; i++) {
|
||||
auto hardwareInfo = hardwareInfoTable[i];
|
||||
if (hardwareInfo == nullptr)
|
||||
@@ -135,7 +133,7 @@ HWTEST_F(GetDevicesTest, givenUpperCaseProductFamilyOverrideFlagSetWhenCreatingD
|
||||
DebugManager.flags.SetCommandStreamReceiver.set(CommandStreamReceiverType::CSR_AUB);
|
||||
|
||||
ExecutionEnvironment *exeEnv = platform()->peekExecutionEnvironment();
|
||||
bool ret = getDevices(numDevices, *exeEnv);
|
||||
bool ret = getDevices(*exeEnv);
|
||||
|
||||
EXPECT_TRUE(ret);
|
||||
EXPECT_EQ(productFamily, exeEnv->rootDeviceEnvironments[0]->getHardwareInfo()->platform.eProductFamily);
|
||||
@@ -153,7 +151,8 @@ HWTEST_F(GetDevicesTest, givenGetDevicesAndUnknownProductFamilyWhenCsrIsSetToVal
|
||||
platformsImpl.clear();
|
||||
ExecutionEnvironment *exeEnv = constructPlatform()->peekExecutionEnvironment();
|
||||
|
||||
auto ret = getDevices(numDevices, *exeEnv);
|
||||
auto ret = getDevices(*exeEnv);
|
||||
EXPECT_EQ(expectedDevices, exeEnv->rootDeviceEnvironments.size());
|
||||
for (auto i = 0u; i < expectedDevices; i++) {
|
||||
hwInfo = exeEnv->rootDeviceEnvironments[i]->getHardwareInfo();
|
||||
|
||||
@@ -161,14 +160,12 @@ HWTEST_F(GetDevicesTest, givenGetDevicesAndUnknownProductFamilyWhenCsrIsSetToVal
|
||||
case CSR_HW:
|
||||
case CSR_HW_WITH_AUB:
|
||||
EXPECT_TRUE(ret);
|
||||
EXPECT_EQ(expectedDevices, numDevices);
|
||||
break;
|
||||
case CSR_AUB:
|
||||
case CSR_TBX:
|
||||
case CSR_TBX_WITH_AUB: {
|
||||
EXPECT_TRUE(ret);
|
||||
EXPECT_NE(nullptr, hwInfo);
|
||||
EXPECT_EQ(expectedDevices, numDevices);
|
||||
for (i = 0; i < IGFX_MAX_PRODUCT; i++) {
|
||||
auto hardwareInfo = hardwareInfoTable[i];
|
||||
if (hardwareInfo == nullptr)
|
||||
|
||||
@@ -86,8 +86,7 @@ TEST(ExecutionEnvironment, givenDeviceThatHaveRefferencesAfterPlatformIsDestroye
|
||||
TEST(ExecutionEnvironment, givenPlatformWhenItIsCreatedThenItCreatesMemoryManagerInExecutionEnvironment) {
|
||||
auto executionEnvironment = new ExecutionEnvironment();
|
||||
Platform platform(*executionEnvironment);
|
||||
size_t numRootDevices;
|
||||
getDevices(numRootDevices, *executionEnvironment);
|
||||
getDevices(*executionEnvironment);
|
||||
platform.initialize(DeviceFactory::createDevices(*executionEnvironment));
|
||||
EXPECT_NE(nullptr, executionEnvironment->memoryManager);
|
||||
}
|
||||
|
||||
@@ -113,8 +113,7 @@ TGLLPTEST_F(TgllpHwInfo, givenSetCommandStreamReceiverInAubModeForTgllpProductFa
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
|
||||
size_t numDevices = 0;
|
||||
bool success = DeviceFactory::getDevicesForProductFamilyOverride(numDevices, executionEnvironment);
|
||||
bool success = DeviceFactory::getDevicesForProductFamilyOverride(executionEnvironment);
|
||||
ASSERT_TRUE(success);
|
||||
|
||||
auto rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment *>(executionEnvironment.rootDeviceEnvironments[0].get());
|
||||
@@ -132,10 +131,8 @@ TGLLPTEST_F(TgllpHwInfo, givenSetCommandStreamReceiverInAubModeWhenGetDevicesFor
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices, true, requiredDeviceCount);
|
||||
|
||||
size_t numDevices = 0;
|
||||
bool success = DeviceFactory::getDevicesForProductFamilyOverride(numDevices, executionEnvironment);
|
||||
bool success = DeviceFactory::getDevicesForProductFamilyOverride(executionEnvironment);
|
||||
ASSERT_TRUE(success);
|
||||
EXPECT_EQ(requiredDeviceCount, numDevices);
|
||||
|
||||
std::set<MemoryOperationsHandler *> memoryOperationHandlers;
|
||||
for (auto rootDeviceIndex = 0u; rootDeviceIndex < requiredDeviceCount; rootDeviceIndex++) {
|
||||
|
||||
@@ -792,8 +792,7 @@ TEST(GmmHelperTest, givenPlatformAlreadyDestroyedWhenResourceIsBeingDestroyedThe
|
||||
TEST(GmmHelperTest, givenValidGmmFunctionsWhenCreateGmmHelperWithInitializedOsInterfaceThenProperParametersArePassed) {
|
||||
std::unique_ptr<GmmHelper> gmmHelper;
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
size_t numDevices;
|
||||
DeviceFactory::getDevices(numDevices, *executionEnvironment);
|
||||
DeviceFactory::getDevices(*executionEnvironment);
|
||||
VariableBackup<decltype(passedInputArgs)> passedInputArgsBackup(&passedInputArgs);
|
||||
VariableBackup<decltype(passedFtrTable)> passedFtrTableBackup(&passedFtrTable);
|
||||
VariableBackup<decltype(passedWaTable)> passedWaTableBackup(&passedWaTable);
|
||||
|
||||
@@ -20,9 +20,8 @@ ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo, uint32_
|
||||
executionEnvironment->prepareRootDeviceEnvironments(rootDeviceEnvironments);
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(rootDeviceEnvironments);
|
||||
size_t numDevicesReturned = 0;
|
||||
hwInfo = nullptr;
|
||||
DeviceFactory::getDevices(numDevicesReturned, *executionEnvironment);
|
||||
DeviceFactory::getDevices(*executionEnvironment);
|
||||
hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnviro
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment) {
|
||||
bool getDevices(ExecutionEnvironment &executionEnvironment) {
|
||||
if (executionEnvironment.rootDeviceEnvironments.size() == 0) {
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1u);
|
||||
}
|
||||
@@ -46,9 +46,9 @@ bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvir
|
||||
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(platformDevices[0]);
|
||||
}
|
||||
if (ultHwConfig.useMockedGetDevicesFunc) {
|
||||
numDevicesReturned = DebugManager.flags.CreateMultipleRootDevices.get() != 0 ? DebugManager.flags.CreateMultipleRootDevices.get() : 1u;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(static_cast<uint32_t>(numDevicesReturned));
|
||||
for (auto i = 0u; i < numDevicesReturned; i++) {
|
||||
uint32_t numRootDevices = DebugManager.flags.CreateMultipleRootDevices.get() != 0 ? DebugManager.flags.CreateMultipleRootDevices.get() : 1u;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(numRootDevices);
|
||||
for (auto i = 0u; i < numRootDevices; i++) {
|
||||
if (executionEnvironment.rootDeviceEnvironments[i]->getHardwareInfo() == nullptr ||
|
||||
(executionEnvironment.rootDeviceEnvironments[i]->getHardwareInfo()->platform.eProductFamily == IGFX_UNKNOWN &&
|
||||
executionEnvironment.rootDeviceEnvironments[i]->getHardwareInfo()->platform.eRenderCoreFamily == IGFX_UNKNOWN_CORE)) {
|
||||
@@ -60,6 +60,6 @@ bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvir
|
||||
return ultHwConfig.mockedGetDevicesFuncResult;
|
||||
}
|
||||
|
||||
return getDevicesImpl(numDevicesReturned, executionEnvironment);
|
||||
return getDevicesImpl(executionEnvironment);
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -14,5 +14,5 @@ class CommandStreamReceiver;
|
||||
class ExecutionEnvironment;
|
||||
|
||||
extern CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex);
|
||||
extern bool getDevices(size_t &numDevicesReturned, ExecutionEnvironment &executionEnvironment);
|
||||
extern bool getDevices(ExecutionEnvironment &executionEnvironment);
|
||||
} // namespace NEO
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -18,10 +18,9 @@ using namespace NEO;
|
||||
using GetDevicesTests = ::testing::Test;
|
||||
|
||||
HWTEST_F(GetDevicesTests, WhenGetDevicesIsCalledThenSuccessIsReturned) {
|
||||
size_t numDevicesReturned = 0;
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
|
||||
auto returnValue = DeviceFactory::getDevices(numDevicesReturned, executionEnvironment);
|
||||
auto returnValue = DeviceFactory::getDevices(executionEnvironment);
|
||||
EXPECT_EQ(true, returnValue);
|
||||
}
|
||||
|
||||
@@ -29,12 +28,11 @@ HWTEST_F(GetDevicesTests, whenGetDevicesIsCalledThenGmmIsBeingInitializedAfterFi
|
||||
platformsImpl.clear();
|
||||
auto executionEnvironment = new ExecutionEnvironment();
|
||||
platformsImpl.push_back(std::make_unique<Platform>(*executionEnvironment));
|
||||
size_t numDevicesReturned = 0;
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1u);
|
||||
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
||||
hwInfo->platform.eProductFamily = PRODUCT_FAMILY::IGFX_UNKNOWN;
|
||||
hwInfo->platform.ePCHProductFamily = PCH_PRODUCT_FAMILY::PCH_UNKNOWN;
|
||||
|
||||
auto returnValue = DeviceFactory::getDevices(numDevicesReturned, *executionEnvironment);
|
||||
auto returnValue = DeviceFactory::getDevices(*executionEnvironment);
|
||||
EXPECT_TRUE(returnValue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user