mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-24 21:18:24 +08:00
Rename getDevices functions
getDevices -> prepareDeviceEnvironments Change-Id: Ie5bbc0e9f1fe9b1c34ba012249ffa33c4d2ebd05 Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
committed by
sys_ocldev
parent
38f53cab8a
commit
688c95ce3c
@@ -49,11 +49,11 @@ CommandStreamReceiver *createCommandStreamImpl(ExecutionEnvironment &executionEn
|
||||
return commandStreamReceiver;
|
||||
}
|
||||
|
||||
bool getDevicesImpl(ExecutionEnvironment &executionEnvironment) {
|
||||
bool prepareDeviceEnvironmentsImpl(ExecutionEnvironment &executionEnvironment) {
|
||||
if (DeviceFactory::isHwModeSelected()) {
|
||||
return DeviceFactory::getDevices(executionEnvironment);
|
||||
return DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
||||
}
|
||||
return DeviceFactory::getDevicesForProductFamilyOverride(executionEnvironment);
|
||||
return DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
namespace NEO {
|
||||
class ExecutionEnvironment;
|
||||
extern CommandStreamReceiver *createCommandStreamImpl(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex);
|
||||
extern bool getDevicesImpl(ExecutionEnvironment &executionEnvironment);
|
||||
extern bool prepareDeviceEnvironmentsImpl(ExecutionEnvironment &executionEnvironment);
|
||||
} // namespace NEO
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
bool getDevices(ExecutionEnvironment &executionEnvironment) {
|
||||
return getDevicesImpl(executionEnvironment);
|
||||
bool prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment) {
|
||||
return prepareDeviceEnvironmentsImpl(executionEnvironment);
|
||||
}
|
||||
|
||||
} // namespace NEO
|
||||
|
||||
@@ -103,7 +103,7 @@ TEST(clGetDeviceIDsTest, givenMultipleRootDevicesWhenGetDeviceIdsThenAllRootDevi
|
||||
platformsImpl.clear();
|
||||
constexpr auto numRootDevices = 3u;
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
|
||||
cl_uint numDevices = 0;
|
||||
@@ -120,7 +120,7 @@ TEST(clGetDeviceIDsTest, givenMultipleRootDevicesWhenGetDeviceIdsButNumEntriesIs
|
||||
platformsImpl.clear();
|
||||
constexpr auto numRootDevices = 3u;
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
|
||||
cl_uint maxNumDevices;
|
||||
@@ -151,7 +151,7 @@ TEST(clGetDeviceIDsTest, givenMultipleRootDevicesAndLimitedNumberOfReturnedDevic
|
||||
platformsImpl.clear();
|
||||
constexpr auto numRootDevices = 3u;
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
|
||||
DebugManager.flags.LimitAmountOfReturnedDevices.set(numRootDevices - 1);
|
||||
|
||||
@@ -51,7 +51,7 @@ TEST_F(clGetPlatformIDsTests, GivenNumEntriesZeroAndPlatformNotNullWhenGettingPl
|
||||
TEST(clGetPlatformIDsNegativeTests, GivenFailedInitializationWhenGettingPlatformIdsThenClOutOfHostMemoryErrorIsReturned) {
|
||||
platformsImpl.clear();
|
||||
VariableBackup<UltHwConfig> backup{&ultHwConfig};
|
||||
ultHwConfig.mockedGetDevicesFuncResult = false;
|
||||
ultHwConfig.mockedPrepareDeviceEnvironmentsFuncResult = false;
|
||||
|
||||
cl_int retVal = CL_SUCCESS;
|
||||
cl_platform_id platformRet = nullptr;
|
||||
|
||||
@@ -27,9 +27,9 @@ bool operator==(const HardwareInfo &hwInfoIn, const HardwareInfo &hwInfoOut) {
|
||||
return result;
|
||||
}
|
||||
|
||||
struct GetDevicesTest : ::testing::Test {
|
||||
struct PrepareDeviceEnvironmentsTest : ::testing::Test {
|
||||
void SetUp() override {
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
}
|
||||
void TearDown() override {
|
||||
}
|
||||
@@ -40,7 +40,7 @@ struct GetDevicesTest : ::testing::Test {
|
||||
DebugManagerStateRestore stateRestorer;
|
||||
};
|
||||
|
||||
HWTEST_F(GetDevicesTest, givenGetDevicesWhenCsrIsSetToVariousTypesThenTheFunctionReturnsTheExpectedValueOfHardwareInfo) {
|
||||
HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsWhenCsrIsSetToVariousTypesThenTheFunctionReturnsTheExpectedValueOfHardwareInfo) {
|
||||
uint32_t expectedDevices = 1;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(expectedDevices);
|
||||
for (int productFamilyIndex = 0; productFamilyIndex < IGFX_MAX_PRODUCT; productFamilyIndex++) {
|
||||
@@ -64,7 +64,7 @@ HWTEST_F(GetDevicesTest, givenGetDevicesWhenCsrIsSetToVariousTypesThenTheFunctio
|
||||
platformsImpl.clear();
|
||||
ExecutionEnvironment *exeEnv = constructPlatform()->peekExecutionEnvironment();
|
||||
|
||||
const auto ret = getDevices(*exeEnv);
|
||||
const auto ret = prepareDeviceEnvironments(*exeEnv);
|
||||
EXPECT_EQ(expectedDevices, exeEnv->rootDeviceEnvironments.size());
|
||||
for (auto i = 0u; i < expectedDevices; i++) {
|
||||
hwInfo = exeEnv->rootDeviceEnvironments[i]->getHardwareInfo();
|
||||
@@ -111,7 +111,7 @@ HWTEST_F(GetDevicesTest, givenGetDevicesWhenCsrIsSetToVariousTypesThenTheFunctio
|
||||
}
|
||||
}
|
||||
|
||||
HWTEST_F(GetDevicesTest, givenUpperCaseProductFamilyOverrideFlagSetWhenCreatingDevicesThenFindExpectedPlatform) {
|
||||
HWTEST_F(PrepareDeviceEnvironmentsTest, givenUpperCaseProductFamilyOverrideFlagSetWhenCreatingDevicesThenFindExpectedPlatform) {
|
||||
std::string hwPrefix;
|
||||
std::string hwPrefixUpperCase;
|
||||
PRODUCT_FAMILY productFamily;
|
||||
@@ -133,13 +133,13 @@ HWTEST_F(GetDevicesTest, givenUpperCaseProductFamilyOverrideFlagSetWhenCreatingD
|
||||
DebugManager.flags.SetCommandStreamReceiver.set(CommandStreamReceiverType::CSR_AUB);
|
||||
|
||||
ExecutionEnvironment *exeEnv = platform()->peekExecutionEnvironment();
|
||||
bool ret = getDevices(*exeEnv);
|
||||
bool ret = prepareDeviceEnvironments(*exeEnv);
|
||||
|
||||
EXPECT_TRUE(ret);
|
||||
EXPECT_EQ(productFamily, exeEnv->rootDeviceEnvironments[0]->getHardwareInfo()->platform.eProductFamily);
|
||||
}
|
||||
|
||||
HWTEST_F(GetDevicesTest, givenGetDevicesAndUnknownProductFamilyWhenCsrIsSetToValidTypeThenTheFunctionReturnsTheExpectedValueOfHardwareInfo) {
|
||||
HWTEST_F(PrepareDeviceEnvironmentsTest, givenPrepareDeviceEnvironmentsAndUnknownProductFamilyWhenCsrIsSetToValidTypeThenTheFunctionReturnsTheExpectedValueOfHardwareInfo) {
|
||||
uint32_t expectedDevices = 1;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(expectedDevices);
|
||||
for (int csrTypes = 0; csrTypes <= CSR_TYPES_NUM; csrTypes++) {
|
||||
@@ -151,7 +151,7 @@ HWTEST_F(GetDevicesTest, givenGetDevicesAndUnknownProductFamilyWhenCsrIsSetToVal
|
||||
platformsImpl.clear();
|
||||
ExecutionEnvironment *exeEnv = constructPlatform()->peekExecutionEnvironment();
|
||||
|
||||
auto ret = getDevices(*exeEnv);
|
||||
auto ret = prepareDeviceEnvironments(*exeEnv);
|
||||
EXPECT_EQ(expectedDevices, exeEnv->rootDeviceEnvironments.size());
|
||||
for (auto i = 0u; i < expectedDevices; i++) {
|
||||
hwInfo = exeEnv->rootDeviceEnvironments[i]->getHardwareInfo();
|
||||
|
||||
@@ -106,7 +106,7 @@ TEST(SubDevicesTest, givenCreateMultipleRootDevicesFlagsEnabledWhenDevicesAreCre
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(2);
|
||||
|
||||
VariableBackup<UltHwConfig> backup{&ultHwConfig};
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
initPlatform();
|
||||
EXPECT_EQ(0u, platform()->getClDevice(0)->getRootDeviceIndex());
|
||||
EXPECT_EQ(1u, platform()->getClDevice(1)->getRootDeviceIndex());
|
||||
|
||||
@@ -86,7 +86,7 @@ TEST(ExecutionEnvironment, givenDeviceThatHaveRefferencesAfterPlatformIsDestroye
|
||||
TEST(ExecutionEnvironment, givenPlatformWhenItIsCreatedThenItCreatesMemoryManagerInExecutionEnvironment) {
|
||||
auto executionEnvironment = new ExecutionEnvironment();
|
||||
Platform platform(*executionEnvironment);
|
||||
getDevices(*executionEnvironment);
|
||||
prepareDeviceEnvironments(*executionEnvironment);
|
||||
platform.initialize(DeviceFactory::createDevices(*executionEnvironment));
|
||||
EXPECT_NE(nullptr, executionEnvironment->memoryManager);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class MemoryAllocatorMultiDeviceFixture : public MemoryManagementFixture, public
|
||||
isOsAgnosticMemoryManager = GetParam();
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
ultHwConfig.forceOsAgnosticMemoryManager = isOsAgnosticMemoryManager;
|
||||
|
||||
initPlatform();
|
||||
|
||||
@@ -106,14 +106,14 @@ TGLLPTEST_F(TgllpHwInfo, givenHwInfoConfigStringThenAfterSetupResultingVmeIsDisa
|
||||
EXPECT_FALSE(hwInfo.capabilityTable.supportsVme);
|
||||
}
|
||||
|
||||
TGLLPTEST_F(TgllpHwInfo, givenSetCommandStreamReceiverInAubModeForTgllpProductFamilyWhenGetDevicesForProductFamilyOverrideIsCalledThenAubCenterIsInitializedCorrectly) {
|
||||
TGLLPTEST_F(TgllpHwInfo, givenSetCommandStreamReceiverInAubModeForTgllpProductFamilyWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenAubCenterIsInitializedCorrectly) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.SetCommandStreamReceiver.set(1);
|
||||
DebugManager.flags.ProductFamilyOverride.set("tgllp");
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
|
||||
bool success = DeviceFactory::getDevicesForProductFamilyOverride(executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment);
|
||||
ASSERT_TRUE(success);
|
||||
|
||||
auto rootDeviceEnvironment = static_cast<MockRootDeviceEnvironment *>(executionEnvironment.rootDeviceEnvironments[0].get());
|
||||
@@ -122,7 +122,7 @@ TGLLPTEST_F(TgllpHwInfo, givenSetCommandStreamReceiverInAubModeForTgllpProductFa
|
||||
EXPECT_FALSE(rootDeviceEnvironment->localMemoryEnabledReceived);
|
||||
}
|
||||
|
||||
TGLLPTEST_F(TgllpHwInfo, givenSetCommandStreamReceiverInAubModeWhenGetDevicesForProductFamilyOverrideIsCalledThenAllRootDeviceEnvironmentMembersAreInitialized) {
|
||||
TGLLPTEST_F(TgllpHwInfo, givenSetCommandStreamReceiverInAubModeWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenAllRootDeviceEnvironmentMembersAreInitialized) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
auto requiredDeviceCount = 2u;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(requiredDeviceCount);
|
||||
@@ -131,7 +131,7 @@ TGLLPTEST_F(TgllpHwInfo, givenSetCommandStreamReceiverInAubModeWhenGetDevicesFor
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices, true, requiredDeviceCount);
|
||||
|
||||
bool success = DeviceFactory::getDevicesForProductFamilyOverride(executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment);
|
||||
ASSERT_TRUE(success);
|
||||
|
||||
std::set<MemoryOperationsHandler *> memoryOperationHandlers;
|
||||
|
||||
@@ -792,7 +792,7 @@ TEST(GmmHelperTest, givenPlatformAlreadyDestroyedWhenResourceIsBeingDestroyedThe
|
||||
TEST(GmmHelperTest, givenValidGmmFunctionsWhenCreateGmmHelperWithInitializedOsInterfaceThenProperParametersArePassed) {
|
||||
std::unique_ptr<GmmHelper> gmmHelper;
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
DeviceFactory::getDevices(*executionEnvironment);
|
||||
DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
VariableBackup<decltype(passedInputArgs)> passedInputArgsBackup(&passedInputArgs);
|
||||
VariableBackup<decltype(passedFtrTable)> passedFtrTableBackup(&passedFtrTable);
|
||||
VariableBackup<decltype(passedWaTable)> passedWaTableBackup(&passedWaTable);
|
||||
|
||||
@@ -21,7 +21,7 @@ ExecutionEnvironment *getExecutionEnvironmentImpl(HardwareInfo *&hwInfo, uint32_
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(rootDeviceEnvironments);
|
||||
hwInfo = nullptr;
|
||||
DeviceFactory::getDevices(*executionEnvironment);
|
||||
DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
||||
executionEnvironment->initializeMemoryManager();
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnviro
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool getDevices(ExecutionEnvironment &executionEnvironment) {
|
||||
bool prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment) {
|
||||
if (executionEnvironment.rootDeviceEnvironments.size() == 0) {
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1u);
|
||||
}
|
||||
@@ -45,7 +45,7 @@ bool getDevices(ExecutionEnvironment &executionEnvironment) {
|
||||
if (currentHwInfo->platform.eProductFamily == IGFX_UNKNOWN && currentHwInfo->platform.eRenderCoreFamily == IGFX_UNKNOWN_CORE) {
|
||||
executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(platformDevices[0]);
|
||||
}
|
||||
if (ultHwConfig.useMockedGetDevicesFunc) {
|
||||
if (ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc) {
|
||||
uint32_t numRootDevices = DebugManager.flags.CreateMultipleRootDevices.get() != 0 ? DebugManager.flags.CreateMultipleRootDevices.get() : 1u;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(numRootDevices);
|
||||
for (auto i = 0u; i < numRootDevices; i++) {
|
||||
@@ -57,9 +57,9 @@ bool getDevices(ExecutionEnvironment &executionEnvironment) {
|
||||
}
|
||||
executionEnvironment.calculateMaxOsContextCount();
|
||||
executionEnvironment.initializeMemoryManager();
|
||||
return ultHwConfig.mockedGetDevicesFuncResult;
|
||||
return ultHwConfig.mockedPrepareDeviceEnvironmentsFuncResult;
|
||||
}
|
||||
|
||||
return getDevicesImpl(executionEnvironment);
|
||||
return prepareDeviceEnvironmentsImpl(executionEnvironment);
|
||||
}
|
||||
} // namespace NEO
|
||||
|
||||
@@ -14,5 +14,5 @@ class CommandStreamReceiver;
|
||||
class ExecutionEnvironment;
|
||||
|
||||
extern CommandStreamReceiver *createCommandStream(ExecutionEnvironment &executionEnvironment, uint32_t rootDeviceIndex);
|
||||
extern bool getDevices(ExecutionEnvironment &executionEnvironment);
|
||||
extern bool prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment);
|
||||
} // namespace NEO
|
||||
|
||||
@@ -1945,7 +1945,7 @@ TEST(SharedBuffersTest, whenBuffersIsCreatedWithSharingHandlerThenItIsSharedBuff
|
||||
|
||||
TEST(ResidencyTests, whenBuffersIsCreatedWithMakeResidentFlagThenItSuccessfulyCreates) {
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.MakeAllBuffersResident.set(true);
|
||||
|
||||
|
||||
@@ -42,10 +42,10 @@ struct DeviceFactoryTest : public ::testing::Test {
|
||||
ExecutionEnvironment *executionEnvironment;
|
||||
};
|
||||
|
||||
TEST_F(DeviceFactoryTest, GetDevices_Check_HwInfo_Platform) {
|
||||
TEST_F(DeviceFactoryTest, PrepareDeviceEnvironments_Check_HwInfo_Platform) {
|
||||
const HardwareInfo *refHwinfo = *platformDevices;
|
||||
|
||||
bool success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
EXPECT_TRUE(success);
|
||||
const HardwareInfo *hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
||||
EXPECT_EQ(refHwinfo->platform.eDisplayCoreFamily, hwInfo->platform.eDisplayCoreFamily);
|
||||
@@ -54,7 +54,7 @@ TEST_F(DeviceFactoryTest, GetDevices_Check_HwInfo_Platform) {
|
||||
TEST_F(DeviceFactoryTest, overrideKmdNotifySettings) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
|
||||
bool success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
||||
ASSERT_TRUE(success);
|
||||
auto refEnableKmdNotify = hwInfo->capabilityTable.kmdNotifyProperties.enableKmdNotify;
|
||||
@@ -75,7 +75,7 @@ TEST_F(DeviceFactoryTest, overrideKmdNotifySettings) {
|
||||
|
||||
platformsImpl.clear();
|
||||
executionEnvironment = constructPlatform()->peekExecutionEnvironment();
|
||||
success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
success = DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
ASSERT_TRUE(success);
|
||||
hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
||||
|
||||
@@ -96,7 +96,7 @@ TEST_F(DeviceFactoryTest, getEngineTypeDebugOverride) {
|
||||
int32_t debugEngineType = 2;
|
||||
DebugManager.flags.NodeOrdinal.set(debugEngineType);
|
||||
|
||||
bool success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
ASSERT_TRUE(success);
|
||||
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
||||
|
||||
@@ -105,52 +105,52 @@ TEST_F(DeviceFactoryTest, getEngineTypeDebugOverride) {
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenPointerToHwInfoWhenGetDevicedCalledThenRequiedSurfaceSizeIsSettedProperly) {
|
||||
bool success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
ASSERT_TRUE(success);
|
||||
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo();
|
||||
|
||||
EXPECT_EQ(hwInfo->gtSystemInfo.CsrSizeInMb * MemoryConstants::megaByte, hwInfo->capabilityTable.requiredPreemptionSurfaceSize);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenCreateMultipleRootDevicesDebugFlagWhenGetDevicesIsCalledThenNumberOfReturnedDevicesIsEqualToDebugVariable) {
|
||||
TEST_F(DeviceFactoryTest, givenCreateMultipleRootDevicesDebugFlagWhenPrepareDeviceEnvironmentsIsCalledThenNumberOfReturnedDevicesIsEqualToDebugVariable) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
auto requiredDeviceCount = 2u;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(requiredDeviceCount);
|
||||
|
||||
bool success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
|
||||
ASSERT_TRUE(success);
|
||||
EXPECT_EQ(requiredDeviceCount, executionEnvironment->rootDeviceEnvironments.size());
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenDebugFlagSetWhenGetDevicesIsCalledThenOverrideGpuAddressSpace) {
|
||||
TEST_F(DeviceFactoryTest, givenDebugFlagSetWhenPrepareDeviceEnvironmentsIsCalledThenOverrideGpuAddressSpace) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.OverrideGpuAddressSpace.set(12);
|
||||
|
||||
bool success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(maxNBitValue(12), executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.gpuAddressSpace);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenDebugFlagSetWhenGetDevicesForProductFamilyOverrideIsCalledThenOverrideGpuAddressSpace) {
|
||||
TEST_F(DeviceFactoryTest, givenDebugFlagSetWhenPrepareDeviceEnvironmentsForProductFamilyOverrideIsCalledThenOverrideGpuAddressSpace) {
|
||||
DebugManagerStateRestore restore;
|
||||
DebugManager.flags.OverrideGpuAddressSpace.set(12);
|
||||
|
||||
bool success = DeviceFactory::getDevicesForProductFamilyOverride(*executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(*executionEnvironment);
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_EQ(maxNBitValue(12), executionEnvironment->rootDeviceEnvironments[0]->getHardwareInfo()->capabilityTable.gpuAddressSpace);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, whenGetDevicesIsCalledThenAllRootDeviceEnvironmentMembersAreInitialized) {
|
||||
TEST_F(DeviceFactoryTest, whenPrepareDeviceEnvironmentsIsCalledThenAllRootDeviceEnvironmentMembersAreInitialized) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
auto requiredDeviceCount = 2u;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(requiredDeviceCount);
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices, true, requiredDeviceCount);
|
||||
|
||||
bool success = DeviceFactory::getDevices(executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
||||
ASSERT_TRUE(success);
|
||||
|
||||
std::set<MemoryOperationsHandler *> memoryOperationHandlers;
|
||||
@@ -170,27 +170,27 @@ TEST_F(DeviceFactoryTest, whenGetDevicesIsCalledThenAllRootDeviceEnvironmentMemb
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenInvalidHwConfigStringGetDevicesForProductFamilyOverrideReturnsFalse) {
|
||||
TEST_F(DeviceFactoryTest, givenInvalidHwConfigStringPrepareDeviceEnvironmentsForProductFamilyOverrideReturnsFalse) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.HardwareInfoOverride.set("1x3");
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
|
||||
bool success = DeviceFactory::getDevicesForProductFamilyOverride(executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment);
|
||||
EXPECT_FALSE(success);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenValidHwConfigStringGetDevicesForProductFamilyOverrideReturnsTrue) {
|
||||
TEST_F(DeviceFactoryTest, givenValidHwConfigStringPrepareDeviceEnvironmentsForProductFamilyOverrideReturnsTrue) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.HardwareInfoOverride.set("1x1x1");
|
||||
|
||||
MockExecutionEnvironment executionEnvironment(*platformDevices);
|
||||
|
||||
EXPECT_ANY_THROW(DeviceFactory::getDevicesForProductFamilyOverride(executionEnvironment));
|
||||
EXPECT_ANY_THROW(DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment));
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryTest, givenGetDevicesCallWhenItIsDoneThenOsInterfaceIsAllocated) {
|
||||
bool success = DeviceFactory::getDevices(*executionEnvironment);
|
||||
TEST_F(DeviceFactoryTest, givenPrepareDeviceEnvironmentsCallWhenItIsDoneThenOsInterfaceIsAllocated) {
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(*executionEnvironment);
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_NE(nullptr, executionEnvironment->rootDeviceEnvironments[0]->osInterface);
|
||||
}
|
||||
@@ -221,11 +221,11 @@ TEST(DiscoverDevices, whenDiscoverDevicesAndForceDeviceIdIsDifferentFromTheExist
|
||||
EXPECT_TRUE(hwDeviceIds.empty());
|
||||
}
|
||||
|
||||
TEST(DiscoverDevices, whenDiscoverDevicesAndForceDeviceIdIsDifferentFromTheExistingDeviceThenGetDevicesReturnsFalse) {
|
||||
TEST(DiscoverDevices, whenDiscoverDevicesAndForceDeviceIdIsDifferentFromTheExistingDeviceThenPrepareDeviceEnvironmentsReturnsFalse) {
|
||||
DebugManagerStateRestore stateRestore;
|
||||
DebugManager.flags.ForceDeviceId.set("invalid");
|
||||
ExecutionEnvironment executionEnviornment;
|
||||
|
||||
auto result = DeviceFactory::getDevices(executionEnviornment);
|
||||
auto result = DeviceFactory::prepareDeviceEnvironments(executionEnviornment);
|
||||
EXPECT_FALSE(result);
|
||||
}
|
||||
|
||||
@@ -12,13 +12,13 @@
|
||||
#include "shared/source/os_interface/os_interface.h"
|
||||
#include "shared/test/unit_test/helpers/default_hw_info.h"
|
||||
|
||||
TEST_F(DeviceFactoryLinuxTest, GetDevicesCheckEUCntSSCnt) {
|
||||
TEST_F(DeviceFactoryLinuxTest, PrepareDeviceEnvironmentsCheckEUCntSSCnt) {
|
||||
const HardwareInfo *refHwinfo = *platformDevices;
|
||||
|
||||
pDrm->StoredEUVal = 11;
|
||||
pDrm->StoredSSVal = 8;
|
||||
|
||||
bool success = DeviceFactory::getDevices(executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
||||
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getHardwareInfo();
|
||||
|
||||
EXPECT_TRUE(success);
|
||||
@@ -31,28 +31,28 @@ TEST_F(DeviceFactoryLinuxTest, GetDevicesCheckEUCntSSCnt) {
|
||||
EXPECT_EQ(1u, hwInfo->featureTable.ftrGT2);
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryLinuxTest, GetDevicesDrmCreateFailedConfigureHwInfo) {
|
||||
TEST_F(DeviceFactoryLinuxTest, PrepareDeviceEnvironmentsDrmCreateFailedConfigureHwInfo) {
|
||||
|
||||
pDrm->StoredRetValForDeviceID = -1;
|
||||
|
||||
bool success = DeviceFactory::getDevices(executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
||||
EXPECT_FALSE(success);
|
||||
|
||||
pDrm->StoredRetValForDeviceID = 0;
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryLinuxTest, givenGetDeviceCallWhenItIsDoneThenOsInterfaceIsAllocatedAndItContainDrm) {
|
||||
bool success = DeviceFactory::getDevices(executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
||||
EXPECT_TRUE(success);
|
||||
EXPECT_NE(nullptr, executionEnvironment.rootDeviceEnvironments[0]->osInterface);
|
||||
EXPECT_NE(nullptr, pDrm);
|
||||
EXPECT_EQ(pDrm, executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->getDrm());
|
||||
}
|
||||
|
||||
TEST_F(DeviceFactoryLinuxTest, whenDrmIsNotCretedThenGetDevicesFails) {
|
||||
TEST_F(DeviceFactoryLinuxTest, whenDrmIsNotCretedThenPrepareDeviceEnvironmentsFails) {
|
||||
delete pDrm;
|
||||
pDrm = nullptr;
|
||||
|
||||
bool success = DeviceFactory::getDevices(executionEnvironment);
|
||||
bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
||||
EXPECT_FALSE(success);
|
||||
}
|
||||
|
||||
@@ -3431,7 +3431,7 @@ TEST(DrmMemoryMangerTest, givenMultipleRootDeviceWhenMemoryManagerGetsDrmThenDrm
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(4);
|
||||
VariableBackup<UltHwConfig> backup{&ultHwConfig};
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
initPlatform();
|
||||
|
||||
TestedDrmMemoryManager drmMemoryManager(*platform()->peekExecutionEnvironment());
|
||||
|
||||
@@ -1874,9 +1874,9 @@ TEST(WddmMemoryManager, givenMultipleRootDeviceWhenMemoryManagerGetsWddmThenWddm
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(4);
|
||||
VariableBackup<UltHwConfig> backup{&ultHwConfig};
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
getDevices(*executionEnvironment);
|
||||
prepareDeviceEnvironments(*executionEnvironment);
|
||||
|
||||
MockWddmMemoryManager wddmMemoryManager(*executionEnvironment);
|
||||
for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) {
|
||||
@@ -1890,9 +1890,9 @@ TEST(WddmMemoryManager, givenMultipleRootDeviceWhenCreateMemoryManagerThenTakeMa
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.CreateMultipleRootDevices.set(numRootDevices);
|
||||
VariableBackup<UltHwConfig> backup{&ultHwConfig};
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
getDevices(*executionEnvironment);
|
||||
prepareDeviceEnvironments(*executionEnvironment);
|
||||
for (auto i = 0u; i < numRootDevices; i++) {
|
||||
auto wddm = static_cast<WddmMock *>(executionEnvironment->rootDeviceEnvironments[i]->osInterface->get()->getWddm());
|
||||
wddm->minAddress = i * (numRootDevices - i);
|
||||
@@ -1907,9 +1907,9 @@ TEST(WddmMemoryManager, givenNoLocalMemoryOnAnyDeviceWhenIsCpuCopyRequiredIsCall
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.EnableLocalMemory.set(false);
|
||||
VariableBackup<UltHwConfig> backup{&ultHwConfig};
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
getDevices(*executionEnvironment);
|
||||
prepareDeviceEnvironments(*executionEnvironment);
|
||||
MockWddmMemoryManager wddmMemoryManager(*executionEnvironment);
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&restorer));
|
||||
}
|
||||
@@ -1917,8 +1917,8 @@ TEST(WddmMemoryManager, givenNoLocalMemoryOnAnyDeviceWhenIsCpuCopyRequiredIsCall
|
||||
TEST(WddmMemoryManager, givenLocalPointerPassedToIsCpuCopyRequiredThenFalseIsReturned) {
|
||||
auto executionEnvironment = platform()->peekExecutionEnvironment();
|
||||
VariableBackup<UltHwConfig> backup{&ultHwConfig};
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
getDevices(*executionEnvironment);
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
prepareDeviceEnvironments(*executionEnvironment);
|
||||
MockWddmMemoryManager wddmMemoryManager(*executionEnvironment);
|
||||
EXPECT_FALSE(wddmMemoryManager.isCpuCopyRequired(&backup));
|
||||
//call multiple times to make sure that result is constant
|
||||
|
||||
@@ -94,7 +94,7 @@ TEST_F(WddmMemoryOperationsHandlerTest, givenVariousAllocationsWhenEvictingResid
|
||||
|
||||
TEST(WddmResidentBufferTests, whenBuffersIsCreatedWithMakeResidentFlagSetThenItIsMadeResidentUponCreation) {
|
||||
VariableBackup<UltHwConfig> backup(&ultHwConfig);
|
||||
ultHwConfig.useMockedGetDevicesFunc = false;
|
||||
ultHwConfig.useMockedPrepareDeviceEnvironmentsFunc = false;
|
||||
DebugManagerStateRestore restorer;
|
||||
DebugManager.flags.MakeAllBuffersResident.set(true);
|
||||
|
||||
|
||||
@@ -10,29 +10,28 @@
|
||||
#include "shared/source/helpers/hw_info.h"
|
||||
#include "shared/source/os_interface/device_factory.h"
|
||||
|
||||
#include "opencl/source/platform/platform.h"
|
||||
#include "test.h"
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
using GetDevicesTests = ::testing::Test;
|
||||
using PrepareDeviceEnvironmentsTests = ::testing::Test;
|
||||
|
||||
HWTEST_F(GetDevicesTests, WhenGetDevicesIsCalledThenSuccessIsReturned) {
|
||||
HWTEST_F(PrepareDeviceEnvironmentsTests, WhenPrepareDeviceEnvironmentsIsCalledThenSuccessIsReturned) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
|
||||
auto returnValue = DeviceFactory::getDevices(executionEnvironment);
|
||||
auto returnValue = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
||||
EXPECT_EQ(true, returnValue);
|
||||
}
|
||||
|
||||
HWTEST_F(GetDevicesTests, whenGetDevicesIsCalledThenGmmIsBeingInitializedAfterFillingHwInfo) {
|
||||
platformsImpl.clear();
|
||||
auto executionEnvironment = new ExecutionEnvironment();
|
||||
platformsImpl.push_back(std::make_unique<Platform>(*executionEnvironment));
|
||||
executionEnvironment->prepareRootDeviceEnvironments(1u);
|
||||
auto hwInfo = executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
||||
HWTEST_F(PrepareDeviceEnvironmentsTests, whenPrepareDeviceEnvironmentsIsCalledThenGmmIsBeingInitializedAfterFillingHwInfo) {
|
||||
ExecutionEnvironment executionEnvironment;
|
||||
executionEnvironment.prepareRootDeviceEnvironments(1u);
|
||||
auto hwInfo = executionEnvironment.rootDeviceEnvironments[0]->getMutableHardwareInfo();
|
||||
hwInfo->platform.eProductFamily = PRODUCT_FAMILY::IGFX_UNKNOWN;
|
||||
hwInfo->platform.ePCHProductFamily = PCH_PRODUCT_FAMILY::PCH_UNKNOWN;
|
||||
EXPECT_EQ(nullptr, executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper());
|
||||
|
||||
auto returnValue = DeviceFactory::getDevices(*executionEnvironment);
|
||||
auto returnValue = DeviceFactory::prepareDeviceEnvironments(executionEnvironment);
|
||||
EXPECT_TRUE(returnValue);
|
||||
EXPECT_NE(nullptr, executionEnvironment.rootDeviceEnvironments[0]->getGmmHelper());
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
namespace NEO {
|
||||
|
||||
bool DeviceFactory::getDevicesForProductFamilyOverride(ExecutionEnvironment &executionEnvironment) {
|
||||
bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionEnvironment &executionEnvironment) {
|
||||
auto numRootDevices = 1u;
|
||||
if (DebugManager.flags.CreateMultipleRootDevices.get()) {
|
||||
numRootDevices = DebugManager.flags.CreateMultipleRootDevices.get();
|
||||
@@ -82,7 +82,7 @@ bool DeviceFactory::isHwModeSelected() {
|
||||
}
|
||||
}
|
||||
|
||||
bool DeviceFactory::getDevices(ExecutionEnvironment &executionEnvironment) {
|
||||
bool DeviceFactory::prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment) {
|
||||
using HwDeviceIds = std::vector<std::unique_ptr<HwDeviceId>>;
|
||||
|
||||
HwDeviceIds hwDeviceIds = OSInterface::discoverDevices(executionEnvironment);
|
||||
@@ -114,7 +114,7 @@ bool DeviceFactory::getDevices(ExecutionEnvironment &executionEnvironment) {
|
||||
|
||||
std::vector<std::unique_ptr<Device>> DeviceFactory::createDevices(ExecutionEnvironment &executionEnvironment) {
|
||||
std::vector<std::unique_ptr<Device>> devices;
|
||||
auto status = NEO::getDevices(executionEnvironment);
|
||||
auto status = NEO::prepareDeviceEnvironments(executionEnvironment);
|
||||
if (!status) {
|
||||
return devices;
|
||||
}
|
||||
|
||||
@@ -14,11 +14,11 @@ namespace NEO {
|
||||
|
||||
class ExecutionEnvironment;
|
||||
class Device;
|
||||
bool getDevices(ExecutionEnvironment &executionEnvironment);
|
||||
bool prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment);
|
||||
class DeviceFactory {
|
||||
public:
|
||||
static bool getDevices(ExecutionEnvironment &executionEnvironment);
|
||||
static bool getDevicesForProductFamilyOverride(ExecutionEnvironment &executionEnvironment);
|
||||
static bool prepareDeviceEnvironments(ExecutionEnvironment &executionEnvironment);
|
||||
static bool prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionEnvironment &executionEnvironment);
|
||||
static std::vector<std::unique_ptr<Device>> createDevices(ExecutionEnvironment &executionEnvironment);
|
||||
static bool isHwModeSelected();
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#pragma once
|
||||
namespace NEO {
|
||||
struct UltHwConfig {
|
||||
bool mockedGetDevicesFuncResult = true;
|
||||
bool mockedPrepareDeviceEnvironmentsFuncResult = true;
|
||||
bool useHwCsr = false;
|
||||
bool useMockedGetDevicesFunc = true;
|
||||
bool useMockedPrepareDeviceEnvironmentsFunc = true;
|
||||
bool forceOsAgnosticMemoryManager = true;
|
||||
|
||||
bool csrFailInitDirectSubmission = false;
|
||||
|
||||
Reference in New Issue
Block a user