From 25aea40e84bb0b62ae799702b4be0a97f784264a Mon Sep 17 00:00:00 2001 From: Mateusz Jablonski Date: Tue, 24 Mar 2020 17:52:43 +0100 Subject: [PATCH] Remove platformDevices from os_interface, platform, program, sharings and source_level_debugger Related-To: NEO-4499 Change-Id: I09c28e8c167b00b80eaff8f86c8e58cea78ed3b1 Signed-off-by: Mateusz Jablonski --- .../unit_test/os_interface/device_factory_tests.cpp | 10 +++++----- .../os_interface/linux/device_command_stream_fixture.h | 2 +- .../os_interface/linux/device_factory_tests.cpp | 2 +- .../unit_test/os_interface/linux/device_os_tests.cpp | 8 ++++---- .../os_interface/linux/drm_command_stream_mm_tests.cpp | 4 ++-- .../os_interface/linux/drm_command_stream_tests.cpp | 2 +- .../os_interface/linux/drm_gem_close_worker_tests.cpp | 2 +- ...rm_memory_manager_allocate_in_device_pool_tests.cpp | 6 +++--- .../os_interface/linux/drm_memory_manager_tests.cpp | 10 +++++----- .../os_interface/linux/drm_memory_manager_tests.h | 10 +++++----- .../unit_test/os_interface/linux/drm_neo_create.cpp | 2 +- .../unit_test/os_interface/windows/device_os_tests.cpp | 8 ++++---- .../os_interface/windows/driver_info_tests.cpp | 2 +- .../unit_test/os_interface/windows/gdi_dll_fixture.h | 2 +- .../unit_test/os_interface/windows/wddm20_tests.cpp | 4 ++-- .../os_interface/windows/wddm_memory_manager_tests.cpp | 10 +++++----- opencl/test/unit_test/platform/platform_tests.cpp | 8 ++++---- opencl/test/unit_test/program/kernel_info_tests.cpp | 4 ++-- opencl/test/unit_test/program/program_tests.cpp | 2 +- .../gl/windows/gl_create_from_texture_tests.cpp | 2 +- .../test/unit_test/sharings/sharing_factory_tests.cpp | 2 +- .../sharings/unified/unified_sharing_fixtures.h | 2 +- .../sharings/unified/unified_sharing_tests.cpp | 2 +- .../source_level_debugger_tests.cpp | 6 +++--- 24 files changed, 56 insertions(+), 56 deletions(-) diff --git a/opencl/test/unit_test/os_interface/device_factory_tests.cpp b/opencl/test/unit_test/os_interface/device_factory_tests.cpp index 52c61119ad..dc35516520 100644 --- a/opencl/test/unit_test/os_interface/device_factory_tests.cpp +++ b/opencl/test/unit_test/os_interface/device_factory_tests.cpp @@ -29,7 +29,7 @@ OsLibrary *setAdapterInfo(const PLATFORM *platform, const GT_SYSTEM_INFO *gtSyst struct DeviceFactoryTest : public ::testing::Test { public: void SetUp() override { - const HardwareInfo *hwInfo = platformDevices[0]; + const HardwareInfo *hwInfo = defaultHwInfo.get(); executionEnvironment = platform()->peekExecutionEnvironment(); mockGdiDll = setAdapterInfo(&hwInfo->platform, &hwInfo->gtSystemInfo, hwInfo->capabilityTable.gpuAddressSpace); } @@ -44,7 +44,7 @@ struct DeviceFactoryTest : public ::testing::Test { }; TEST_F(DeviceFactoryTest, PrepareDeviceEnvironments_Check_HwInfo_Platform) { - const HardwareInfo *refHwinfo = *platformDevices; + const HardwareInfo *refHwinfo = defaultHwInfo.get(); bool success = DeviceFactory::prepareDeviceEnvironments(*executionEnvironment); EXPECT_TRUE(success); @@ -149,7 +149,7 @@ TEST_F(DeviceFactoryTest, whenPrepareDeviceEnvironmentsIsCalledThenAllRootDevice auto requiredDeviceCount = 2u; DebugManager.flags.CreateMultipleRootDevices.set(requiredDeviceCount); - MockExecutionEnvironment executionEnvironment(*platformDevices, true, requiredDeviceCount); + MockExecutionEnvironment executionEnvironment(defaultHwInfo.get(), true, requiredDeviceCount); bool success = DeviceFactory::prepareDeviceEnvironments(executionEnvironment); ASSERT_TRUE(success); @@ -175,7 +175,7 @@ TEST_F(DeviceFactoryTest, givenInvalidHwConfigStringPrepareDeviceEnvironmentsFor DebugManagerStateRestore stateRestore; DebugManager.flags.HardwareInfoOverride.set("1x3"); - MockExecutionEnvironment executionEnvironment(*platformDevices); + MockExecutionEnvironment executionEnvironment(defaultHwInfo.get()); bool success = DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment); EXPECT_FALSE(success); @@ -185,7 +185,7 @@ TEST_F(DeviceFactoryTest, givenValidHwConfigStringPrepareDeviceEnvironmentsForPr DebugManagerStateRestore stateRestore; DebugManager.flags.HardwareInfoOverride.set("1x1x1"); - MockExecutionEnvironment executionEnvironment(*platformDevices); + MockExecutionEnvironment executionEnvironment(defaultHwInfo.get()); EXPECT_ANY_THROW(DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(executionEnvironment)); } diff --git a/opencl/test/unit_test/os_interface/linux/device_command_stream_fixture.h b/opencl/test/unit_test/os_interface/linux/device_command_stream_fixture.h index 92c5e43121..c856b87491 100644 --- a/opencl/test/unit_test/os_interface/linux/device_command_stream_fixture.h +++ b/opencl/test/unit_test/os_interface/linux/device_command_stream_fixture.h @@ -337,7 +337,7 @@ class DrmMockCustom : public Drm { DrmMockCustom() : Drm(std::make_unique(mockFd), *constructPlatform()->peekExecutionEnvironment()->rootDeviceEnvironments[0]) { reset(); - ioctl_expected.contextCreate = static_cast(NEO::HwHelper::get(NEO::defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*NEO::platformDevices[0]).size()); + ioctl_expected.contextCreate = static_cast(NEO::HwHelper::get(NEO::defaultHwInfo->platform.eRenderCoreFamily).getGpgpuEngineInstances(*NEO::defaultHwInfo).size()); ioctl_expected.contextDestroy = ioctl_expected.contextCreate.load(); } int getErrno() override { diff --git a/opencl/test/unit_test/os_interface/linux/device_factory_tests.cpp b/opencl/test/unit_test/os_interface/linux/device_factory_tests.cpp index cd4ca1720a..2f1238263e 100644 --- a/opencl/test/unit_test/os_interface/linux/device_factory_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/device_factory_tests.cpp @@ -13,7 +13,7 @@ #include "shared/test/unit_test/helpers/default_hw_info.h" TEST_F(DeviceFactoryLinuxTest, PrepareDeviceEnvironmentsCheckEUCntSSCnt) { - const HardwareInfo *refHwinfo = *platformDevices; + const HardwareInfo *refHwinfo = defaultHwInfo.get(); pDrm->StoredEUVal = 11; pDrm->StoredSSVal = 8; diff --git a/opencl/test/unit_test/os_interface/linux/device_os_tests.cpp b/opencl/test/unit_test/os_interface/linux/device_os_tests.cpp index 12c10d47ba..aa939d9ae2 100644 --- a/opencl/test/unit_test/os_interface/linux/device_os_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/device_os_tests.cpp @@ -25,7 +25,7 @@ using namespace ::testing; namespace NEO { TEST(DeviceOsTest, GivenDefaultClDeviceWhenCheckingForOsSpecificExtensionsThenCorrectExtensionsAreSet) { - auto hwInfo = *platformDevices; + auto hwInfo = defaultHwInfo.get(); auto pDevice = MockDevice::createWithNewExecutionEnvironment(hwInfo); auto pClDevice = new ClDevice{*pDevice, platform()}; @@ -42,7 +42,7 @@ TEST(DeviceOsTest, GivenDefaultClDeviceWhenCheckingForOsSpecificExtensionsThenCo } TEST(DeviceOsTest, supportedSimultaneousInterops) { - auto pDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + auto pDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); std::vector expected = {0}; @@ -50,7 +50,7 @@ TEST(DeviceOsTest, supportedSimultaneousInterops) { } TEST(DeviceOsTest, DeviceCreationFail) { - auto hwInfo = *platformDevices; + auto hwInfo = defaultHwInfo.get(); auto pDevice = MockDevice::createWithNewExecutionEnvironment(hwInfo); EXPECT_THAT(pDevice, nullptr); @@ -101,7 +101,7 @@ TEST(ApiOsTest, notSupportedApiList) { TEST(DeviceOsTest, DeviceCreationFailMidThreadPreemption) { DebugManagerStateRestore dbgRestore; DebugManager.flags.ForcePreemptionMode.set(static_cast(PreemptionMode::MidThread)); - auto pDevice = MockDevice::createWithNewExecutionEnvironment(*platformDevices); + auto pDevice = MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get()); EXPECT_THAT(pDevice, nullptr); } diff --git a/opencl/test/unit_test/os_interface/linux/drm_command_stream_mm_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_command_stream_mm_tests.cpp index 4824785bdc..194e84bff8 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_command_stream_mm_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_command_stream_mm_tests.cpp @@ -48,7 +48,7 @@ HWTEST_F(DrmCommandStreamMMTest, givenForcePinDisabledWhenMemoryManagerIsCreated auto drm = new DrmMockCustom(); MockExecutionEnvironment executionEnvironment; - executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(*platformDevices); + executionEnvironment.rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get()); executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique(); executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->setDrm(drm); @@ -66,7 +66,7 @@ HWTEST_F(DrmCommandStreamMMTest, givenExecutionEnvironmentWithMoreThanOneRootDev executionEnvironment.prepareRootDeviceEnvironments(2); for (uint32_t rootDeviceIndex = 0; rootDeviceIndex < executionEnvironment.rootDeviceEnvironments.size(); rootDeviceIndex++) { - executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(*platformDevices); + executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->setHwInfo(defaultHwInfo.get()); executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->osInterface = std::make_unique(); executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->osInterface->get()->setDrm(new DrmMockCustom()); executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->memoryOperationsInterface = std::make_unique(); diff --git a/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp index f7fa1d2f57..62c5fabe07 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_command_stream_tests.cpp @@ -1386,7 +1386,7 @@ struct MockDrmCsr : public DrmCommandStreamReceiver { HWTEST_TEMPLATED_F(DrmCommandStreamTest, givenDrmCommandStreamReceiverWhenCreatePageTableMngrIsCalledThenCreatePageTableManager) { executionEnvironment.prepareRootDeviceEnvironments(2); - executionEnvironment.rootDeviceEnvironments[1]->setHwInfo(*platformDevices); + executionEnvironment.rootDeviceEnvironments[1]->setHwInfo(defaultHwInfo.get()); executionEnvironment.rootDeviceEnvironments[1]->initGmm(); executionEnvironment.rootDeviceEnvironments[1]->osInterface = std::make_unique(); executionEnvironment.rootDeviceEnvironments[1]->osInterface->get()->setDrm(new DrmMockCustom()); diff --git a/opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp index c25a9318cb..a799ef94b5 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_gem_close_worker_tests.cpp @@ -56,7 +56,7 @@ class DrmMockForWorker : public Drm { class DrmGemCloseWorkerFixture { public: - DrmGemCloseWorkerFixture() : executionEnvironment(*platformDevices){}; + DrmGemCloseWorkerFixture() : executionEnvironment(defaultHwInfo.get()){}; //max loop count for while static const uint32_t deadCntInit = 10 * 1000 * 1000; diff --git a/opencl/test/unit_test/os_interface/linux/drm_memory_manager_allocate_in_device_pool_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_memory_manager_allocate_in_device_pool_tests.cpp index 8f62b24e30..488748d375 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_memory_manager_allocate_in_device_pool_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_memory_manager_allocate_in_device_pool_tests.cpp @@ -21,7 +21,7 @@ using namespace NEO; using AllocationData = TestedDrmMemoryManager::AllocationData; TEST(DrmMemoryManagerSimpleTest, givenDrmMemoryManagerWhenAllocateInDevicePoolIsCalledThenNullptrAndStatusRetryIsReturned) { - MockExecutionEnvironment executionEnvironment(*platformDevices); + MockExecutionEnvironment executionEnvironment(defaultHwInfo.get()); executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique(); executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->setDrm(Drm::create(nullptr, *executionEnvironment.rootDeviceEnvironments[0])); TestedDrmMemoryManager memoryManager(executionEnvironment); @@ -37,7 +37,7 @@ TEST(DrmMemoryManagerSimpleTest, givenDrmMemoryManagerWhenAllocateInDevicePoolIs } TEST(DrmMemoryManagerSimpleTest, givenDrmMemoryManagerWhenLockResourceIsCalledOnNullBufferObjectThenReturnNullPtr) { - MockExecutionEnvironment executionEnvironment(*platformDevices); + MockExecutionEnvironment executionEnvironment(defaultHwInfo.get()); executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique(); TestedDrmMemoryManager memoryManager(executionEnvironment); DrmAllocation drmAllocation(0, GraphicsAllocation::AllocationType::UNKNOWN, nullptr, nullptr, 0u, 0u, MemoryPool::LocalMemory); @@ -49,7 +49,7 @@ TEST(DrmMemoryManagerSimpleTest, givenDrmMemoryManagerWhenLockResourceIsCalledOn } TEST(DrmMemoryManagerSimpleTest, givenDrmMemoryManagerWhenFreeGraphicsMemoryIsCalledOnAllocationWithNullBufferObjectThenEarlyReturn) { - MockExecutionEnvironment executionEnvironment(*platformDevices); + MockExecutionEnvironment executionEnvironment(defaultHwInfo.get()); executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique(); TestedDrmMemoryManager memoryManager(executionEnvironment); diff --git a/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp b/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp index 38d2cb8cdc..752a60d45d 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.cpp @@ -513,7 +513,7 @@ TEST(DrmMemoryManagerTest2, givenDrmMemoryManagerWhengetSystemSharedMemoryIsCall auto executionEnvironment = std::make_unique(); executionEnvironment->prepareRootDeviceEnvironments(4u); for (auto i = 0u; i < 4u; i++) { - executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(*platformDevices); + executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get()); } auto memoryManager = std::make_unique(false, false, false, *executionEnvironment); @@ -545,7 +545,7 @@ TEST(DrmMemoryManagerTest2, getMinimumSystemSharedMemory) { auto executionEnvironment = std::make_unique(); executionEnvironment->prepareRootDeviceEnvironments(4u); for (auto i = 0u; i < 4u; i++) { - executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(*platformDevices); + executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get()); } auto memoryManager = std::make_unique(false, false, false, *executionEnvironment); for (auto i = 0u; i < 4u; i++) { @@ -3346,7 +3346,7 @@ TEST(DrmMemoryManagerWithExplicitExpectationsTest2, whenObtainFdFromHandleIsCall auto executionEnvironment = std::make_unique(); executionEnvironment->prepareRootDeviceEnvironments(4u); for (auto i = 0u; i < 4u; i++) { - executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(*platformDevices); + executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get()); } auto memoryManager = std::make_unique(false, false, false, *executionEnvironment); for (auto i = 0u; i < 4u; i++) { @@ -3457,7 +3457,7 @@ class GMockDrmMemoryManager : public TestedDrmMemoryManager { }; TEST(DrmMemoryManagerFreeGraphicsMemoryCallSequenceTest, givenDrmMemoryManagerAndFreeGraphicsMemoryIsCalledThenUnreferenceBufferObjectIsCalledFirstWithSynchronousDestroySetToTrue) { - MockExecutionEnvironment executionEnvironment(*platformDevices); + MockExecutionEnvironment executionEnvironment(defaultHwInfo.get()); executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique(); executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->setDrm(Drm::create(nullptr, *executionEnvironment.rootDeviceEnvironments[0])); GMockDrmMemoryManager gmockDrmMemoryManager(executionEnvironment); @@ -3477,7 +3477,7 @@ TEST(DrmMemoryManagerFreeGraphicsMemoryCallSequenceTest, givenDrmMemoryManagerAn } TEST(DrmMemoryManagerFreeGraphicsMemoryUnreferenceTest, givenDrmMemoryManagerAndFreeGraphicsMemoryIsCalledForSharedAllocationThenUnreferenceBufferObjectIsCalledWithSynchronousDestroySetToFalse) { - MockExecutionEnvironment executionEnvironment(*platformDevices); + MockExecutionEnvironment executionEnvironment(defaultHwInfo.get()); executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique(); executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->setDrm(Drm::create(nullptr, *executionEnvironment.rootDeviceEnvironments[0])); ::testing::NiceMock gmockDrmMemoryManager(executionEnvironment); diff --git a/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.h b/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.h index 0252734fb3..b7635aa8df 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.h +++ b/opencl/test/unit_test/os_interface/linux/drm_memory_manager_tests.h @@ -24,7 +24,7 @@ using AllocationData = TestedDrmMemoryManager::AllocationData; class DrmMemoryManagerBasic : public ::testing::Test { public: - DrmMemoryManagerBasic() : executionEnvironment(*platformDevices){}; + DrmMemoryManagerBasic() : executionEnvironment(defaultHwInfo.get()){}; void SetUp() override { executionEnvironment.rootDeviceEnvironments[0]->osInterface = std::make_unique(); executionEnvironment.rootDeviceEnvironments[0]->osInterface->get()->setDrm(Drm::create(nullptr, *executionEnvironment.rootDeviceEnvironments[0])); @@ -47,7 +47,7 @@ class DrmMemoryManagerFixture : public MemoryManagementFixture { void SetUp(DrmMockCustom *mock, bool localMemoryEnabled) { this->mock = mock; - executionEnvironment = new MockExecutionEnvironment(*platformDevices); + executionEnvironment = new MockExecutionEnvironment(defaultHwInfo.get()); executionEnvironment->incRefInternal(); rootDeviceEnvironment = executionEnvironment->rootDeviceEnvironments[0].get(); rootDeviceEnvironment->osInterface = std::make_unique(); @@ -59,7 +59,7 @@ class DrmMemoryManagerFixture : public MemoryManagementFixture { if (memoryManager->getgemCloseWorker()) { memoryManager->getgemCloseWorker()->close(true); } - device = new MockClDevice{MockDevice::createWithExecutionEnvironment(*platformDevices, executionEnvironment, 0)}; + device = new MockClDevice{MockDevice::createWithExecutionEnvironment(defaultHwInfo.get(), executionEnvironment, 0)}; } void TearDown() override { @@ -97,7 +97,7 @@ class DrmMemoryManagerFixtureWithoutQuietIoctlExpectation { void SetUp() { executionEnvironment = new ExecutionEnvironment; executionEnvironment->prepareRootDeviceEnvironments(1); - executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(*platformDevices); + executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get()); mock = new DrmMockCustom(); executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique(); executionEnvironment->rootDeviceEnvironments[0]->osInterface->get()->setDrm(mock); @@ -107,7 +107,7 @@ class DrmMemoryManagerFixtureWithoutQuietIoctlExpectation { if (memoryManager->getgemCloseWorker()) { memoryManager->getgemCloseWorker()->close(true); } - device.reset(MockDevice::createWithExecutionEnvironment(*platformDevices, executionEnvironment, 0)); + device.reset(MockDevice::createWithExecutionEnvironment(defaultHwInfo.get(), executionEnvironment, 0)); } void TearDown() { diff --git a/opencl/test/unit_test/os_interface/linux/drm_neo_create.cpp b/opencl/test/unit_test/os_interface/linux/drm_neo_create.cpp index b3bae96e04..eb429c698b 100644 --- a/opencl/test/unit_test/os_interface/linux/drm_neo_create.cpp +++ b/opencl/test/unit_test/os_interface/linux/drm_neo_create.cpp @@ -31,7 +31,7 @@ class DrmMockDefault : public DrmMock { Drm **pDrmToReturnFromCreateFunc = nullptr; Drm *Drm::create(std::unique_ptr hwDeviceId, RootDeviceEnvironment &rootDeviceEnvironment) { - rootDeviceEnvironment.setHwInfo(platformDevices[0]); + rootDeviceEnvironment.setHwInfo(defaultHwInfo.get()); if (pDrmToReturnFromCreateFunc) { return *pDrmToReturnFromCreateFunc; } diff --git a/opencl/test/unit_test/os_interface/windows/device_os_tests.cpp b/opencl/test/unit_test/os_interface/windows/device_os_tests.cpp index 68e7dd9876..9dde187455 100644 --- a/opencl/test/unit_test/os_interface/windows/device_os_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/device_os_tests.cpp @@ -21,7 +21,7 @@ using namespace ::testing; namespace NEO { TEST(DeviceOsTest, GivenDefaultClDeviceWhenCheckingForOsSpecificExtensionsThenCorrectExtensionsAreSet) { - auto hwInfo = *platformDevices; + auto hwInfo = defaultHwInfo.get(); auto pDevice = MockDevice::createWithNewExecutionEnvironment(hwInfo); auto pClDevice = new ClDevice{*pDevice, platform()}; @@ -39,7 +39,7 @@ TEST(DeviceOsTest, GivenDefaultClDeviceWhenCheckingForOsSpecificExtensionsThenCo } TEST(DeviceOsTest, supportedSimultaneousInterops) { - auto pDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + auto pDevice = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); std::vector expected = {CL_GL_CONTEXT_KHR, CL_WGL_HDC_KHR, @@ -57,7 +57,7 @@ TEST(DeviceOsTest, supportedSimultaneousInterops) { } TEST(DeviceOsTest, DeviceCreationFail) { - auto hwInfo = *platformDevices; + auto hwInfo = defaultHwInfo.get(); auto pDevice = MockDevice::createWithNewExecutionEnvironment(hwInfo); EXPECT_THAT(pDevice, nullptr); @@ -66,7 +66,7 @@ TEST(DeviceOsTest, DeviceCreationFail) { TEST(DeviceOsTest, DeviceCreationFailMidThreadPreemption) { DebugManagerStateRestore dbgRestore; DebugManager.flags.ForcePreemptionMode.set(static_cast(PreemptionMode::MidThread)); - auto pDevice = MockDevice::createWithNewExecutionEnvironment(*platformDevices); + auto pDevice = MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get()); EXPECT_THAT(pDevice, nullptr); } diff --git a/opencl/test/unit_test/os_interface/windows/driver_info_tests.cpp b/opencl/test/unit_test/os_interface/windows/driver_info_tests.cpp index 6412e38cbc..03003c6f0e 100644 --- a/opencl/test/unit_test/os_interface/windows/driver_info_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/driver_info_tests.cpp @@ -39,7 +39,7 @@ CommandStreamReceiver *createMockCommandStreamReceiver(bool withAubDump, Executi class DriverInfoDeviceTest : public ::testing::Test { public: void SetUp() { - hwInfo = platformDevices[0]; + hwInfo = defaultHwInfo.get(); commandStreamReceiverCreateFunc = commandStreamReceiverFactory[hwInfo->platform.eRenderCoreFamily]; commandStreamReceiverFactory[hwInfo->platform.eRenderCoreFamily] = createMockCommandStreamReceiver; } diff --git a/opencl/test/unit_test/os_interface/windows/gdi_dll_fixture.h b/opencl/test/unit_test/os_interface/windows/gdi_dll_fixture.h index 3d17c58faf..c408da9768 100644 --- a/opencl/test/unit_test/os_interface/windows/gdi_dll_fixture.h +++ b/opencl/test/unit_test/os_interface/windows/gdi_dll_fixture.h @@ -18,7 +18,7 @@ OsLibrary *setAdapterInfo(const PLATFORM *platform, const GT_SYSTEM_INFO *gtSyst struct GdiDllFixture { virtual void SetUp() { - const HardwareInfo *hwInfo = platformDevices[0]; + const HardwareInfo *hwInfo = defaultHwInfo.get(); mockGdiDll.reset(setAdapterInfo(&hwInfo->platform, &hwInfo->gtSystemInfo, hwInfo->capabilityTable.gpuAddressSpace)); setSizesFcn = reinterpret_cast(mockGdiDll->getProcAddress("MockSetSizes")); diff --git a/opencl/test/unit_test/os_interface/windows/wddm20_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm20_tests.cpp index b062425efc..7837c02e0d 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm20_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm20_tests.cpp @@ -128,7 +128,7 @@ TEST(WddmDiscoverDevices, WhenAdapterDescriptionContainsVirtualRenderThenAdapter TEST(Wddm20EnumAdaptersTest, expectTrue) { - const HardwareInfo *hwInfo = platformDevices[0]; + const HardwareInfo *hwInfo = defaultHwInfo.get(); std::unique_ptr mockGdiDll(setAdapterInfo(&hwInfo->platform, &hwInfo->gtSystemInfo, hwInfo->capabilityTable.gpuAddressSpace)); @@ -144,7 +144,7 @@ TEST(Wddm20EnumAdaptersTest, expectTrue) { } TEST(Wddm20EnumAdaptersTest, givenEmptyHardwareInfoWhenEnumAdapterIsCalledThenCapabilityTableIsSet) { - const HardwareInfo *hwInfo = platformDevices[0]; + const HardwareInfo *hwInfo = defaultHwInfo.get(); std::unique_ptr mockGdiDll(setAdapterInfo(&hwInfo->platform, &hwInfo->gtSystemInfo, hwInfo->capabilityTable.gpuAddressSpace)); diff --git a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp index a23ef75702..14fbe19ee8 100644 --- a/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp +++ b/opencl/test/unit_test/os_interface/windows/wddm_memory_manager_tests.cpp @@ -350,7 +350,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSingleEngineRegister TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValuesOnMultipleEnginesRegisteredWhenHandleFenceCompletionIsCalledThenWaitOnCpuForEachEngine) { executionEnvironment->prepareRootDeviceEnvironments(2u); for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) { - executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(*platformDevices); + executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get()); } std::unique_ptr csr(createCommandStream(*executionEnvironment, 1u)); @@ -383,7 +383,7 @@ TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValuesOnMultipleEnginesRegi TEST_F(WddmMemoryManagerSimpleTest, givenNonZeroFenceValueOnSomeOfMultipleEnginesRegisteredWhenHandleFenceCompletionIsCalledThenWaitOnCpuForTheseEngines) { executionEnvironment->prepareRootDeviceEnvironments(2u); for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) { - executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(*platformDevices); + executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get()); } std::unique_ptr csr(createCommandStream(*executionEnvironment, 1u)); @@ -692,7 +692,7 @@ HWTEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWhenTiledImageIsBeingCreat GTEST_SKIP(); } - auto device = std::make_unique(MockDevice::createWithExecutionEnvironment(*platformDevices, executionEnvironment, 0u)); + auto device = std::make_unique(MockDevice::createWithExecutionEnvironment(defaultHwInfo.get(), executionEnvironment, 0u)); MockContext context(device.get()); context.memoryManager = memoryManager.get(); @@ -1450,7 +1450,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerAnd32bitBuildThenSvmPartitio TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWhenCallingIsMemoryBudgetExhaustedThenReturnFalse) { executionEnvironment->prepareRootDeviceEnvironments(3u); for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) { - executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(*platformDevices); + executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get()); } executionEnvironment->initializeMemoryManager(); for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) { @@ -1475,7 +1475,7 @@ TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWhenC TEST_F(WddmMemoryManagerTest, givenWddmMemoryManagerWithRegisteredOsContextWithExhaustedMemoryBudgetWhenCallingIsMemoryBudgetExhaustedThenReturnTrue) { executionEnvironment->prepareRootDeviceEnvironments(3u); for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) { - executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(*platformDevices); + executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get()); } executionEnvironment->initializeMemoryManager(); for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) { diff --git a/opencl/test/unit_test/platform/platform_tests.cpp b/opencl/test/unit_test/platform/platform_tests.cpp index 3c8c4d8e2e..30071caa3d 100644 --- a/opencl/test/unit_test/platform/platform_tests.cpp +++ b/opencl/test/unit_test/platform/platform_tests.cpp @@ -227,7 +227,7 @@ class PlatformFailingTest : public PlatformTest { } void SetUp() override { PlatformTest::SetUp(); - hwInfo = platformDevices[0]; + hwInfo = defaultHwInfo.get(); commandStreamReceiverCreateFunc = commandStreamReceiverFactory[hwInfo->platform.eRenderCoreFamily]; commandStreamReceiverFactory[hwInfo->platform.eRenderCoreFamily] = createMockCommandStreamReceiver; } @@ -252,7 +252,7 @@ TEST_F(PlatformFailingTest, givenPlatformInitializationWhenIncorrectHwInfoThenIn TEST_F(PlatformTest, givenSupportingCl21WhenPlatformSupportsFp64ThenFillMatchingSubstringsAndMandatoryTrailingSpace) { const HardwareInfo *hwInfo; - hwInfo = platformDevices[0]; + hwInfo = defaultHwInfo.get(); std::string extensionsList = getExtensionsList(*hwInfo); std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str()); @@ -307,7 +307,7 @@ TEST_F(PlatformTest, givenNotSupportingCl21WhenPlatformNotSupportFp64ThenNotFill TEST_F(PlatformTest, givenFtrSupportAtomicsWhenCreateExtentionsListThenGetMatchingSubstrings) { const HardwareInfo *hwInfo; - hwInfo = platformDevices[0]; + hwInfo = defaultHwInfo.get(); std::string extensionsList = getExtensionsList(*hwInfo); std::string compilerExtensions = convertEnabledExtensionsToCompilerInternalOptions(extensionsList.c_str()); @@ -395,7 +395,7 @@ TEST(PlatformInitTest, givenInitializedPlatformWhenInitializeIsCalledOneMoreTime TEST(PlatformInitTest, givenSingleDeviceWithNonZeroRootDeviceIndexInPassedDeviceVectorWhenInitializePlatformThenCreateOnlyOneClDevice) { std::vector> devices; - auto executionEnvironment = new MockExecutionEnvironment(*platformDevices, false, 3); + auto executionEnvironment = new MockExecutionEnvironment(defaultHwInfo.get(), false, 3); devices.push_back(std::make_unique(executionEnvironment, 2)); auto status = platform()->initialize(std::move(devices)); EXPECT_TRUE(status); diff --git a/opencl/test/unit_test/program/kernel_info_tests.cpp b/opencl/test/unit_test/program/kernel_info_tests.cpp index d6ce569bb1..63077b1030 100644 --- a/opencl/test/unit_test/program/kernel_info_tests.cpp +++ b/opencl/test/unit_test/program/kernel_info_tests.cpp @@ -106,7 +106,7 @@ TEST(KernelInfo, decodeImageKernelArgument) { TEST(KernelInfoTest, givenKernelInfoWhenCreateKernelAllocationThenCopyWholeKernelHeapToKernelAllocation) { KernelInfo kernelInfo; - MockExecutionEnvironment executionEnvironment(*platformDevices); + MockExecutionEnvironment executionEnvironment(defaultHwInfo.get()); OsAgnosticMemoryManager memoryManager(executionEnvironment); SKernelBinaryHeaderCommon kernelHeader; const size_t heapSize = 0x40; @@ -135,7 +135,7 @@ class MyMemoryManager : public OsAgnosticMemoryManager { TEST(KernelInfoTest, givenKernelInfoWhenCreateKernelAllocationAndCannotAllocateMemoryThenReturnsFalse) { KernelInfo kernelInfo; - MockExecutionEnvironment executionEnvironment(*platformDevices); + MockExecutionEnvironment executionEnvironment(defaultHwInfo.get()); MyMemoryManager memoryManager(executionEnvironment); SKernelBinaryHeaderCommon kernelHeader; kernelInfo.heapInfo.pKernelHeader = &kernelHeader; diff --git a/opencl/test/unit_test/program/program_tests.cpp b/opencl/test/unit_test/program/program_tests.cpp index c9bc3e5325..4193e080e2 100644 --- a/opencl/test/unit_test/program/program_tests.cpp +++ b/opencl/test/unit_test/program/program_tests.cpp @@ -2757,7 +2757,7 @@ TEST_F(setProgramSpecializationConstantTests, givenInvalidGetSpecConstantsInfoRe TEST(setProgramSpecializationConstantTest, givenUninitializedCompilerinterfaceWhenSetProgramSpecializationConstantThenErrorIsReturned) { auto executionEnvironment = new MockExecutionEnvironment(); executionEnvironment->rootDeviceEnvironments[0] = std::make_unique(*executionEnvironment); - executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(*platformDevices); + executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(defaultHwInfo.get()); MockDevice mockDevice(executionEnvironment, 0); SpecializationConstantProgramMock mockProgram(*executionEnvironment); mockProgram.setDevice(&mockDevice); diff --git a/opencl/test/unit_test/sharings/gl/windows/gl_create_from_texture_tests.cpp b/opencl/test/unit_test/sharings/gl/windows/gl_create_from_texture_tests.cpp index b603c2de10..a6832c47ec 100644 --- a/opencl/test/unit_test/sharings/gl/windows/gl_create_from_texture_tests.cpp +++ b/opencl/test/unit_test/sharings/gl/windows/gl_create_from_texture_tests.cpp @@ -26,7 +26,7 @@ class CreateFromGlTexture : public ::testing::Test { // temp solution - we need to query size from GMM: class TempMM : public OsAgnosticMemoryManager { public: - TempMM() : OsAgnosticMemoryManager(*(new MockExecutionEnvironment(*platformDevices))) { + TempMM() : OsAgnosticMemoryManager(*(new MockExecutionEnvironment(defaultHwInfo.get()))) { mockExecutionEnvironment.reset(&executionEnvironment); } GraphicsAllocation *createGraphicsAllocationFromSharedHandle(osHandle handle, const AllocationProperties &properties, bool requireSpecificBitness) override { diff --git a/opencl/test/unit_test/sharings/sharing_factory_tests.cpp b/opencl/test/unit_test/sharings/sharing_factory_tests.cpp index 91b327a1ea..663cf0fca9 100644 --- a/opencl/test/unit_test/sharings/sharing_factory_tests.cpp +++ b/opencl/test/unit_test/sharings/sharing_factory_tests.cpp @@ -219,7 +219,7 @@ TEST(Context, givenMockSharingBuilderWhenContextWithInvalidPropertiesThenContext stateRestore.clearCurrentState(); stateRestore.registerSharing(SharingType::CLGL_SHARING); - auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); cl_device_id clDevice = device.get(); auto deviceVector = ClDeviceVector(&clDevice, 1); diff --git a/opencl/test/unit_test/sharings/unified/unified_sharing_fixtures.h b/opencl/test/unit_test/sharings/unified/unified_sharing_fixtures.h index cbb95badfa..f17ce748c4 100644 --- a/opencl/test/unit_test/sharings/unified/unified_sharing_fixtures.h +++ b/opencl/test/unit_test/sharings/unified/unified_sharing_fixtures.h @@ -19,7 +19,7 @@ namespace NEO { template struct UnifiedSharingContextFixture : ::testing::Test { void SetUp() override { - device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); cl_device_id deviceId = device.get(); deviceVector = std::make_unique(&deviceId, 1); if (validContext) { diff --git a/opencl/test/unit_test/sharings/unified/unified_sharing_tests.cpp b/opencl/test/unit_test/sharings/unified/unified_sharing_tests.cpp index 8d2fc5fd95..11d78e5cbd 100644 --- a/opencl/test/unit_test/sharings/unified/unified_sharing_tests.cpp +++ b/opencl/test/unit_test/sharings/unified/unified_sharing_tests.cpp @@ -19,7 +19,7 @@ using namespace NEO; TEST(UnifiedSharingTests, givenContextCreatedWithExternalDeviceHandlePropertyWhenGettingUnifiedSharingThenReturnIt) { - MockClDevice device{MockDevice::createWithNewExecutionEnvironment(*platformDevices)}; + MockClDevice device{MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())}; cl_device_id deviceId = &device; ClDeviceVector allDevs(&deviceId, 1); cl_int retVal{}; diff --git a/opencl/test/unit_test/source_level_debugger/source_level_debugger_tests.cpp b/opencl/test/unit_test/source_level_debugger/source_level_debugger_tests.cpp index bd47da20a7..5ab686feba 100644 --- a/opencl/test/unit_test/source_level_debugger/source_level_debugger_tests.cpp +++ b/opencl/test/unit_test/source_level_debugger/source_level_debugger_tests.cpp @@ -474,7 +474,7 @@ TEST(SourceLevelDebugger, givenKernelDebuggerLibraryActiveWhenDeviceImplIsCreate DebuggerLibrary::setDebuggerActive(true); DebuggerLibrary::injectDebuggerLibraryInterceptor(&interceptor); - unique_ptr device(MockDevice::createWithNewExecutionEnvironment(*platformDevices)); + unique_ptr device(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); unique_ptr pClDevice(new MockClDevice{device.get()}); EXPECT_TRUE(interceptor.newDeviceCalled); uint32_t deviceHandleExpected = device->getGpgpuCommandStreamReceiver().getOSInterface() != nullptr ? device->getGpgpuCommandStreamReceiver().getOSInterface()->getDeviceHandle() : 0; @@ -539,7 +539,7 @@ TEST(SourceLevelDebugger, givenTwoRootDevicesWhenSecondIsCreatedThenCreatingNewS ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment(); executionEnvironment->prepareRootDeviceEnvironments(2); for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) { - executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(*platformDevices); + executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get()); } auto device1 = std::make_unique(Device::create(executionEnvironment, 0u)); EXPECT_NE(nullptr, executionEnvironment->memoryManager); @@ -562,7 +562,7 @@ TEST(SourceLevelDebugger, givenMultipleRootDevicesWhenTheyAreCreatedTheyUseDedic ExecutionEnvironment *executionEnvironment = platform()->peekExecutionEnvironment(); executionEnvironment->prepareRootDeviceEnvironments(2); for (auto i = 0u; i < executionEnvironment->rootDeviceEnvironments.size(); i++) { - executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(*platformDevices); + executionEnvironment->rootDeviceEnvironments[i]->setHwInfo(defaultHwInfo.get()); } auto device1 = std::make_unique(Device::create(executionEnvironment, 0u)); auto sourceLevelDebugger = device1->getDebugger();