diff --git a/shared/source/built_ins/built_ins_storage.cpp b/shared/source/built_ins/built_ins_storage.cpp index 6e2907fbe6..66fff20c22 100644 --- a/shared/source/built_ins/built_ins_storage.cpp +++ b/shared/source/built_ins/built_ins_storage.cpp @@ -80,7 +80,7 @@ std::string createBuiltinResourceName(EBuiltInOps::Type builtin, const std::stri StackVec getBuiltinResourceNames(EBuiltInOps::Type builtin, BuiltinCode::ECodeType type, const Device &device) { auto &hwInfo = device.getHardwareInfo(); - auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = device.getGfxCoreHelper(); auto &productHelper = device.getRootDeviceEnvironment().getHelper(); const auto platformName = getFamilyNameWithType(hwInfo); diff --git a/shared/source/built_ins/sip.cpp b/shared/source/built_ins/sip.cpp index f563b5c538..f59302a85f 100644 --- a/shared/source/built_ins/sip.cpp +++ b/shared/source/built_ins/sip.cpp @@ -73,7 +73,7 @@ const std::vector &SipKernel::getStateSaveAreaHeader() const { size_t SipKernel::getStateSaveAreaSize(Device *device) const { auto &hwInfo = device->getHardwareInfo(); - auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = device->getGfxCoreHelper(); auto maxDbgSurfaceSize = gfxCoreHelper.getSipKernelMaxDbgSurfaceSize(hwInfo); const auto &stateSaveAreaHeader = getStateSaveAreaHeader(); if (stateSaveAreaHeader.empty()) { @@ -105,7 +105,7 @@ SipKernelType SipKernel::getSipKernelType(Device &device) { } SipKernelType SipKernel::getSipKernelType(Device &device, bool debuggingEnabled) { - auto &gfxCoreHelper = GfxCoreHelper::get(device.getHardwareInfo().platform.eRenderCoreFamily); + auto &gfxCoreHelper = device.getGfxCoreHelper(); return gfxCoreHelper.getSipKernelType(debuggingEnabled); } @@ -191,7 +191,7 @@ bool SipKernel::initHexadecimalArraySipKernel(SipKernelType type, Device &device uint32_t *sipKernelBinary = nullptr; size_t kernelBinarySize = 0u; auto &hwInfo = device.getHardwareInfo(); - auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = device.getGfxCoreHelper(); gfxCoreHelper.setSipKernelData(sipKernelBinary, kernelBinarySize); const auto allocType = AllocationType::KERNEL_ISA_INTERNAL; diff --git a/shared/source/command_container/cmdcontainer.cpp b/shared/source/command_container/cmdcontainer.cpp index 5b9e71c119..3d6bf6fa65 100644 --- a/shared/source/command_container/cmdcontainer.cpp +++ b/shared/source/command_container/cmdcontainer.cpp @@ -77,7 +77,7 @@ CommandContainer::ErrorCode CommandContainer::initialize(Device *device, Allocat cmdBufferAllocations.push_back(cmdBufferAllocation); const auto &hardwareInfo = device->getHardwareInfo(); - auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hardwareInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = device->getGfxCoreHelper(); commandStream = std::make_unique(cmdBufferAllocation->getUnderlyingBuffer(), alignedSize - cmdBufferReservedSize, this, gfxCoreHelper.getBatchBufferEndSize()); @@ -296,7 +296,7 @@ void CommandContainer::allocateNextCommandBuffer() { } void CommandContainer::closeAndAllocateNextCommandBuffer() { - auto &gfxCoreHelper = NEO::GfxCoreHelper::get(device->getHardwareInfo().platform.eRenderCoreFamily); + auto &gfxCoreHelper = device->getGfxCoreHelper(); auto bbEndSize = gfxCoreHelper.getBatchBufferEndSize(); auto ptr = commandStream->getSpace(0u); memcpy_s(ptr, bbEndSize, gfxCoreHelper.getBatchBufferEndReference(), bbEndSize); @@ -383,7 +383,7 @@ GraphicsAllocation *CommandContainer::allocateCommandBuffer() { void CommandContainer::fillReusableAllocationLists() { this->immediateReusableAllocationList = std::make_unique(); const auto &hardwareInfo = device->getHardwareInfo(); - auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hardwareInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = device->getGfxCoreHelper(); auto amountToFill = gfxCoreHelper.getAmountOfAllocationsToFill(); if (amountToFill == 0u) { return; diff --git a/shared/source/command_stream/command_stream_receiver_hw_base.inl b/shared/source/command_stream/command_stream_receiver_hw_base.inl index d9457e8b9a..b6264401f9 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_base.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_base.inl @@ -60,7 +60,7 @@ CommandStreamReceiverHw::CommandStreamReceiverHw(ExecutionEnvironment : CommandStreamReceiver(executionEnvironment, rootDeviceIndex, deviceBitfield) { const auto &hwInfo = peekHwInfo(); - auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = getGfxCoreHelper(); localMemoryEnabled = gfxCoreHelper.getEnableLocalMemory(hwInfo); resetKmdNotifyHelper(new KmdNotifyHelper(&hwInfo.capabilityTable.kmdNotifyProperties)); @@ -292,7 +292,7 @@ CompletionStamp CommandStreamReceiverHw::flushTask( } const auto &hwInfo = peekHwInfo(); - auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = getGfxCoreHelper(); if (dispatchFlags.blocking || dispatchFlags.dcFlush || dispatchFlags.guardCommandBufferWithPipeControl || this->heapStorageReqiuresRecyclingTag) { if (this->dispatchMode == DispatchMode::ImmediateDispatch) { @@ -1082,7 +1082,7 @@ inline void CommandStreamReceiverHw::programVFEState(LinearStream &cs auto disableOverdispatch = (dispatchFlags.additionalKernelExecInfo != AdditionalKernelExecInfo::NotSet); streamProperties.frontEndState.setProperties(isCooperative, dispatchFlags.disableEUFusion, disableOverdispatch, osContext->isEngineInstanced(), hwInfo); - auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = getGfxCoreHelper(); auto engineGroupType = gfxCoreHelper.getEngineGroupType(getOsContext().getEngineType(), getOsContext().getEngineUsage(), hwInfo); auto pVfeState = PreambleHelper::getSpaceForVfeState(&csr, hwInfo, engineGroupType); PreambleHelper::programVfeState( @@ -1394,7 +1394,7 @@ inline SubmissionStatus CommandStreamReceiverHw::flushHandler(BatchBu template inline bool CommandStreamReceiverHw::isUpdateTagFromWaitEnabled() { - auto &gfxCoreHelper = GfxCoreHelper::get(peekHwInfo().platform.eRenderCoreFamily); + auto &gfxCoreHelper = getGfxCoreHelper(); auto enabled = gfxCoreHelper.isUpdateTaskCountFromWaitSupported(); enabled &= this->isAnyDirectSubmissionEnabled(); @@ -1514,7 +1514,7 @@ inline bool CommandStreamReceiverHw::initDirectSubmission() { template TagAllocatorBase *CommandStreamReceiverHw::getTimestampPacketAllocator() { if (timestampPacketAllocator.get() == nullptr) { - auto &gfxCoreHelper = GfxCoreHelper::get(peekHwInfo().platform.eRenderCoreFamily); + auto &gfxCoreHelper = getGfxCoreHelper(); const RootDeviceIndicesContainer rootDeviceIndices = {rootDeviceIndex}; timestampPacketAllocator = gfxCoreHelper.createTimestampPacketAllocator(rootDeviceIndices, getMemoryManager(), getPreferredTagPoolSize(), getType(), osContext->getDeviceBitfield()); diff --git a/shared/source/command_stream/command_stream_receiver_hw_xehp_and_later.inl b/shared/source/command_stream/command_stream_receiver_hw_xehp_and_later.inl index def8928883..dd88fca3b5 100644 --- a/shared/source/command_stream/command_stream_receiver_hw_xehp_and_later.inl +++ b/shared/source/command_stream/command_stream_receiver_hw_xehp_and_later.inl @@ -139,7 +139,7 @@ inline void CommandStreamReceiverHw::programActivePartitionConfig(Lin template inline void CommandStreamReceiverHw::addPipeControlBeforeStateSip(LinearStream &commandStream, Device &device) { auto &hwInfo = peekHwInfo(); - GfxCoreHelper &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = getGfxCoreHelper(); auto hwInfoConfig = HwInfoConfig::get(hwInfo.platform.eProductFamily); bool debuggingEnabled = device.getDebugger() != nullptr; PipeControlArgs args; diff --git a/shared/source/command_stream/preemption_xehp_and_later.inl b/shared/source/command_stream/preemption_xehp_and_later.inl index 7022ac158a..6ea658e0b7 100644 --- a/shared/source/command_stream/preemption_xehp_and_later.inl +++ b/shared/source/command_stream/preemption_xehp_and_later.inl @@ -18,7 +18,7 @@ void PreemptionHelper::programStateSip(LinearStream &preambleCmdStrea bool debuggingEnabled = device.getDebugger() != nullptr; if (debuggingEnabled) { - GfxCoreHelper &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = device.getGfxCoreHelper(); auto sipAllocation = SipKernel::getSipKernel(device).getSipAllocation(); if (gfxCoreHelper.isSipWANeeded(hwInfo)) { @@ -75,7 +75,7 @@ size_t PreemptionHelper::getRequiredStateSipCmdSize(Device &device, b auto &hwInfo = device.getHardwareInfo(); if (debuggingEnabled) { - GfxCoreHelper &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = device.getGfxCoreHelper(); if (gfxCoreHelper.isSipWANeeded(hwInfo)) { size += MemorySynchronizationCommands::getSizeForSingleBarrier(false); diff --git a/shared/source/command_stream/scratch_space_controller_base.cpp b/shared/source/command_stream/scratch_space_controller_base.cpp index 1f4f0d3b62..67356b1348 100644 --- a/shared/source/command_stream/scratch_space_controller_base.cpp +++ b/shared/source/command_stream/scratch_space_controller_base.cpp @@ -76,7 +76,7 @@ uint64_t ScratchSpaceControllerBase::getScratchPatchAddress() { void ScratchSpaceControllerBase::reserveHeap(IndirectHeap::Type heapType, IndirectHeap *&indirectHeap) { if (heapType == IndirectHeap::Type::SURFACE_STATE) { - auto &gfxCoreHelper = GfxCoreHelper::get(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo()->platform.eRenderCoreFamily); + auto &gfxCoreHelper = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHelper(); auto surfaceStateSize = gfxCoreHelper.getRenderSurfaceStateSize(); indirectHeap->getSpace(surfaceStateSize); } diff --git a/shared/source/command_stream/tbx_command_stream_receiver_hw.inl b/shared/source/command_stream/tbx_command_stream_receiver_hw.inl index 90f6b7562f..2138351e75 100644 --- a/shared/source/command_stream/tbx_command_stream_receiver_hw.inl +++ b/shared/source/command_stream/tbx_command_stream_receiver_hw.inl @@ -165,8 +165,9 @@ CommandStreamReceiver *TbxCommandStreamReceiverHw::create(const std:: uint32_t rootDeviceIndex, const DeviceBitfield deviceBitfield) { TbxCommandStreamReceiverHw *csr; - auto &hwInfo = *(executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo()); - auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]; + auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo(); + auto &gfxCoreHelper = rootDeviceEnvironment.getHelper(); const auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily); if (withAubDump) { auto localMemoryEnabled = gfxCoreHelper.getEnableLocalMemory(hwInfo); @@ -174,11 +175,11 @@ CommandStreamReceiver *TbxCommandStreamReceiverHw::create(const std:: if (DebugManager.flags.AUBDumpCaptureFileName.get() != "unk") { fullName.assign(DebugManager.flags.AUBDumpCaptureFileName.get()); } - executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->initAubCenter(localMemoryEnabled, fullName, CommandStreamReceiverType::CSR_TBX_WITH_AUB); + rootDeviceEnvironment.initAubCenter(localMemoryEnabled, fullName, CommandStreamReceiverType::CSR_TBX_WITH_AUB); csr = new CommandStreamReceiverWithAUBDump>(baseName, executionEnvironment, rootDeviceIndex, deviceBitfield); - auto aubCenter = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->aubCenter.get(); + auto aubCenter = rootDeviceEnvironment.aubCenter.get(); UNRECOVERABLE_IF(nullptr == aubCenter); auto subCaptureCommon = aubCenter->getSubCaptureCommon(); diff --git a/shared/source/helpers/hw_helper.h b/shared/source/helpers/hw_helper.h index 7512665ef5..36a1234349 100644 --- a/shared/source/helpers/hw_helper.h +++ b/shared/source/helpers/hw_helper.h @@ -97,7 +97,7 @@ class GfxCoreHelper { virtual uint32_t getMocsIndex(const GmmHelper &gmmHelper, bool l3enabled, bool l1enabled) const = 0; virtual bool isLinearStoragePreferred(bool isSharedContext, bool isImage1d, bool forceLinearStorage) = 0; virtual uint8_t getBarriersCountFromHasBarriers(uint8_t hasBarriers) const = 0; - virtual uint32_t calculateAvailableThreadCount(const HardwareInfo &hwInfo, uint32_t grfCount) = 0; + virtual uint32_t calculateAvailableThreadCount(const HardwareInfo &hwInfo, uint32_t grfCount) const = 0; virtual uint32_t alignSlmSize(uint32_t slmSize) = 0; virtual uint32_t computeSlmValues(const HardwareInfo &hwInfo, uint32_t slmSize) = 0; @@ -277,7 +277,7 @@ class GfxCoreHelperHw : public GfxCoreHelper { uint8_t getBarriersCountFromHasBarriers(uint8_t hasBarriers) const override; - uint32_t calculateAvailableThreadCount(const HardwareInfo &hwInfo, uint32_t grfCount) override; + uint32_t calculateAvailableThreadCount(const HardwareInfo &hwInfo, uint32_t grfCount) const override; uint32_t alignSlmSize(uint32_t slmSize) override; diff --git a/shared/source/helpers/hw_helper_bdw_and_later.inl b/shared/source/helpers/hw_helper_bdw_and_later.inl index 71e4e520a7..4bd19e8962 100644 --- a/shared/source/helpers/hw_helper_bdw_and_later.inl +++ b/shared/source/helpers/hw_helper_bdw_and_later.inl @@ -89,7 +89,7 @@ uint32_t GfxCoreHelperHw::getMocsIndex(const GmmHelper &gmmHelper, bo } template -uint32_t GfxCoreHelperHw::calculateAvailableThreadCount(const HardwareInfo &hwInfo, uint32_t grfCount) { +uint32_t GfxCoreHelperHw::calculateAvailableThreadCount(const HardwareInfo &hwInfo, uint32_t grfCount) const { return hwInfo.gtSystemInfo.ThreadCount; } diff --git a/shared/source/helpers/hw_helper_pvc_and_later.inl b/shared/source/helpers/hw_helper_pvc_and_later.inl index e792e56887..acafa2c1c3 100644 --- a/shared/source/helpers/hw_helper_pvc_and_later.inl +++ b/shared/source/helpers/hw_helper_pvc_and_later.inl @@ -83,7 +83,7 @@ size_t GfxCoreHelperHw::getPaddingForISAAllocation() const { } template <> -uint32_t GfxCoreHelperHw::calculateAvailableThreadCount(const HardwareInfo &hwInfo, uint32_t grfCount) { +uint32_t GfxCoreHelperHw::calculateAvailableThreadCount(const HardwareInfo &hwInfo, uint32_t grfCount) const { auto maxThreadsPerEuCount = 1024u / grfCount; return maxThreadsPerEuCount * hwInfo.gtSystemInfo.EUCount; } diff --git a/shared/source/helpers/hw_helper_xehp_and_later.inl b/shared/source/helpers/hw_helper_xehp_and_later.inl index 912956c1a7..4d7362ce97 100644 --- a/shared/source/helpers/hw_helper_xehp_and_later.inl +++ b/shared/source/helpers/hw_helper_xehp_and_later.inl @@ -127,7 +127,7 @@ uint32_t GfxCoreHelperHw::getMocsIndex(const GmmHelper &gmmHelper, bo } template -uint32_t GfxCoreHelperHw::calculateAvailableThreadCount(const HardwareInfo &hwInfo, uint32_t grfCount) { +uint32_t GfxCoreHelperHw::calculateAvailableThreadCount(const HardwareInfo &hwInfo, uint32_t grfCount) const { if (grfCount > GrfConfig::DefaultGrfNumber) { return hwInfo.gtSystemInfo.ThreadCount / 2u; } diff --git a/shared/source/os_interface/linux/drm_neo.cpp b/shared/source/os_interface/linux/drm_neo.cpp index 9271e58019..4df4947e91 100644 --- a/shared/source/os_interface/linux/drm_neo.cpp +++ b/shared/source/os_interface/linux/drm_neo.cpp @@ -925,7 +925,7 @@ void Drm::setupSystemInfo(HardwareInfo *hwInfo, SystemInfo *sysInfo) { } void Drm::setupCacheInfo(const HardwareInfo &hwInfo) { - auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = rootDeviceEnvironment.getHelper(); if (DebugManager.flags.ClosEnabled.get() == 0 || gfxCoreHelper.getNumCacheRegions() == 0) { this->cacheInfo.reset(new CacheInfo(*this, 0, 0, 0)); @@ -1335,7 +1335,7 @@ uint64_t Drm::getPatIndex(Gmm *gmm, AllocationType allocationType, CacheRegion c return CommonConstants::unsupportedPatIndex; } - auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo->platform.eRenderCoreFamily); + auto &gfxCoreHelper = rootDeviceEnvironment.getHelper(); GMM_RESOURCE_INFO *resourceInfo = nullptr; GMM_RESOURCE_USAGE_TYPE usageType = CacheSettingsHelper::getGmmUsageType(allocationType, false, *hwInfo); @@ -1486,7 +1486,7 @@ int Drm::createDrmVirtualMemory(uint32_t &drmVmId) { auto hwInfo = this->getRootDeviceEnvironment().getHardwareInfo(); auto memInfo = this->getMemoryInfo(); if (DebugManager.flags.UseTileMemoryBankInVirtualMemoryCreation.get() != 0) { - if (memInfo && GfxCoreHelper::get(hwInfo->platform.eRenderCoreFamily).getEnableLocalMemory(*hwInfo)) { + if (memInfo && rootDeviceEnvironment.getHelper().getEnableLocalMemory(*hwInfo)) { regionInstanceClass = memInfo->getMemoryRegionClassAndInstance(memoryBank, *this->rootDeviceEnvironment.getHardwareInfo()); } } diff --git a/shared/source/os_interface/linux/performance_counters_linux.cpp b/shared/source/os_interface/linux/performance_counters_linux.cpp index f1f3db681a..03662adc1e 100644 --- a/shared/source/os_interface/linux/performance_counters_linux.cpp +++ b/shared/source/os_interface/linux/performance_counters_linux.cpp @@ -20,8 +20,7 @@ namespace NEO { std::unique_ptr PerformanceCounters::create(Device *device) { auto counter = std::make_unique(); auto drm = device->getOSTime()->getOSInterface()->getDriverModel()->as(); - auto gen = device->getHardwareInfo().platform.eRenderCoreFamily; - auto &gfxCoreHelper = GfxCoreHelper::get(gen); + auto &gfxCoreHelper = device->getGfxCoreHelper(); UNRECOVERABLE_IF(counter == nullptr); if (!device->isSubDevice()) { diff --git a/shared/source/os_interface/windows/performance_counters_win.cpp b/shared/source/os_interface/windows/performance_counters_win.cpp index bcf94d7983..5a71cbf033 100644 --- a/shared/source/os_interface/windows/performance_counters_win.cpp +++ b/shared/source/os_interface/windows/performance_counters_win.cpp @@ -20,8 +20,7 @@ namespace NEO { std::unique_ptr PerformanceCounters::create(Device *device) { auto counter = std::make_unique(); auto wddm = device->getOSTime()->getOSInterface()->getDriverModel()->as(); - auto gen = device->getHardwareInfo().platform.eRenderCoreFamily; - auto &gfxCoreHelper = GfxCoreHelper::get(gen); + auto &gfxCoreHelper = device->getGfxCoreHelper(); UNRECOVERABLE_IF(counter == nullptr); counter->clientData.Windows.Adapter = reinterpret_cast(static_cast(wddm->getAdapter())); diff --git a/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp b/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp index a187f87cb1..9578f31648 100644 --- a/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp +++ b/shared/source/xe_hpc_core/command_encoder_xe_hpc_core.cpp @@ -45,7 +45,7 @@ void EncodeDispatchKernel::adjustInterfaceDescriptorData(INTERFACE_DESCR constexpr uint32_t maxThreadsInTGForTGDispatchSize8 = 16u; constexpr uint32_t maxThreadsInTGForTGDispatchSize4 = 32u; - auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = device.getGfxCoreHelper(); uint32_t availableThreadCount = gfxCoreHelper.calculateAvailableThreadCount(hwInfo, numGrf); if (ImplicitScalingHelper::isImplicitScalingEnabled(device.getDeviceBitfield(), true)) { const uint32_t tilesCount = device.getNumSubDevices();