diff --git a/level_zero/core/source/cmdlist/cmdlist_imp.cpp b/level_zero/core/source/cmdlist/cmdlist_imp.cpp index 15543d012e..ab013dd48a 100644 --- a/level_zero/core/source/cmdlist/cmdlist_imp.cpp +++ b/level_zero/core/source/cmdlist/cmdlist_imp.cpp @@ -108,7 +108,7 @@ CommandList *CommandList::createImmediate(uint32_t productFamily, Device *device NEO::CommandStreamReceiver *csr = nullptr; auto deviceImp = static_cast(device); const auto &hwInfo = device->getHwInfo(); - auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = device->getGfxCoreHelper(); if (internalUsage) { if (NEO::EngineHelper::isCopyOnlyEngineType(engineGroupType) && deviceImp->getActiveDevice()->getInternalCopyEngine()) { csr = deviceImp->getActiveDevice()->getInternalCopyEngine()->commandStreamReceiver; diff --git a/level_zero/core/source/context/context_imp.cpp b/level_zero/core/source/context/context_imp.cpp index bae3f4e385..e5c5f98a0c 100644 --- a/level_zero/core/source/context/context_imp.cpp +++ b/level_zero/core/source/context/context_imp.cpp @@ -601,7 +601,7 @@ ze_result_t ContextImp::openEventPoolIpcHandle(const ze_ipc_event_pool_handle_t auto neoDevice = device->getNEODevice(); NEO::osHandle osHandle = static_cast(handle); - eventPool->initializeSizeParameters(this->numDevices, this->deviceHandles.data(), *this->driverHandle, device->getHwInfo()); + eventPool->initializeSizeParameters(this->numDevices, this->deviceHandles.data(), *this->driverHandle, neoDevice->getRootDeviceEnvironment()); NEO::AllocationProperties unifiedMemoryProperties{rootDeviceIndex, eventPool->getEventPoolSize(), diff --git a/level_zero/core/source/event/event.cpp b/level_zero/core/source/event/event.cpp index daea987b33..f9d6ca7d93 100644 --- a/level_zero/core/source/event/event.cpp +++ b/level_zero/core/source/event/event.cpp @@ -76,11 +76,11 @@ ze_result_t EventPoolImp::initialize(DriverHandle *driver, Context *context, uin } rootDeviceIndices.remove_duplicates(); - auto &hwInfo = getDevice()->getHwInfo(); - auto &l0GfxCoreHelper = getDevice()->getNEODevice()->getRootDeviceEnvironment().getHelper(); + auto &rootDeviceEnvironment = getDevice()->getNEODevice()->getRootDeviceEnvironment(); + auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper(); useDeviceAlloc |= l0GfxCoreHelper.alwaysAllocateEventInLocalMem(); - initializeSizeParameters(numDevices, phDevices, *driverHandleImp, hwInfo); + initializeSizeParameters(numDevices, phDevices, *driverHandleImp, rootDeviceEnvironment); NEO::AllocationType allocationType = isEventPoolTimestampFlagSet() ? NEO::AllocationType::TIMESTAMP_PACKET_TAG_BUFFER : NEO::AllocationType::BUFFER_HOST_MEMORY; @@ -160,12 +160,14 @@ ze_result_t EventPoolImp::createEvent(const ze_event_desc_t *desc, ze_event_hand return ZE_RESULT_SUCCESS; } -void EventPoolImp::initializeSizeParameters(uint32_t numDevices, ze_device_handle_t *deviceHandles, DriverHandleImp &driver, const NEO::HardwareInfo &hwInfo) { - auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); - auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); +void EventPoolImp::initializeSizeParameters(uint32_t numDevices, ze_device_handle_t *deviceHandles, DriverHandleImp &driver, const NEO::RootDeviceEnvironment &rootDeviceEnvironment) { + + auto &l0GfxCoreHelper = rootDeviceEnvironment.getHelper(); + auto &gfxCoreHelper = rootDeviceEnvironment.getHelper(); setEventAlignment(static_cast(gfxCoreHelper.getTimestampPacketAllocatorAlignment())); + auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); bool useDynamicEventPackets = l0GfxCoreHelper.useDynamicEventPacketsCount(hwInfo); eventPackets = EventPacketsCount::eventPackets; maxKernelCount = EventPacketsCount::maxKernelSplit; diff --git a/level_zero/core/source/event/event.h b/level_zero/core/source/event/event.h index 5510be2977..ef841c740b 100644 --- a/level_zero/core/source/event/event.h +++ b/level_zero/core/source/event/event.h @@ -19,6 +19,10 @@ struct _ze_event_handle_t {}; struct _ze_event_pool_handle_t {}; +namespace NEO { +struct RootDeviceEnvironment; +} + namespace L0 { typedef uint64_t FlushStamp; struct EventPool; @@ -338,7 +342,7 @@ struct EventPoolImp : public EventPool { ze_result_t createEvent(const ze_event_desc_t *desc, ze_event_handle_t *phEvent) override; - void initializeSizeParameters(uint32_t numDevices, ze_device_handle_t *deviceHandles, DriverHandleImp &driver, const NEO::HardwareInfo &hwInfo); + void initializeSizeParameters(uint32_t numDevices, ze_device_handle_t *deviceHandles, DriverHandleImp &driver, const NEO::RootDeviceEnvironment &rootDeviceEnvironment); Device *getDevice() override { return devices[0]; } diff --git a/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp b/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp index 79d389f3ee..76d68bc2b5 100644 --- a/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp +++ b/level_zero/core/test/aub_tests/fixtures/aub_fixture.cpp @@ -41,15 +41,6 @@ void AUBFixtureL0::setUp(const NEO::HardwareInfo *hardwareInfo, bool debuggingEn ASSERT_NE(nullptr, hardwareInfo); const auto &hwInfo = *hardwareInfo; - auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); - auto engineType = getChosenEngineType(hwInfo); - - const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info(); - std::stringstream strfilename; - - strfilename << NEO::ApiSpecificConfig::getAubPrefixForSpecificApi(); - strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << gfxCoreHelper.getCsTraits(engineType).name; - executionEnvironment = new NEO::ExecutionEnvironment(); executionEnvironment->prepareRootDeviceEnvironments(1u); executionEnvironment->rootDeviceEnvironments[0]->setHwInfo(&hwInfo); @@ -60,6 +51,15 @@ void AUBFixtureL0::setUp(const NEO::HardwareInfo *hardwareInfo, bool debuggingEn } neoDevice = NEO::MockDevice::createWithExecutionEnvironment(&hwInfo, executionEnvironment, 0u); + auto &gfxCoreHelper = neoDevice->getGfxCoreHelper(); + auto engineType = getChosenEngineType(hwInfo); + + const ::testing::TestInfo *const testInfo = ::testing::UnitTest::GetInstance()->current_test_info(); + std::stringstream strfilename; + + strfilename << NEO::ApiSpecificConfig::getAubPrefixForSpecificApi(); + strfilename << testInfo->test_case_name() << "_" << testInfo->name() << "_" << gfxCoreHelper.getCsTraits(engineType).name; + if (NEO::testMode == NEO::TestMode::AubTestsWithTbx) { this->csr = NEO::TbxCommandStreamReceiver::create(strfilename.str(), true, *executionEnvironment, 0, neoDevice->getDeviceBitfield()); } else { diff --git a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_event_reset.cpp b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_event_reset.cpp index 127a175a4f..6a907ab312 100644 --- a/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_event_reset.cpp +++ b/level_zero/core/test/unit_tests/sources/cmdlist/test_cmdlist_append_event_reset.cpp @@ -94,7 +94,7 @@ HWTEST_F(CommandListAppendEventReset, givenCmdlistWhenResetEventWithTimeStampIsA } auto &hwInfo = device->getHwInfo(); - auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); uint32_t maxPackets = EventPacketsCount::eventPackets; if (l0GfxCoreHelper.useDynamicEventPacketsCount(hwInfo)) { @@ -279,7 +279,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent, givenTimestampEventUsedInReset auto &commandContainer = commandList->commandContainer; auto &hwInfo = device->getHwInfo(); - auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); ze_event_pool_desc_t eventPoolDesc = {}; eventPoolDesc.count = 1; @@ -443,7 +443,7 @@ HWTEST2_F(CommandListAppendUsedPacketSignalEvent, postSyncPipeControlItor++; ASSERT_NE(cmdList.end(), postSyncPipeControlItor); - //find multi tile barrier section: pipe control + atomic/semaphore + // find multi tile barrier section: pipe control + atomic/semaphore auto itorPipeControl = find(postSyncPipeControlItor, cmdList.end()); ASSERT_NE(cmdList.end(), itorPipeControl); diff --git a/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp b/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp index 2a1901a84f..01af6f7c8d 100644 --- a/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp +++ b/level_zero/core/test/unit_tests/sources/debugger/test_module_with_debug.cpp @@ -322,7 +322,7 @@ HWTEST_F(KernelDebugSurfaceTest, givenDebuggerAndBindfulKernelWhenAppendingKerne neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger); auto &hwInfo = *NEO::defaultHwInfo.get(); - auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = neoDevice->getGfxCoreHelper(); auto maxDbgSurfaceSize = gfxCoreHelper.getSipKernelMaxDbgSurfaceSize(hwInfo); auto debugSurface = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties( {device->getRootDeviceIndex(), true, @@ -847,7 +847,7 @@ HWTEST_F(NotifyModuleLoadTest, givenDebuggingEnabledWhenModuleIsCreatedAndFullyL auto debugger = MockDebuggerL0Hw::allocate(neoDevice); neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger); - auto elfAdditionalSections = {ZebinTestData::appendElfAdditionalSection::CONSTANT}; //for const surface allocation copy + auto elfAdditionalSections = {ZebinTestData::appendElfAdditionalSection::CONSTANT}; // for const surface allocation copy auto zebinData = std::make_unique(device->getHwInfo(), elfAdditionalSections); const auto &src = zebinData->storage; @@ -871,7 +871,7 @@ HWTEST_F(NotifyModuleLoadTest, givenDebuggingEnabledWhenModuleIsCreatedAndFullyL auto numIsaAllocations = static_cast(module->getKernelImmutableDataVector().size()); - auto expectedMakeResidentCallsCount = numIsaAllocations + 1; //const surface + auto expectedMakeResidentCallsCount = numIsaAllocations + 1; // const surface expectedMakeResidentCallsCount += numIsaAllocations; EXPECT_EQ(expectedMakeResidentCallsCount, memoryOperationsHandler->makeResidentCalledCount); diff --git a/level_zero/core/test/unit_tests/sources/event/test_event.cpp b/level_zero/core/test/unit_tests/sources/event/test_event.cpp index 75ae88293a..9ccf6fe887 100644 --- a/level_zero/core/test/unit_tests/sources/event/test_event.cpp +++ b/level_zero/core/test/unit_tests/sources/event/test_event.cpp @@ -162,8 +162,8 @@ HWTEST_F(EventPoolCreate, givenTimestampEventsThenEventSizeSufficientForAllKerne ASSERT_NE(nullptr, eventPool); auto &hwInfo = device->getHwInfo(); - auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); - auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); + auto &gfxCoreHelper = device->getGfxCoreHelper(); uint32_t maxPacketCount = EventPacketsCount::maxKernelSplit * NEO::TimestampPacketSizeControl::preferredPacketCount; if (l0GfxCoreHelper.useDynamicEventPacketsCount(hwInfo)) { @@ -1153,7 +1153,7 @@ TEST_F(TimestampEventCreate, givenEventCreatedWithTimestampThenIsTimestampEventF TEST_F(TimestampEventCreate, givenEventTimestampsCreatedWhenResetIsInvokeThenCorrectDataAreSet) { auto &hwInfo = device->getHwInfo(); - auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); uint32_t maxKernelCount = EventPacketsCount::maxKernelSplit; if (l0GfxCoreHelper.useDynamicEventPacketsCount(hwInfo)) { @@ -2008,7 +2008,7 @@ HWTEST_F(EventSizeTests, whenCreatingEventPoolThenUseCorrectSizeAndAlignment) { auto &gfxCoreHelper = device->getGfxCoreHelper(); auto &hwInfo = device->getHwInfo(); - auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); uint32_t packetCount = EventPacketsCount::eventPackets; if (l0GfxCoreHelper.useDynamicEventPacketsCount(hwInfo)) { @@ -2044,7 +2044,7 @@ HWTEST_F(EventSizeTests, givenDebugFlagwhenCreatingEventPoolThenUseCorrectSizeAn auto &hwInfo = device->getHwInfo(); auto expectedAlignment = static_cast(gfxCoreHelper.getTimestampPacketAllocatorAlignment()); - auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); uint32_t packetCount = EventPacketsCount::eventPackets; if (l0GfxCoreHelper.useDynamicEventPacketsCount(hwInfo)) { @@ -2277,7 +2277,6 @@ struct MockEventCompletion : public EventImp { MockEventCompletion(L0::EventPool *eventPool, int index, L0::Device *device) : EventImp(eventPool, index, device, false) { auto neoDevice = device->getNEODevice(); auto &hwInfo = neoDevice->getHardwareInfo(); - signalAllEventPackets = L0GfxCoreHelper::useSignalAllEventPackets(hwInfo); auto alloc = eventPool->getAllocation().getGraphicsAllocation(neoDevice->getRootDeviceIndex()); @@ -2421,8 +2420,8 @@ struct EventDynamicPacketUseFixture : public DeviceFixture { void testAllDevices() { auto &hwInfo = device->getHwInfo(); - auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); - auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); + auto &gfxCoreHelper = device->getGfxCoreHelper(); ze_event_pool_desc_t eventPoolDesc = { ZE_STRUCTURE_TYPE_EVENT_POOL_DESC, @@ -2469,7 +2468,7 @@ struct EventDynamicPacketUseFixture : public DeviceFixture { ze_result_t result = ZE_RESULT_SUCCESS; auto &hwInfo = device->getHwInfo(); - auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); ze_event_pool_desc_t eventPoolDesc = { @@ -2528,7 +2527,7 @@ struct EventDynamicPacketUseFixture : public DeviceFixture { ze_result_t result = ZE_RESULT_SUCCESS; auto &hwInfo = device->getHwInfo(); - auto &l0GfxCoreHelper = L0GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &l0GfxCoreHelper = device->getNEODevice()->getRootDeviceEnvironment().getHelper(); ze_event_pool_desc_t eventPoolDesc = { ZE_STRUCTURE_TYPE_EVENT_POOL_DESC, diff --git a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_module_dg2.cpp b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_module_dg2.cpp index 7dd8e1aa25..05a9089950 100644 --- a/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_module_dg2.cpp +++ b/level_zero/core/test/unit_tests/xe_hpg_core/dg2/test_module_dg2.cpp @@ -27,7 +27,7 @@ HWTEST2_F(KernelDebugSurfaceDG2Test, givenDebuggerWhenKernelInitializeCalledThen neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger); auto &hwInfo = *NEO::defaultHwInfo.get(); - auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = neoDevice->getGfxCoreHelper(); auto maxDbgSurfaceSize = gfxCoreHelper.getSipKernelMaxDbgSurfaceSize(hwInfo); auto debugSurface = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties( {device->getRootDeviceIndex(), true, @@ -83,7 +83,7 @@ HWTEST2_F(KernelDebugSurfaceDG2Test, givenNoDebuggerButDebuggerActiveSetWhenPatc neoDevice->getExecutionEnvironment()->rootDeviceEnvironments[0]->debugger.reset(debugger); auto &hwInfo = *NEO::defaultHwInfo.get(); - auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = neoDevice->getGfxCoreHelper(); auto maxDbgSurfaceSize = gfxCoreHelper.getSipKernelMaxDbgSurfaceSize(hwInfo); auto debugSurface = neoDevice->getMemoryManager()->allocateGraphicsMemoryWithProperties( {device->getRootDeviceIndex(), true,