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