From eb63f36108f2ae02a26f4ac79404575565ebf6c5 Mon Sep 17 00:00:00 2001 From: Kamil Kopryk Date: Mon, 9 Jan 2023 14:59:10 +0000 Subject: [PATCH] Move GfxCoreHelper ownership to RootDeviceEnvironment Related-To: NEO-6853 Signed-off-by: Kamil Kopryk --- .../unit_tests/sources/device/test_device.cpp | 19 +++++----- .../sources/kernel/test_kernel_2.cpp | 11 ++---- .../command_queue/command_queue_tests.cpp | 36 ++++++++++++------ .../cl_command_stream_receiver_tests.cpp | 8 ++-- ...and_stream_receiver_flush_task_2_tests.cpp | 9 +++-- .../command_stream_receiver_hw_2_tests.cpp | 3 +- .../unit_test/device/device_caps_tests.cpp | 4 +- opencl/test/unit_test/device/device_tests.cpp | 6 ++- .../device/get_device_info_tests.cpp | 38 +++++++++++++------ .../unit_test/gen11/enqueue_kernel_gen11.cpp | 3 +- .../unit_test/gen9/enqueue_kernel_gen9.cpp | 3 +- .../test/unit_test/mem_obj/buffer_tests.cpp | 3 +- .../mem_obj/image2d_from_buffer_tests.cpp | 6 ++- .../mem_obj/linux/buffer_linux_tests.cpp | 8 ++-- .../mem_obj/windows/buffer_windows_tests.cpp | 9 +++-- .../memory_manager/memory_manager_tests.cpp | 6 +-- .../unit_test/mocks/ult_cl_device_factory.cpp | 12 ++++++ .../unit_test/mocks/ult_cl_device_factory.h | 4 +- .../test/unit_test/program/program_tests.cpp | 3 ++ .../root_device_environment.cpp | 11 +++++- .../root_device_environment.h | 3 ++ .../gen11/enable_family_full_core_gen11.cpp | 6 +-- .../enable_family_full_core_gen12lp.cpp | 6 +-- .../gen8/enable_family_full_core_gen8.cpp | 6 +-- .../gen9/enable_family_full_core_gen9.cpp | 6 +-- shared/source/helpers/hw_helper.cpp | 12 ++++-- shared/source/helpers/hw_helper.h | 12 ++++-- .../enable_family_full_core_xe_hpc_core.cpp | 6 +-- .../enable_family_full_core_xe_hpg_core.cpp | 6 +-- shared/test/common/helpers/raii_hw_helper.h | 32 +++++++++++----- .../windows/neo_device_windows_tests.cpp | 8 ++-- .../unit_test/gen11/test_preamble_gen11.cpp | 3 +- .../unit_test/gen8/test_preamble_gen8.cpp | 3 +- .../unit_test/gen9/test_preamble_gen9.cpp | 5 ++- .../linux/hw_info_config_linux_tests.cpp | 4 +- 35 files changed, 207 insertions(+), 113 deletions(-) diff --git a/level_zero/core/test/unit_tests/sources/device/test_device.cpp b/level_zero/core/test/unit_tests/sources/device/test_device.cpp index a8d3a5c7fe..c25ea8f34e 100644 --- a/level_zero/core/test/unit_tests/sources/device/test_device.cpp +++ b/level_zero/core/test/unit_tests/sources/device/test_device.cpp @@ -20,6 +20,7 @@ #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/engine_descriptor_helper.h" #include "shared/test/common/helpers/mock_hw_info_config_hw.h" +#include "shared/test/common/helpers/raii_hw_helper.h" #include "shared/test/common/libult/ult_command_stream_receiver.h" #include "shared/test/common/mocks/mock_compilers.h" #include "shared/test/common/mocks/mock_device.h" @@ -51,7 +52,7 @@ #include namespace NEO { -extern GfxCoreHelper *gfxCoreHelperFactory[IGFX_MAX_CORE]; +extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE]; } // namespace NEO namespace L0 { @@ -1274,12 +1275,13 @@ HWTEST_F(DeviceTest, givenNodeOrdinalFlagWhenCallAdjustCommandQueueDescThenDescO return EngineGroupType::Compute; } }; - auto hwInfo = *defaultHwInfo.get(); - MockGfxCoreHelper gfxCoreHelper{}; - VariableBackup gfxCoreHelperFactoryBackup{&NEO::gfxCoreHelperFactory[static_cast(hwInfo.platform.eRenderCoreFamily)]}; - gfxCoreHelperFactoryBackup = &gfxCoreHelper; + auto rootDeviceIndex = device->getNEODevice()->getRootDeviceIndex(); + auto &hwInfo = *device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex]->getMutableHardwareInfo(); hwInfo.gtSystemInfo.CCSInfo.NumberOfCCSEnabled = 2; + + RAIIGfxCoreHelperFactory raii(*device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[rootDeviceIndex]); + auto nodeOrdinal = EngineHelpers::remapEngineTypeToHwSpecific(aub_stream::EngineType::ENGINE_CCS2, neoDevice->getRootDeviceEnvironment()); DebugManager.flags.NodeOrdinal.set(nodeOrdinal); @@ -3568,9 +3570,8 @@ HWTEST_F(DeviceTest, givenCooperativeDispatchSupportedWhenQueryingPropertiesFlag rootDeviceIndex); Mock deviceImp(neoMockDevice, neoMockDevice->getExecutionEnvironment()); - MockGfxCoreHelper gfxCoreHelper{}; - VariableBackup gfxCoreHelperFactoryBackup{&NEO::gfxCoreHelperFactory[static_cast(hwInfo.platform.eRenderCoreFamily)]}; - gfxCoreHelperFactoryBackup = &gfxCoreHelper; + MockExecutionEnvironment mockExecutionEnvironment{&hwInfo}; + RAIIGfxCoreHelperFactory raii(*neoMockDevice->executionEnvironment->rootDeviceEnvironments[rootDeviceIndex]); uint32_t count = 0; ze_result_t res = deviceImp.getCommandQueueGroupProperties(&count, nullptr); @@ -3578,7 +3579,7 @@ HWTEST_F(DeviceTest, givenCooperativeDispatchSupportedWhenQueryingPropertiesFlag NEO::EngineGroupType engineGroupTypes[] = {NEO::EngineGroupType::RenderCompute, NEO::EngineGroupType::Compute}; for (auto isCooperativeDispatchSupported : ::testing::Bool()) { - gfxCoreHelper.isCooperativeDispatchSupportedValue = isCooperativeDispatchSupported; + raii.mockGfxCoreHelper->isCooperativeDispatchSupportedValue = isCooperativeDispatchSupported; std::vector properties(count); res = deviceImp.getCommandQueueGroupProperties(&count, properties.data()); diff --git a/level_zero/core/test/unit_tests/sources/kernel/test_kernel_2.cpp b/level_zero/core/test/unit_tests/sources/kernel/test_kernel_2.cpp index 30a966cee7..ee3e302d1e 100644 --- a/level_zero/core/test/unit_tests/sources/kernel/test_kernel_2.cpp +++ b/level_zero/core/test/unit_tests/sources/kernel/test_kernel_2.cpp @@ -6,6 +6,7 @@ */ #include "shared/source/helpers/basic_math.h" +#include "shared/test/common/helpers/raii_hw_helper.h" #include "shared/test/common/mocks/mock_graphics_allocation.h" #include "shared/test/common/mocks/mock_l0_debugger.h" #include "shared/test/common/test_macros/hw_test.h" @@ -14,9 +15,7 @@ #include "level_zero/core/test/unit_tests/fixtures/device_fixture.h" #include "level_zero/core/test/unit_tests/mocks/mock_kernel.h" #include "level_zero/core/test/unit_tests/mocks/mock_module.h" -namespace NEO { -extern GfxCoreHelper *gfxCoreHelperFactory[IGFX_MAX_CORE]; -} + namespace L0 { #include "level_zero/core/source/kernel/patch_with_implicit_surface.inl" namespace ult { @@ -289,10 +288,8 @@ HWTEST_F(KernelImp, givenSurfaceStateHeapWhenPatchWithImplicitSurfaceCalledThenI ++encodeBufferSurfaceStateCalled; } }; - MockGfxCoreHelper gfxCoreHelper{}; - auto hwInfo = *defaultHwInfo.get(); - VariableBackup gfxCoreHelperFactoryBackup{&NEO::gfxCoreHelperFactory[static_cast(hwInfo.platform.eRenderCoreFamily)]}; - gfxCoreHelperFactoryBackup = &gfxCoreHelper; + + RAIIGfxCoreHelperFactory raii(*this->device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[0]); using RENDER_SURFACE_STATE = typename FamilyType::RENDER_SURFACE_STATE; diff --git a/opencl/test/unit_test/command_queue/command_queue_tests.cpp b/opencl/test/unit_test/command_queue/command_queue_tests.cpp index 7328792d59..da067023f0 100644 --- a/opencl/test/unit_test/command_queue/command_queue_tests.cpp +++ b/opencl/test/unit_test/command_queue/command_queue_tests.cpp @@ -996,7 +996,7 @@ HWTEST_F(CommandQueueTests, givenNodeOrdinalSetWithCcsEngineWhenCreatingCommandQ return EngineGroupType::RenderCompute; } }; - RAIIGfxCoreHelperFactory overrideGfxCoreHelper{defaultHwInfo->platform.eRenderCoreFamily}; + RAIIGfxCoreHelperFactory overrideGfxCoreHelper{*pDevice->executionEnvironment->rootDeviceEnvironments[0]}; auto forcedEngine = EngineHelpers::remapEngineTypeToHwSpecific(aub_stream::EngineType::ENGINE_CCS, pDevice->getRootDeviceEnvironment()); DebugManager.flags.NodeOrdinal.set(static_cast(forcedEngine)); @@ -2605,15 +2605,19 @@ struct CommandQueueOnSpecificEngineTests : ::testing::Test { }; template - auto overrideGfxCoreHelper() { - return RAIIGfxCoreHelperFactory{::defaultHwInfo->platform.eRenderCoreFamily}; + auto overrideGfxCoreHelper(RootDeviceEnvironment &rootDeviceEnvironment) { + return RAIIGfxCoreHelperFactory{rootDeviceEnvironment}; } }; HWTEST_F(CommandQueueOnSpecificEngineTests, givenMultipleFamiliesWhenCreatingQueueOnSpecificEngineThenUseCorrectEngine) { - auto raiiGfxCoreHelper = overrideGfxCoreHelper>(); + HardwareInfo hwInfo = *defaultHwInfo; hwInfo.capabilityTable.blitterOperationsSupported = true; + + MockExecutionEnvironment mockExecutionEnvironment{&hwInfo}; + auto raiiGfxCoreHelper = overrideGfxCoreHelper>(*mockExecutionEnvironment.rootDeviceEnvironments[0]); + MockDevice *device = MockDevice::createWithNewExecutionEnvironment(&hwInfo, 0); MockClDevice clDevice{device}; MockContext context{&clDevice}; @@ -2642,7 +2646,8 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenMultipleFamiliesWhenCreatingQue HWTEST_F(CommandQueueOnSpecificEngineTests, givenRootDeviceAndMultipleFamiliesWhenCreatingQueueOnSpecificEngineThenUseDefaultEngine) { VariableBackup backupHwInfo(defaultHwInfo.get()); defaultHwInfo->capabilityTable.blitterOperationsSupported = true; - auto raiiGfxCoreHelper = overrideGfxCoreHelper>(); + MockExecutionEnvironment mockExecutionEnvironment{}; + auto raiiGfxCoreHelper = overrideGfxCoreHelper>(*mockExecutionEnvironment.rootDeviceEnvironments[0]); UltClDeviceFactory deviceFactory{1, 2}; MockContext context{deviceFactory.rootDevices[0]}; cl_command_queue_properties properties[5] = {}; @@ -2658,10 +2663,12 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenRootDeviceAndMultipleFamiliesWh } HWTEST_F(CommandQueueOnSpecificEngineTests, givenSubDeviceAndMultipleFamiliesWhenCreatingQueueOnSpecificEngineThenUseDefaultEngine) { - auto raiiGfxCoreHelper = overrideGfxCoreHelper>(); VariableBackup backupHwInfo(defaultHwInfo.get()); defaultHwInfo->capabilityTable.blitterOperationsSupported = true; + MockExecutionEnvironment mockExecutionEnvironment{}; + auto raiiGfxCoreHelper = overrideGfxCoreHelper>(*mockExecutionEnvironment.rootDeviceEnvironments[0]); + UltClDeviceFactory deviceFactory{1, 2}; MockContext context{deviceFactory.subDevices[0]}; cl_command_queue_properties properties[5] = {}; @@ -2687,10 +2694,11 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenSubDeviceAndMultipleFamiliesWhe } HWTEST_F(CommandQueueOnSpecificEngineTests, givenBcsFamilySelectedWhenCreatingQueueOnSpecificEngineThenInitializeBcsProperly) { - auto raiiGfxCoreHelper = overrideGfxCoreHelper>(); - VariableBackup backupHwInfo(defaultHwInfo.get()); defaultHwInfo->capabilityTable.blitterOperationsSupported = true; + MockExecutionEnvironment mockExecutionEnvironment{}; + auto raiiGfxCoreHelper = overrideGfxCoreHelper>(*mockExecutionEnvironment.rootDeviceEnvironments[0]); + MockContext context{}; cl_command_queue_properties properties[5] = {}; @@ -2712,7 +2720,9 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenNotInitializedRcsOsContextWhenC DebugManager.flags.DeferOsContextInitialization.set(1); DebugManager.flags.NodeOrdinal.set(static_cast(aub_stream::EngineType::ENGINE_CCS)); - auto raiiGfxCoreHelper = overrideGfxCoreHelper>(); + MockExecutionEnvironment mockExecutionEnvironment{}; + + auto raiiGfxCoreHelper = overrideGfxCoreHelper>(*mockExecutionEnvironment.rootDeviceEnvironments[0]); MockContext context{}; cl_command_queue_properties properties[5] = {}; @@ -2734,7 +2744,9 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenNotInitializedCcsOsContextWhenC DebugManager.flags.NodeOrdinal.set(static_cast(aub_stream::EngineType::ENGINE_RCS)); DebugManager.flags.DeferOsContextInitialization.set(1); - auto raiiGfxCoreHelper = overrideGfxCoreHelper>(); + MockExecutionEnvironment mockExecutionEnvironment{}; + + auto raiiGfxCoreHelper = overrideGfxCoreHelper>(*mockExecutionEnvironment.rootDeviceEnvironments[0]); MockContext context{}; cl_command_queue_properties properties[5] = {}; @@ -2754,6 +2766,8 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenDebugFlagSetWhenCreatingCmdQueu DebugManager.flags.NumberOfRegularContextsPerEngine.set(4); DebugManager.flags.NodeOrdinal.set(static_cast(aub_stream::ENGINE_CCS)); + MockExecutionEnvironment mockExecutionEnvironment{}; + class MyMockGfxCoreHelper : public GfxCoreHelperHw { public: const EngineInstancesContainer getGpgpuEngineInstances(const HardwareInfo &hwInfo) const override { @@ -2772,7 +2786,7 @@ HWTEST_F(CommandQueueOnSpecificEngineTests, givenDebugFlagSetWhenCreatingCmdQueu } }; - auto raiiGfxCoreHelper = overrideGfxCoreHelper(); + auto raiiGfxCoreHelper = overrideGfxCoreHelper(*mockExecutionEnvironment.rootDeviceEnvironments[0]); MockContext context{}; auto &device = static_cast(context.getDevice(0)->getDevice()); diff --git a/opencl/test/unit_test/command_stream/cl_command_stream_receiver_tests.cpp b/opencl/test/unit_test/command_stream/cl_command_stream_receiver_tests.cpp index 8bd0691b94..35efb049f3 100644 --- a/opencl/test/unit_test/command_stream/cl_command_stream_receiver_tests.cpp +++ b/opencl/test/unit_test/command_stream/cl_command_stream_receiver_tests.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -48,7 +48,8 @@ TEST(ClCommandStreamReceiverTest, WhenMakingResidentThenBufferResidencyFlagIsSet using ClCommandStreamReceiverTests = Test; HWTEST_F(ClCommandStreamReceiverTests, givenCommandStreamReceiverWhenFenceAllocationIsRequiredAndCreateGlobalFenceAllocationIsCalledThenFenceAllocationIsAllocated) { - RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{pDevice->getHardwareInfo().platform.eRenderCoreFamily}; + RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{ + *pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]}; MockCsrHw csr(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); csr.setupContext(*pDevice->getDefaultEngine().osContext); @@ -61,7 +62,8 @@ HWTEST_F(ClCommandStreamReceiverTests, givenCommandStreamReceiverWhenFenceAlloca } HWTEST_F(ClCommandStreamReceiverTests, givenCommandStreamReceiverWhenGettingFenceAllocationThenCorrectFenceAllocationIsReturned) { - RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{pDevice->getHardwareInfo().platform.eRenderCoreFamily}; + RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{ + *pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]}; CommandStreamReceiverHw csr(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); csr.setupContext(*pDevice->getDefaultEngine().osContext); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp index 8d7e54f897..86381555d2 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_flush_task_2_tests.cpp @@ -532,7 +532,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, WhenFlushingThenScratchAllocationI } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandStreamReceiverWhenFenceAllocationIsRequiredAndFlushTaskIsCalledThenFenceAllocationIsMadeResident) { - RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{pDevice->getHardwareInfo().platform.eRenderCoreFamily}; + RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{ + *pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]}; auto commandStreamReceiver = new MockCsrHw(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); pDevice->resetCommandStreamReceiver(commandStreamReceiver); @@ -550,7 +551,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandStreamReceiverWhenFenc } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandStreamReceiverWhenFenceAllocationIsRequiredAndCreatedThenItIsMadeResidentDuringFlushSmallTask) { - RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{pDevice->getHardwareInfo().platform.eRenderCoreFamily}; + RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{ + *pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]}; MockCsrHw csr(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); csr.setupContext(*pDevice->getDefaultEngine().osContext); @@ -571,7 +573,8 @@ HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandStreamReceiverWhenFenc } HWTEST_F(CommandStreamReceiverFlushTaskTests, givenCommandStreamReceiverWhenFenceAllocationIsRequiredButNotCreatedThenItIsNotMadeResidentDuringFlushSmallTask) { - RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{pDevice->getHardwareInfo().platform.eRenderCoreFamily}; + RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{ + *pDevice->executionEnvironment->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]}; MockCsrHw csr(*pDevice->executionEnvironment, pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); csr.setupContext(*pDevice->getDefaultEngine().osContext); diff --git a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp index 33f481cb0d..3381431fdb 100644 --- a/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp +++ b/opencl/test/unit_test/command_stream/command_stream_receiver_hw_2_tests.cpp @@ -513,7 +513,8 @@ HWTEST_F(BcsTests, givenInputAllocationsWhenBlitDispatchedThenMakeAllAllocations } HWTEST_F(BcsTests, givenFenceAllocationIsRequiredWhenBlitDispatchedThenMakeAllAllocationsResident) { - RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{pDevice->getHardwareInfo().platform.eRenderCoreFamily}; + RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{ + *pDevice->getExecutionEnvironment()->rootDeviceEnvironments[pDevice->getRootDeviceIndex()]}; auto bcsOsContext = std::unique_ptr(OsContext::create(nullptr, pDevice->getRootDeviceIndex(), 0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::ENGINE_BCS, EngineUsage::Regular}, pDevice->getDeviceBitfield()))); auto bcsCsr = std::make_unique>(*pDevice->getExecutionEnvironment(), pDevice->getRootDeviceIndex(), pDevice->getDeviceBitfield()); diff --git a/opencl/test/unit_test/device/device_caps_tests.cpp b/opencl/test/unit_test/device/device_caps_tests.cpp index a9a28930d5..37719620a2 100644 --- a/opencl/test/unit_test/device/device_caps_tests.cpp +++ b/opencl/test/unit_test/device/device_caps_tests.cpp @@ -1210,7 +1210,7 @@ class MyMockGfxCoreHelper : public GfxCoreHelperHw { HWTEST_F(DeviceGetCapsTest, givenDeviceWhenInitializingCapsThenPlanarYuvHeightIsTakenFromHelper) { auto device = std::make_unique(MockDevice::createWithNewExecutionEnvironment(defaultHwInfo.get())); - RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{device->getHardwareInfo().platform.eRenderCoreFamily}; + RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{*device->executionEnvironment->rootDeviceEnvironments[0]}; DriverInfoMock *driverInfoMock = new DriverInfoMock(); device->driverInfo.reset(driverInfoMock); @@ -1218,7 +1218,7 @@ HWTEST_F(DeviceGetCapsTest, givenDeviceWhenInitializingCapsThenPlanarYuvHeightIs EXPECT_TRUE(getPlanarYuvHeightCalled); getPlanarYuvHeightCalled = false; const auto &caps = device->getDeviceInfo(); - EXPECT_EQ(gfxCoreHelperBackup.mockGfxCoreHelper.dummyPlanarYuvValue, caps.planarYuvMaxHeight); + EXPECT_EQ(gfxCoreHelperBackup.mockGfxCoreHelper->dummyPlanarYuvValue, caps.planarYuvMaxHeight); } TEST_F(DeviceGetCapsTest, givenSystemWithNoDriverInfoWhenGettingNameAndVersionThenReturnDefaultValues) { diff --git a/opencl/test/unit_test/device/device_tests.cpp b/opencl/test/unit_test/device/device_tests.cpp index 3b5cb409f0..e33867dbee 100644 --- a/opencl/test/unit_test/device/device_tests.cpp +++ b/opencl/test/unit_test/device/device_tests.cpp @@ -574,7 +574,10 @@ HWTEST_F(DeviceHwTest, givenBothCcsAndRcsEnginesInDeviceWhenGettingEngineGroupsT UNRECOVERABLE_IF(true); } }; - RAIIGfxCoreHelperFactory overrideGfxCoreHelper{::defaultHwInfo->platform.eRenderCoreFamily}; + MockDevice device{}; + + RAIIGfxCoreHelperFactory overrideGfxCoreHelper{ + *device.executionEnvironment->rootDeviceEnvironments[0]}; MockOsContext rcsContext(0, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::EngineType::ENGINE_RCS, EngineUsage::Regular})); EngineControl rcsEngine{nullptr, &rcsContext}; @@ -582,7 +585,6 @@ HWTEST_F(DeviceHwTest, givenBothCcsAndRcsEnginesInDeviceWhenGettingEngineGroupsT MockOsContext ccsContext(1, EngineDescriptorHelper::getDefaultDescriptor({aub_stream::EngineType::ENGINE_CCS, EngineUsage::Regular})); EngineControl ccsEngine{nullptr, &ccsContext}; - MockDevice device{}; ASSERT_EQ(0u, device.getRegularEngineGroups().size()); device.addEngineToEngineGroup(ccsEngine); device.addEngineToEngineGroup(rcsEngine); diff --git a/opencl/test/unit_test/device/get_device_info_tests.cpp b/opencl/test/unit_test/device/get_device_info_tests.cpp index bdb984a55c..5f9e48ce12 100644 --- a/opencl/test/unit_test/device/get_device_info_tests.cpp +++ b/opencl/test/unit_test/device/get_device_info_tests.cpp @@ -9,6 +9,7 @@ #include "shared/test/common/helpers/debug_manager_state_restore.h" #include "shared/test/common/helpers/raii_hw_helper.h" #include "shared/test/common/mocks/mock_driver_info.h" +#include "shared/test/common/mocks/mock_execution_environment.h" #include "shared/test/common/mocks/mock_os_context.h" #include "shared/test/common/test_macros/hw_test.h" @@ -16,6 +17,7 @@ #include "opencl/source/helpers/cl_hw_helper.h" #include "opencl/test/unit_test/fixtures/cl_device_fixture.h" #include "opencl/test/unit_test/fixtures/device_info_fixture.h" +#include "opencl/test/unit_test/mocks/mock_cl_execution_environment.h" #include "opencl/test/unit_test/mocks/mock_command_queue.h" #include "opencl/test/unit_test/mocks/mock_context.h" #include "opencl/test/unit_test/mocks/ult_cl_device_factory.h" @@ -709,8 +711,8 @@ class MockGfxCoreHelper : public GfxCoreHelperHw { return true; } - static auto overrideGfxCoreHelper() { - return RAIIGfxCoreHelperFactory>{::defaultHwInfo->platform.eRenderCoreFamily}; + static auto overrideGfxCoreHelper(RootDeviceEnvironment &rootDeviceEnvironment) { + return RAIIGfxCoreHelperFactory>{rootDeviceEnvironment}; } uint64_t disableEngineSupportOnSubDevice = -1; // disabled by default @@ -720,9 +722,13 @@ class MockGfxCoreHelper : public GfxCoreHelperHw { using GetDeviceInfoQueueFamilyTest = ::testing::Test; HWTEST_F(GetDeviceInfoQueueFamilyTest, givenSingleDeviceWhenInitializingCapsThenReturnCorrectFamilies) { - auto raiiGfxCoreHelper = MockGfxCoreHelper::overrideGfxCoreHelper(); + VariableBackup backupHwInfo(defaultHwInfo.get()); defaultHwInfo->capabilityTable.blitterOperationsSupported = true; + + MockExecutionEnvironment mockExecutionEnvironment{}; + auto raiiGfxCoreHelper = MockGfxCoreHelper::overrideGfxCoreHelper(*mockExecutionEnvironment.rootDeviceEnvironments[0]); + UltClDeviceFactory deviceFactory{1, 0}; ClDevice &clDevice = *deviceFactory.rootDevices[0]; size_t paramRetSize{}; @@ -743,11 +749,15 @@ HWTEST_F(GetDeviceInfoQueueFamilyTest, givenSingleDeviceWhenInitializingCapsThen } HWTEST_F(GetDeviceInfoQueueFamilyTest, givenSubDeviceWhenInitializingCapsThenReturnCorrectFamilies) { - auto raiiGfxCoreHelper = MockGfxCoreHelper::overrideGfxCoreHelper(); VariableBackup backupHwInfo(defaultHwInfo.get()); defaultHwInfo->capabilityTable.blitterOperationsSupported = true; + + MockExecutionEnvironment mockExecutionEnvironment{}; + auto raiiGfxCoreHelper = MockGfxCoreHelper::overrideGfxCoreHelper(*mockExecutionEnvironment.rootDeviceEnvironments[0]); + UltClDeviceFactory deviceFactory{1, 2}; ClDevice &clDevice = *deviceFactory.subDevices[1]; + size_t paramRetSize{}; cl_int retVal{}; @@ -769,18 +779,22 @@ HWTEST_F(GetDeviceInfoQueueFamilyTest, givenSubDeviceWithoutSupportedEngineWhenI constexpr int bcsCount = 1; using MockGfxCoreHelperT = MockGfxCoreHelper; + VariableBackup backupHwInfo(defaultHwInfo.get()); + defaultHwInfo->capabilityTable.blitterOperationsSupported = true; - auto raiiGfxCoreHelper = MockGfxCoreHelperT::overrideGfxCoreHelper(); - MockGfxCoreHelperT &mockGfxCoreHelper = static_cast(raiiGfxCoreHelper.mockGfxCoreHelper); - + std::unique_ptr deviceFactory; + auto mockClExecutionEnvironment = std::make_unique(); + mockClExecutionEnvironment->prepareRootDeviceEnvironments(1); + mockClExecutionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(defaultHwInfo.get()); + auto raiiGfxCoreHelper = MockGfxCoreHelperT::overrideGfxCoreHelper(*mockClExecutionEnvironment->rootDeviceEnvironments[0]); + MockGfxCoreHelperT &mockGfxCoreHelper = static_cast(*raiiGfxCoreHelper.mockGfxCoreHelper); mockGfxCoreHelper.disableEngineSupportOnSubDevice = 0b10; // subdevice 1 mockGfxCoreHelper.disabledSubDeviceEngineType = aub_stream::EngineType::ENGINE_BCS; - VariableBackup backupHwInfo(defaultHwInfo.get()); - defaultHwInfo->capabilityTable.blitterOperationsSupported = true; - UltClDeviceFactory deviceFactory{1, 2}; - ClDevice &clDevice0 = *deviceFactory.subDevices[0]; - ClDevice &clDevice1 = *deviceFactory.subDevices[1]; + deviceFactory = std::make_unique(1, 2, mockClExecutionEnvironment.release()); + ClDevice &clDevice0 = *deviceFactory->subDevices[0]; + ClDevice &clDevice1 = *deviceFactory->subDevices[1]; + size_t paramRetSize{}; cl_int retVal{}; diff --git a/opencl/test/unit_test/gen11/enqueue_kernel_gen11.cpp b/opencl/test/unit_test/gen11/enqueue_kernel_gen11.cpp index 3e9f37718d..2bf7c66c4d 100644 --- a/opencl/test/unit_test/gen11/enqueue_kernel_gen11.cpp +++ b/opencl/test/unit_test/gen11/enqueue_kernel_gen11.cpp @@ -22,6 +22,7 @@ namespace NEO { using Gen11EnqueueTest = Test; GEN11TEST_F(Gen11EnqueueTest, givenKernelRequiringIndependentForwardProgressWhenKernelIsSubmittedThenDefaultPolicyIsProgrammed) { + auto &gfxCoreHelper = getHelper(); MockContext mc; CommandQueueHw cmdQ{&mc, pClDevice, 0, false}; @@ -36,7 +37,7 @@ GEN11TEST_F(Gen11EnqueueTest, givenKernelRequiringIndependentForwardProgressWhen auto cmd = findMmioCmd(hwParser.cmdList.begin(), hwParser.cmdList.end(), RowChickenReg4::address); ASSERT_NE(nullptr, cmd); - EXPECT_EQ(RowChickenReg4::regDataForArbitrationPolicy[GfxCoreHelperHw::get().getDefaultThreadArbitrationPolicy()], cmd->getDataDword()); + EXPECT_EQ(RowChickenReg4::regDataForArbitrationPolicy[gfxCoreHelper.getDefaultThreadArbitrationPolicy()], cmd->getDataDword()); EXPECT_EQ(1U, countMmio(hwParser.cmdList.begin(), hwParser.cmdList.end(), RowChickenReg4::address)); } diff --git a/opencl/test/unit_test/gen9/enqueue_kernel_gen9.cpp b/opencl/test/unit_test/gen9/enqueue_kernel_gen9.cpp index 6ad92e4374..9bf86b6f85 100644 --- a/opencl/test/unit_test/gen9/enqueue_kernel_gen9.cpp +++ b/opencl/test/unit_test/gen9/enqueue_kernel_gen9.cpp @@ -22,6 +22,7 @@ namespace NEO { using Gen9EnqueueTest = Test; GEN9TEST_F(Gen9EnqueueTest, givenKernelRequiringIndependentForwardProgressWhenKernelIsSubmittedThenRoundRobinPolicyIsProgrammed) { + auto &gfxCoreHelper = getHelper(); MockContext mc; CommandQueueHw cmdQ{&mc, pClDevice, 0, false}; @@ -36,7 +37,7 @@ GEN9TEST_F(Gen9EnqueueTest, givenKernelRequiringIndependentForwardProgressWhenKe auto cmd = findMmioCmd(hwParser.cmdList.begin(), hwParser.cmdList.end(), DebugControlReg2::address); ASSERT_NE(nullptr, cmd); - EXPECT_EQ(DebugControlReg2::getRegData(GfxCoreHelperHw::get().getDefaultThreadArbitrationPolicy()), cmd->getDataDword()); + EXPECT_EQ(DebugControlReg2::getRegData(gfxCoreHelper.getDefaultThreadArbitrationPolicy()), cmd->getDataDword()); EXPECT_EQ(1U, countMmio(hwParser.cmdList.begin(), hwParser.cmdList.end(), DebugControlReg2::address)); } diff --git a/opencl/test/unit_test/mem_obj/buffer_tests.cpp b/opencl/test/unit_test/mem_obj/buffer_tests.cpp index fa80c59563..fe4461fc36 100644 --- a/opencl/test/unit_test/mem_obj/buffer_tests.cpp +++ b/opencl/test/unit_test/mem_obj/buffer_tests.cpp @@ -1835,7 +1835,8 @@ HWTEST_F(BufferCreateTests, givenClMemCopyHostPointerPassedToBufferCreateWhenAll constexpr size_t bigBufferSize = smallBufferSize + 1; char memory[smallBufferSize]; char bigMemory[bigBufferSize]; - RAIIGfxCoreHelperFactory> overrideGfxCoreHelperHw{defaultHwInfo->platform.eRenderCoreFamily}; + RAIIGfxCoreHelperFactory> overrideGfxCoreHelperHw{ + *executionEnvironment->rootDeviceEnvironments[0]}; { // cpu copy allowed diff --git a/opencl/test/unit_test/mem_obj/image2d_from_buffer_tests.cpp b/opencl/test/unit_test/mem_obj/image2d_from_buffer_tests.cpp index c8ac91daa6..278eca2cb7 100644 --- a/opencl/test/unit_test/mem_obj/image2d_from_buffer_tests.cpp +++ b/opencl/test/unit_test/mem_obj/image2d_from_buffer_tests.cpp @@ -24,7 +24,7 @@ using namespace NEO; namespace NEO { -extern GfxCoreHelper *gfxCoreHelperFactory[IGFX_MAX_CORE]; +extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE]; } // Tests for cl_khr_image2d_from_buffer @@ -334,6 +334,7 @@ TEST_F(Image2dFromBufferTest, givenBufferWhenImageFromBufferThenIsImageFromBuffe } HWTEST_F(Image2dFromBufferTest, givenBufferWhenImageFromBufferThenIsImageFromBufferSetAndAllocationTypeIsBufferNullptr) { + class MockGfxCoreHelperHw : public GfxCoreHelperHw { public: bool checkResourceCompatibility(GraphicsAllocation &graphicsAllocation) const override { @@ -341,7 +342,8 @@ HWTEST_F(Image2dFromBufferTest, givenBufferWhenImageFromBufferThenIsImageFromBuf } }; - auto raiiFactory = RAIIGfxCoreHelperFactory(context.getDevice(0)->getHardwareInfo().platform.eRenderCoreFamily); + auto raiiFactory = RAIIGfxCoreHelperFactory( + *context.getDevice(0)->getExecutionEnvironment()->rootDeviceEnvironments[0]); cl_int errCode = CL_SUCCESS; auto buffer = Buffer::create(&context, 0, 1, nullptr, errCode); diff --git a/opencl/test/unit_test/mem_obj/linux/buffer_linux_tests.cpp b/opencl/test/unit_test/mem_obj/linux/buffer_linux_tests.cpp index 7607f8ee29..5ed9cfda61 100644 --- a/opencl/test/unit_test/mem_obj/linux/buffer_linux_tests.cpp +++ b/opencl/test/unit_test/mem_obj/linux/buffer_linux_tests.cpp @@ -161,7 +161,7 @@ HWTEST_F(BufferCreateLinuxTests, givenClMemCopyHostPointerPassedToBufferCreateWh context.setSpecialQueue(commandQueue, mockRootDeviceIndex); constexpr size_t smallBufferSize = Buffer::maxBufferSizeForCopyOnCpu; char memory[smallBufferSize]; - RAIIGfxCoreHelperFactory> overrideGfxCoreHelperHw{defaultHwInfo->platform.eRenderCoreFamily}; + RAIIGfxCoreHelperFactory> overrideGfxCoreHelperHw{*executionEnvironment->rootDeviceEnvironments[0]}; { // cpu copy allowed @@ -177,7 +177,7 @@ HWTEST_F(BufferCreateLinuxTests, givenClMemCopyHostPointerPassedToBufferCreateWh writeBufferCounter = commandQueue->writeBufferCounter; lockResourceCalled = memoryManager->lockResourceCalled; - overrideGfxCoreHelperHw.mockGfxCoreHelper.setIsLockable = false; + overrideGfxCoreHelperHw.mockGfxCoreHelper->setIsLockable = false; std::unique_ptr bufferWhenLockNotAllowed(Buffer::create(&context, flags, sizeof(memory), memory, retVal)); ASSERT_NE(nullptr, bufferWhenLockNotAllowed.get()); @@ -202,7 +202,7 @@ HWTEST_F(BufferCreateLinuxTests, givenClMemCopyHostPointerPassedToBufferCreateWh context.setSpecialQueue(commandQueue, mockRootDeviceIndex); constexpr size_t bigBufferSize = Buffer::maxBufferSizeForCopyOnCpu + 1; char bigMemory[bigBufferSize]; - RAIIGfxCoreHelperFactory> overrideGfxCoreHelperHw{defaultHwInfo->platform.eRenderCoreFamily}; + RAIIGfxCoreHelperFactory> overrideGfxCoreHelperHw{*executionEnvironment->rootDeviceEnvironments[0]}; { // buffer size over threshold -> cpu copy disallowed @@ -218,7 +218,7 @@ HWTEST_F(BufferCreateLinuxTests, givenClMemCopyHostPointerPassedToBufferCreateWh writeBufferCounter = commandQueue->writeBufferCounter; lockResourceCalled = memoryManager->lockResourceCalled; - overrideGfxCoreHelperHw.mockGfxCoreHelper.setIsLockable = false; + overrideGfxCoreHelperHw.mockGfxCoreHelper->setIsLockable = false; std::unique_ptr bufferWhenLockNotAllowed(Buffer::create(&context, flags, sizeof(bigMemory), bigMemory, retVal)); ASSERT_NE(nullptr, bufferWhenLockNotAllowed.get()); diff --git a/opencl/test/unit_test/mem_obj/windows/buffer_windows_tests.cpp b/opencl/test/unit_test/mem_obj/windows/buffer_windows_tests.cpp index f2c0190db6..803d621dd6 100644 --- a/opencl/test/unit_test/mem_obj/windows/buffer_windows_tests.cpp +++ b/opencl/test/unit_test/mem_obj/windows/buffer_windows_tests.cpp @@ -160,7 +160,8 @@ HWTEST_F(BufferCreateWindowsTests, givenClMemCopyHostPointerPassedToBufferCreate context.setSpecialQueue(commandQueue, mockRootDeviceIndex); constexpr size_t smallBufferSize = Buffer::maxBufferSizeForCopyOnCpu; char memory[smallBufferSize]; - RAIIGfxCoreHelperFactory> overrideGfxCoreHelperHw{defaultHwInfo->platform.eRenderCoreFamily}; + RAIIGfxCoreHelperFactory> overrideGfxCoreHelperHw{ + *executionEnvironment->rootDeviceEnvironments[0]}; { // cpu copy allowed @@ -176,7 +177,7 @@ HWTEST_F(BufferCreateWindowsTests, givenClMemCopyHostPointerPassedToBufferCreate writeBufferCounter = commandQueue->writeBufferCounter; lockResourceCalled = memoryManager->lockResourceCalled; - overrideGfxCoreHelperHw.mockGfxCoreHelper.setIsLockable = false; + overrideGfxCoreHelperHw.mockGfxCoreHelper->setIsLockable = false; std::unique_ptr bufferWhenLockNotAllowed(Buffer::create(&context, flags, sizeof(memory), memory, retVal)); ASSERT_NE(nullptr, bufferWhenLockNotAllowed.get()); @@ -201,7 +202,7 @@ HWTEST_F(BufferCreateWindowsTests, givenClMemCopyHostPointerPassedToBufferCreate context.setSpecialQueue(commandQueue, mockRootDeviceIndex); constexpr size_t bigBufferSize = Buffer::maxBufferSizeForCopyOnCpu + 1; char bigMemory[bigBufferSize]; - RAIIGfxCoreHelperFactory> overrideGfxCoreHelperHw{defaultHwInfo->platform.eRenderCoreFamily}; + RAIIGfxCoreHelperFactory> overrideGfxCoreHelperHw{*executionEnvironment->rootDeviceEnvironments[0]}; { // buffer size over threshold -> cpu copy disallowed @@ -217,7 +218,7 @@ HWTEST_F(BufferCreateWindowsTests, givenClMemCopyHostPointerPassedToBufferCreate writeBufferCounter = commandQueue->writeBufferCounter; lockResourceCalled = memoryManager->lockResourceCalled; - overrideGfxCoreHelperHw.mockGfxCoreHelper.setIsLockable = false; + overrideGfxCoreHelperHw.mockGfxCoreHelper->setIsLockable = false; std::unique_ptr bufferWhenLockNotAllowed(Buffer::create(&context, flags, sizeof(bigMemory), bigMemory, retVal)); ASSERT_NE(nullptr, bufferWhenLockNotAllowed.get()); diff --git a/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp b/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp index 9350dcba96..ae531cc8be 100644 --- a/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp +++ b/opencl/test/unit_test/memory_manager/memory_manager_tests.cpp @@ -613,11 +613,11 @@ HWTEST_F(MemoryAllocatorTest, givenSupportFor1MbAlignmentWhenAllocateGraphicsMem } bool isEnable = false; }; - auto raiiFactory = RAIIGfxCoreHelperFactory(defaultHwInfo->platform.eRenderCoreFamily); + auto raiiFactory = RAIIGfxCoreHelperFactory(*executionEnvironment->rootDeviceEnvironments[0]); void *ptr = reinterpret_cast(0x1001); auto size = MemoryConstants::pageSize; - raiiFactory.mockGfxCoreHelper.isEnable = true; + raiiFactory.mockGfxCoreHelper->isEnable = true; auto osAgnosticMemoryManager = std::make_unique>(true, false, *executionEnvironment); osAgnosticMemoryManager->failInDevicePool = true; @@ -632,7 +632,7 @@ HWTEST_F(MemoryAllocatorTest, givenSupportFor1MbAlignmentWhenAllocateGraphicsMem osAgnosticMemoryManager->freeGraphicsMemory(allocationWithEnabled1MbAlignment); - raiiFactory.mockGfxCoreHelper.isEnable = false; + raiiFactory.mockGfxCoreHelper->isEnable = false; auto allocationWithoutEnabled1MbAlignment = osAgnosticMemoryManager->allocateGraphicsMemoryWithProperties(properties, ptr); ASSERT_NE(nullptr, allocationWithoutEnabled1MbAlignment); diff --git a/opencl/test/unit_test/mocks/ult_cl_device_factory.cpp b/opencl/test/unit_test/mocks/ult_cl_device_factory.cpp index 7e826f2a9e..09c8639efd 100644 --- a/opencl/test/unit_test/mocks/ult_cl_device_factory.cpp +++ b/opencl/test/unit_test/mocks/ult_cl_device_factory.cpp @@ -31,6 +31,18 @@ UltClDeviceFactory::UltClDeviceFactory(uint32_t rootDevicesCount, uint32_t subDe } } +UltClDeviceFactory::UltClDeviceFactory(uint32_t rootDevicesCount, uint32_t subDevicesCount, ClExecutionEnvironment *clExecutionEnvironment) { + pUltDeviceFactory = std::make_unique(rootDevicesCount, subDevicesCount, *clExecutionEnvironment); + + for (auto &pRootDevice : pUltDeviceFactory->rootDevices) { + auto pRootClDevice = new MockClDevice{pRootDevice}; + for (auto &pClSubDevice : pRootClDevice->subDevices) { + subDevices.push_back(pClSubDevice.get()); + } + rootDevices.push_back(pRootClDevice); + } +} + UltClDeviceFactory::~UltClDeviceFactory() { for (auto &pClDevice : rootDevices) { pClDevice->decRefInternal(); diff --git a/opencl/test/unit_test/mocks/ult_cl_device_factory.h b/opencl/test/unit_test/mocks/ult_cl_device_factory.h index 5d59229178..185ec94a94 100644 --- a/opencl/test/unit_test/mocks/ult_cl_device_factory.h +++ b/opencl/test/unit_test/mocks/ult_cl_device_factory.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -12,6 +12,7 @@ namespace NEO { class ExecutionEnvironment; +class ClExecutionEnvironment; class ClDevice; class MemoryManager; class MockMemoryManager; @@ -20,6 +21,7 @@ struct UltDeviceFactory; struct UltClDeviceFactory { UltClDeviceFactory(uint32_t rootDevicesCount, uint32_t subDevicesCount); + UltClDeviceFactory(uint32_t rootDevicesCount, uint32_t subDevicesCount, ClExecutionEnvironment *clExecutionEnvironment); ~UltClDeviceFactory(); std::unique_ptr pUltDeviceFactory; diff --git a/opencl/test/unit_test/program/program_tests.cpp b/opencl/test/unit_test/program/program_tests.cpp index 85cf142c62..edfd2200d0 100644 --- a/opencl/test/unit_test/program/program_tests.cpp +++ b/opencl/test/unit_test/program/program_tests.cpp @@ -726,6 +726,7 @@ TEST_F(ProgramFromSourceTest, GivenSpecificParamatersWhenBuildingProgramThenSucc auto executionEnvironment = device->getExecutionEnvironment(); std::unique_ptr rootDeviceEnvironment = std::make_unique(*executionEnvironment); + rootDeviceEnvironment->setHwInfoAndInitHelpers(&device->getHardwareInfo()); std::swap(rootDeviceEnvironment, executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]); auto p2 = std::make_unique(toClDeviceVector(*device)); retVal = p2->build(p2->getDevices(), nullptr, false); @@ -1119,6 +1120,7 @@ TEST_F(ProgramFromSourceTest, GivenSpecificParamatersWhenCompilingProgramThenSuc auto device = pContext->getDevice(0); auto executionEnvironment = device->getExecutionEnvironment(); std::unique_ptr rootDeviceEnvironment = std::make_unique(*executionEnvironment); + rootDeviceEnvironment->setHwInfoAndInitHelpers(&device->getHardwareInfo()); std::swap(rootDeviceEnvironment, executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]); auto p2 = std::make_unique(toClDeviceVector(*device)); retVal = p2->compile(p2->getDevices(), nullptr, 0, nullptr, nullptr); @@ -1343,6 +1345,7 @@ TEST_F(ProgramFromSourceTest, GivenInvalidOptionsWhenCreatingLibraryThenCorrectE auto device = pContext->getDevice(0); auto executionEnvironment = device->getExecutionEnvironment(); std::unique_ptr rootDeviceEnvironment = std::make_unique(*executionEnvironment); + rootDeviceEnvironment->setHwInfoAndInitHelpers(&device->getHardwareInfo()); std::swap(rootDeviceEnvironment, executionEnvironment->rootDeviceEnvironments[device->getRootDeviceIndex()]); auto failingProgram = std::make_unique(toClDeviceVector(*device)); diff --git a/shared/source/execution_environment/root_device_environment.cpp b/shared/source/execution_environment/root_device_environment.cpp index c79242c0cf..3c426e60d4 100644 --- a/shared/source/execution_environment/root_device_environment.cpp +++ b/shared/source/execution_environment/root_device_environment.cpp @@ -153,9 +153,16 @@ CompilerInterface *RootDeviceEnvironment::getCompilerInterface() { } void RootDeviceEnvironment::initHelpers() { + initGfxCoreHelper(); initApiGfxCoreHelper(); } +void RootDeviceEnvironment::initGfxCoreHelper() { + if (gfxCoreHelper == nullptr) { + gfxCoreHelper = GfxCoreHelper::create(this->getHardwareInfo()->platform.eRenderCoreFamily); + } +} + BuiltIns *RootDeviceEnvironment::getBuiltIns() { if (this->builtins.get() == nullptr) { std::lock_guard autolock(this->mtx); @@ -186,8 +193,8 @@ HelperType &RootDeviceEnvironment::getHelper() const { return productHelper; } else { static_assert(std::is_same_v, "Only CompilerProductHelper, ProductHelper and GfxCoreHelper are supported"); - auto &gfxCoreHelper = GfxCoreHelper::get(this->getHardwareInfo()->platform.eRenderCoreFamily); - return gfxCoreHelper; + UNRECOVERABLE_IF(gfxCoreHelper == nullptr); + return *gfxCoreHelper; } } diff --git a/shared/source/execution_environment/root_device_environment.h b/shared/source/execution_environment/root_device_environment.h index eba9fd57fc..5835ce306d 100644 --- a/shared/source/execution_environment/root_device_environment.h +++ b/shared/source/execution_environment/root_device_environment.h @@ -70,6 +70,7 @@ struct RootDeviceEnvironment { bool isNumberOfCcsLimited() const; void initHelpers(); + void initGfxCoreHelper(); void initApiGfxCoreHelper(); template HelperType &getHelper() const; @@ -88,6 +89,8 @@ struct RootDeviceEnvironment { std::unique_ptr debugger; std::unique_ptr tagsManager; std::unique_ptr apiGfxCoreHelper; + std::unique_ptr gfxCoreHelper; + ExecutionEnvironment &executionEnvironment; AffinityMaskHelper deviceAffinityMask{true}; diff --git a/shared/source/gen11/enable_family_full_core_gen11.cpp b/shared/source/gen11/enable_family_full_core_gen11.cpp index 54d4780a39..87d7b00e75 100644 --- a/shared/source/gen11/enable_family_full_core_gen11.cpp +++ b/shared/source/gen11/enable_family_full_core_gen11.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -15,14 +15,14 @@ namespace NEO { -extern GfxCoreHelper *gfxCoreHelperFactory[IGFX_MAX_CORE]; +extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE]; using Family = Gen11Family; static auto gfxFamily = IGFX_GEN11_CORE; struct EnableCoreGen11 { EnableCoreGen11() { - gfxCoreHelperFactory[gfxFamily] = &GfxCoreHelperHw::get(); + gfxCoreHelperFactory[gfxFamily] = GfxCoreHelperHw::create; populateFactoryTable>(); populateFactoryTable>(); populateFactoryTable>(); diff --git a/shared/source/gen12lp/enable_family_full_core_gen12lp.cpp b/shared/source/gen12lp/enable_family_full_core_gen12lp.cpp index 81cba22003..deefb469be 100644 --- a/shared/source/gen12lp/enable_family_full_core_gen12lp.cpp +++ b/shared/source/gen12lp/enable_family_full_core_gen12lp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -15,14 +15,14 @@ namespace NEO { -extern GfxCoreHelper *gfxCoreHelperFactory[IGFX_MAX_CORE]; +extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE]; using Family = Gen12LpFamily; static auto gfxFamily = IGFX_GEN12LP_CORE; struct EnableCoreGen12LP { EnableCoreGen12LP() { - gfxCoreHelperFactory[gfxFamily] = &GfxCoreHelperHw::get(); + gfxCoreHelperFactory[gfxFamily] = GfxCoreHelperHw::create; populateFactoryTable>(); populateFactoryTable>(); populateFactoryTable>(); diff --git a/shared/source/gen8/enable_family_full_core_gen8.cpp b/shared/source/gen8/enable_family_full_core_gen8.cpp index cff9076361..6bb606b772 100644 --- a/shared/source/gen8/enable_family_full_core_gen8.cpp +++ b/shared/source/gen8/enable_family_full_core_gen8.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -17,14 +17,14 @@ namespace NEO { -extern GfxCoreHelper *gfxCoreHelperFactory[IGFX_MAX_CORE]; +extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE]; using Family = Gen8Family; static const auto gfxFamily = IGFX_GEN8_CORE; struct EnableCoreGen8 { EnableCoreGen8() { - gfxCoreHelperFactory[gfxFamily] = &GfxCoreHelperHw::get(); + gfxCoreHelperFactory[gfxFamily] = GfxCoreHelperHw::create; populateFactoryTable>(); populateFactoryTable>(); populateFactoryTable>(); diff --git a/shared/source/gen9/enable_family_full_core_gen9.cpp b/shared/source/gen9/enable_family_full_core_gen9.cpp index acd479bc68..1a6ebda670 100644 --- a/shared/source/gen9/enable_family_full_core_gen9.cpp +++ b/shared/source/gen9/enable_family_full_core_gen9.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2020-2022 Intel Corporation + * Copyright (C) 2020-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -17,14 +17,14 @@ namespace NEO { -extern GfxCoreHelper *gfxCoreHelperFactory[IGFX_MAX_CORE]; +extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE]; using Family = Gen9Family; static const auto gfxFamily = IGFX_GEN9_CORE; struct EnableCoreGen9 { EnableCoreGen9() { - gfxCoreHelperFactory[gfxFamily] = &GfxCoreHelperHw::get(); + gfxCoreHelperFactory[gfxFamily] = GfxCoreHelperHw::create; populateFactoryTable>(); populateFactoryTable>(); populateFactoryTable>(); diff --git a/shared/source/helpers/hw_helper.cpp b/shared/source/helpers/hw_helper.cpp index 92734de02b..b9b6ff64b9 100644 --- a/shared/source/helpers/hw_helper.cpp +++ b/shared/source/helpers/hw_helper.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -15,10 +15,14 @@ #include namespace NEO { -GfxCoreHelper *gfxCoreHelperFactory[IGFX_MAX_CORE] = {}; -GfxCoreHelper &GfxCoreHelper::get(GFXCORE_FAMILY gfxCore) { - return *gfxCoreHelperFactory[gfxCore]; +GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE] = {}; + +std::unique_ptr GfxCoreHelper::create(const GFXCORE_FAMILY gfxCoreFamily) { + + auto createFunction = gfxCoreHelperFactory[gfxCoreFamily]; + auto gfxCoreHelper = createFunction(); + return gfxCoreHelper; } bool GfxCoreHelper::compressedBuffersSupported(const HardwareInfo &hwInfo) { diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 18a7f42c36..c4423b072c 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -41,10 +41,12 @@ struct EncodeSurfaceStateArgs; struct RootDeviceEnvironment; struct PipeControlArgs; class ProductHelper; +class GfxCoreHelper; +using GfxCoreHelperCreateFunctionType = std::unique_ptr (*)(); class GfxCoreHelper { public: - static GfxCoreHelper &get(GFXCORE_FAMILY gfxCore); + static std::unique_ptr create(const GFXCORE_FAMILY gfxCoreFamily); virtual size_t getMaxBarrierRegisterPerSlice() const = 0; virtual size_t getPaddingForISAAllocation() const = 0; virtual uint32_t getComputeUnitsUsedForScratch(const RootDeviceEnvironment &rootDeviceEnvironment) const = 0; @@ -164,6 +166,8 @@ class GfxCoreHelper { virtual bool isRelaxedOrderingSupported() const = 0; static bool isWorkaroundRequired(uint32_t lowestSteppingWithBug, uint32_t steppingWithFix, const HardwareInfo &hwInfo, const ProductHelper &productHelper); + virtual ~GfxCoreHelper() = default; + protected: GfxCoreHelper() = default; }; @@ -171,8 +175,8 @@ class GfxCoreHelper { template class GfxCoreHelperHw : public GfxCoreHelper { public: - static GfxCoreHelperHw &get() { - static GfxCoreHelperHw gfxCoreHelper; + static std::unique_ptr create() { + auto gfxCoreHelper = std::unique_ptr(new GfxCoreHelperHw()); return gfxCoreHelper; } @@ -378,6 +382,8 @@ class GfxCoreHelperHw : public GfxCoreHelper { bool isTimestampShiftRequired() const override; bool isRelaxedOrderingSupported() const override; + ~GfxCoreHelperHw() override = default; + protected: static const AuxTranslationMode defaultAuxTranslationMode; GfxCoreHelperHw() = default; diff --git a/shared/source/xe_hpc_core/enable_family_full_core_xe_hpc_core.cpp b/shared/source/xe_hpc_core/enable_family_full_core_xe_hpc_core.cpp index c3222c843e..8e0917794e 100644 --- a/shared/source/xe_hpc_core/enable_family_full_core_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/enable_family_full_core_xe_hpc_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -15,14 +15,14 @@ namespace NEO { -extern GfxCoreHelper *gfxCoreHelperFactory[IGFX_MAX_CORE]; +extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE]; using Family = XeHpcCoreFamily; static auto gfxFamily = IGFX_XE_HPC_CORE; struct EnableCoreXeHpcCore { EnableCoreXeHpcCore() { - gfxCoreHelperFactory[gfxFamily] = &GfxCoreHelperHw::get(); + gfxCoreHelperFactory[gfxFamily] = GfxCoreHelperHw::create; populateFactoryTable>(); populateFactoryTable>(); populateFactoryTable>(); diff --git a/shared/source/xe_hpg_core/enable_family_full_core_xe_hpg_core.cpp b/shared/source/xe_hpg_core/enable_family_full_core_xe_hpg_core.cpp index 04bafa9b81..0dbd9b1406 100644 --- a/shared/source/xe_hpg_core/enable_family_full_core_xe_hpg_core.cpp +++ b/shared/source/xe_hpg_core/enable_family_full_core_xe_hpg_core.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021-2022 Intel Corporation + * Copyright (C) 2021-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -15,14 +15,14 @@ namespace NEO { -extern GfxCoreHelper *gfxCoreHelperFactory[IGFX_MAX_CORE]; +extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE]; using Family = XeHpgCoreFamily; static auto gfxFamily = IGFX_XE_HPG_CORE; struct EnableCoreXeHpgCore { EnableCoreXeHpgCore() { - gfxCoreHelperFactory[gfxFamily] = &GfxCoreHelperHw::get(); + gfxCoreHelperFactory[gfxFamily] = GfxCoreHelperHw::create; populateFactoryTable>(); populateFactoryTable>(); populateFactoryTable>(); diff --git a/shared/test/common/helpers/raii_hw_helper.h b/shared/test/common/helpers/raii_hw_helper.h index 807a55b16c..ac3f52dc0c 100644 --- a/shared/test/common/helpers/raii_hw_helper.h +++ b/shared/test/common/helpers/raii_hw_helper.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2019-2022 Intel Corporation + * Copyright (C) 2019-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -7,26 +7,40 @@ #pragma once +#include "shared/source/execution_environment/root_device_environment.h" #include "shared/source/helpers/hw_helper.h" +#include "shared/source/helpers/hw_info.h" namespace NEO { -extern GfxCoreHelper *gfxCoreHelperFactory[IGFX_MAX_CORE]; +extern GfxCoreHelperCreateFunctionType gfxCoreHelperFactory[IGFX_MAX_CORE]; template class RAIIGfxCoreHelperFactory { public: GFXCORE_FAMILY gfxCoreFamily; - GfxCoreHelper *gfxCoreHelper; - MockHelper mockGfxCoreHelper{}; + GfxCoreHelperCreateFunctionType createGfxCoreHelper; + std::unique_ptr gfxCoreHelperBackup; + MockHelper *mockGfxCoreHelper; + RootDeviceEnvironment &rootDeviceEnvironment; - RAIIGfxCoreHelperFactory(GFXCORE_FAMILY gfxCoreFamily) { - this->gfxCoreFamily = gfxCoreFamily; - gfxCoreHelper = gfxCoreHelperFactory[this->gfxCoreFamily]; - gfxCoreHelperFactory[this->gfxCoreFamily] = &mockGfxCoreHelper; + static std::unique_ptr create() { + + return std::unique_ptr(new MockHelper()); + } + GfxCoreHelperCreateFunctionType createMockGfxCoreHelper = create; + + RAIIGfxCoreHelperFactory(RootDeviceEnvironment &rootDeviceEnvironment) : rootDeviceEnvironment(rootDeviceEnvironment) { + this->gfxCoreFamily = rootDeviceEnvironment.getHardwareInfo()->platform.eRenderCoreFamily; + createGfxCoreHelper = gfxCoreHelperFactory[this->gfxCoreFamily]; + gfxCoreHelperFactory[this->gfxCoreFamily] = createMockGfxCoreHelper; + gfxCoreHelperBackup = createMockGfxCoreHelper(); + rootDeviceEnvironment.gfxCoreHelper.swap(gfxCoreHelperBackup); + mockGfxCoreHelper = static_cast(rootDeviceEnvironment.gfxCoreHelper.get()); } ~RAIIGfxCoreHelperFactory() { - gfxCoreHelperFactory[this->gfxCoreFamily] = gfxCoreHelper; + gfxCoreHelperFactory[this->gfxCoreFamily] = createGfxCoreHelper; + rootDeviceEnvironment.gfxCoreHelper.swap(gfxCoreHelperBackup); } }; } // namespace NEO \ No newline at end of file diff --git a/shared/test/unit_test/device/windows/neo_device_windows_tests.cpp b/shared/test/unit_test/device/windows/neo_device_windows_tests.cpp index c67919afa7..1996433f3c 100644 --- a/shared/test/unit_test/device/windows/neo_device_windows_tests.cpp +++ b/shared/test/unit_test/device/windows/neo_device_windows_tests.cpp @@ -94,9 +94,9 @@ HWTEST_F(MockOSTimeWinTest, whenConvertingTimestampsToCsDomainThenTimestampDataA auto wddmMock = new WddmMock(rootDeviceEnvironment); auto device = std::unique_ptr(MockDevice::createWithNewExecutionEnvironment(nullptr)); wddmMock->init(); - auto hwInfo = wddmMock->getRootDeviceEnvironment().getHardwareInfo(); - RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{hwInfo->platform.eRenderCoreFamily}; - auto &gfxCoreHelper = gfxCoreHelperBackup.mockGfxCoreHelper; + RAIIGfxCoreHelperFactory> gfxCoreHelperBackup{ + *device->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]}; + auto &gfxCoreHelper = *gfxCoreHelperBackup.mockGfxCoreHelper; std::unique_ptr timeWin(new MockOSTimeWin(wddmMock)); uint64_t timestampData = 0x1234; uint64_t freqOA = 5; @@ -126,7 +126,7 @@ HWTEST_F(MockOSTimeWinTest, whenConvertingTimestampsToCsDomainThenTimestampDataA timeWin->convertTimestampsFromOaToCsDomain(gfxCoreHelper, timestampData, freqOA, freqCS); EXPECT_EQ(expectedGpuTicksWhenNotChange, timestampData); - gfxCoreHelperBackup.mockGfxCoreHelper.shiftRequired = false; + gfxCoreHelperBackup.mockGfxCoreHelper->shiftRequired = false; freqOA = 1; freqCS = 0; expectedGpuTicksWhenNotChange = timestampData; diff --git a/shared/test/unit_test/gen11/test_preamble_gen11.cpp b/shared/test/unit_test/gen11/test_preamble_gen11.cpp index 75f20323b3..61e9510eb4 100644 --- a/shared/test/unit_test/gen11/test_preamble_gen11.cpp +++ b/shared/test/unit_test/gen11/test_preamble_gen11.cpp @@ -160,7 +160,8 @@ GEN11TEST_F(ThreadArbitrationGen11, whenThreadArbitrationPolicyIsProgrammedThenC } GEN11TEST_F(ThreadArbitrationGen11, GivenDefaultWhenProgrammingPreambleThenArbitrationPolicyIsRoundRobin) { - EXPECT_EQ(ThreadArbitrationPolicy::RoundRobinAfterDependency, GfxCoreHelperHw::get().getDefaultThreadArbitrationPolicy()); + auto &gfxCoreHelper = getHelper(); + EXPECT_EQ(ThreadArbitrationPolicy::RoundRobinAfterDependency, gfxCoreHelper.getDefaultThreadArbitrationPolicy()); } GEN11TEST_F(ThreadArbitrationGen11, whenGetSupportThreadArbitrationPoliciesIsCalledThenAllPoliciesAreReturned) { diff --git a/shared/test/unit_test/gen8/test_preamble_gen8.cpp b/shared/test/unit_test/gen8/test_preamble_gen8.cpp index 28e51f7110..34a4f3fe97 100644 --- a/shared/test/unit_test/gen8/test_preamble_gen8.cpp +++ b/shared/test/unit_test/gen8/test_preamble_gen8.cpp @@ -73,7 +73,8 @@ BDWTEST_F(ThreadArbitrationGen8, givenPolicyWhenThreadArbitrationProgrammedThenD MockDevice device; EXPECT_EQ(0u, PreambleHelper::getAdditionalCommandsSize(device)); - EXPECT_EQ(ThreadArbitrationPolicy::AgeBased, GfxCoreHelperHw::get().getDefaultThreadArbitrationPolicy()); + auto &gfxCoreHelper = getHelper(); + EXPECT_EQ(ThreadArbitrationPolicy::AgeBased, gfxCoreHelper.getDefaultThreadArbitrationPolicy()); } BDWTEST_F(ThreadArbitrationGen8, whenGetSupportThreadArbitrationPoliciesIsCalledThenEmptyVectorIsReturned) { diff --git a/shared/test/unit_test/gen9/test_preamble_gen9.cpp b/shared/test/unit_test/gen9/test_preamble_gen9.cpp index 00827b8c00..241d6f2324 100644 --- a/shared/test/unit_test/gen9/test_preamble_gen9.cpp +++ b/shared/test/unit_test/gen9/test_preamble_gen9.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2022 Intel Corporation + * Copyright (C) 2018-2023 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -73,7 +73,8 @@ GEN9TEST_F(Gen9L3Config, GivenSlmWhenProgrammingL3ThenProgrammingIsCorrect) { using ThreadArbitration = PreambleFixture; GEN9TEST_F(ThreadArbitration, GivenDefaultWhenProgrammingPreambleThenArbitrationPolicyIsRoundRobin) { - EXPECT_EQ(ThreadArbitrationPolicy::RoundRobin, GfxCoreHelperHw::get().getDefaultThreadArbitrationPolicy()); + auto &gfxCoreHelper = getHelper(); + EXPECT_EQ(ThreadArbitrationPolicy::RoundRobin, gfxCoreHelper.getDefaultThreadArbitrationPolicy()); } GEN9TEST_F(ThreadArbitration, whenGetSupportedThreadArbitrationPoliciesIsCalledThenAgeBasedAndRoundRobinAreReturned) { diff --git a/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp b/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp index 9dad6bce52..2e20c3a7d5 100644 --- a/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp +++ b/shared/test/unit_test/os_interface/linux/hw_info_config_linux_tests.cpp @@ -364,7 +364,7 @@ HWTEST2_F(HwConfigLinux, GivenDifferentValuesFromTopologyQueryWhenConfiguringHwI auto executionEnvironment = std::make_unique(); executionEnvironment->prepareRootDeviceEnvironments(1); - *executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo() = *NEO::defaultHwInfo.get(); + executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(NEO::defaultHwInfo.get()); auto drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]); executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique(); auto osInterface = executionEnvironment->rootDeviceEnvironments[0]->osInterface.get(); @@ -416,7 +416,7 @@ HWTEST2_F(HwConfigLinux, givenSliceCountWhenConfigureHwInfoDrmThenProperInitiali auto executionEnvironment = std::make_unique(); executionEnvironment->prepareRootDeviceEnvironments(1); - *executionEnvironment->rootDeviceEnvironments[0]->getMutableHardwareInfo() = *NEO::defaultHwInfo.get(); + executionEnvironment->rootDeviceEnvironments[0]->setHwInfoAndInitHelpers(NEO::defaultHwInfo.get()); auto drm = new DrmMock(*executionEnvironment->rootDeviceEnvironments[0]); executionEnvironment->rootDeviceEnvironments[0]->osInterface = std::make_unique();