diff --git a/shared/source/command_stream/command_stream_receiver.cpp b/shared/source/command_stream/command_stream_receiver.cpp index f5de432e2a..61f25aba6f 100644 --- a/shared/source/command_stream/command_stream_receiver.cpp +++ b/shared/source/command_stream/command_stream_receiver.cpp @@ -71,7 +71,8 @@ CommandStreamReceiver::CommandStreamReceiver(ExecutionEnvironment &executionEnvi internalAllocationStorage = std::make_unique(*this); const auto &hwInfo = peekHwInfo(); uint32_t subDeviceCount = static_cast(deviceBitfield.count()); - bool platformImplicitScaling = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily).platformSupportsImplicitScaling(hwInfo); + auto &gfxCoreHelper = getGfxCoreHelper(); + bool platformImplicitScaling = gfxCoreHelper.platformSupportsImplicitScaling(hwInfo); if (NEO::ImplicitScalingHelper::isImplicitScalingEnabled(deviceBitfield, platformImplicitScaling) && subDeviceCount > 1 && DebugManager.flags.EnableStaticPartitioning.get() != 0) { @@ -241,7 +242,8 @@ void CommandStreamReceiver::ensureCommandBufferAllocation(LinearStream &commandS } void CommandStreamReceiver::fillReusableAllocationsList() { - auto amountToFill = GfxCoreHelper::get(peekHwInfo().platform.eRenderCoreFamily).getAmountOfAllocationsToFill(); + auto &gfxCoreHelper = getGfxCoreHelper(); + auto amountToFill = gfxCoreHelper.getAmountOfAllocationsToFill(); for (auto i = 0u; i < amountToFill; i++) { const AllocationProperties commandStreamAllocationProperties{rootDeviceIndex, true, MemoryConstants::pageSize64k, AllocationType::COMMAND_BUFFER, isMultiOsContextCapable(), false, deviceBitfield}; @@ -743,9 +745,8 @@ bool CommandStreamReceiver::createWorkPartitionAllocation(const Device &device) } bool CommandStreamReceiver::createGlobalFenceAllocation() { - auto &rootDevicEnvironment = *executionEnvironment.rootDeviceEnvironments[rootDeviceIndex].get(); - auto &gfxCoreHelper = rootDevicEnvironment.getHelper(); - auto &hwInfo = *rootDevicEnvironment.getHardwareInfo(); + auto &gfxCoreHelper = getGfxCoreHelper(); + auto &hwInfo = peekHwInfo(); if (!gfxCoreHelper.isFenceAllocationRequired(hwInfo)) { return true; } @@ -757,13 +758,14 @@ bool CommandStreamReceiver::createGlobalFenceAllocation() { bool CommandStreamReceiver::createPreemptionAllocation() { auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo(); + auto &gfxCoreHelper = getGfxCoreHelper(); size_t preemptionSurfaceSize = hwInfo->capabilityTable.requiredPreemptionSurfaceSize; if (DebugManager.flags.OverrideCsrAllocationSize.get() > 0) { preemptionSurfaceSize = DebugManager.flags.OverrideCsrAllocationSize.get(); } AllocationProperties properties{rootDeviceIndex, true, preemptionSurfaceSize, AllocationType::PREEMPTION, isMultiOsContextCapable(), false, deviceBitfield}; properties.flags.uncacheable = hwInfo->workaroundTable.flags.waCSRUncachable; - properties.alignment = GfxCoreHelper::get(hwInfo->platform.eRenderCoreFamily).getPreemptionAllocationAlignment(); + properties.alignment = gfxCoreHelper.getPreemptionAllocationAlignment(); this->preemptionAllocation = getMemoryManager()->allocateGraphicsMemoryWithProperties(properties); return this->preemptionAllocation != nullptr; } @@ -913,6 +915,10 @@ const RootDeviceEnvironment &CommandStreamReceiver::peekRootDeviceEnvironment() return *executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]; } +const GfxCoreHelper &CommandStreamReceiver::getGfxCoreHelper() const { + return peekRootDeviceEnvironment().getHelper(); +} + TaskCountType CommandStreamReceiver::getCompletionValue(const GraphicsAllocation &gfxAllocation) { if (completionFenceValuePointer) { return *completionFenceValuePointer; diff --git a/shared/source/command_stream/command_stream_receiver.h b/shared/source/command_stream/command_stream_receiver.h index bcf87dcfde..5ee44927a9 100644 --- a/shared/source/command_stream/command_stream_receiver.h +++ b/shared/source/command_stream/command_stream_receiver.h @@ -52,6 +52,7 @@ class GmmHelper; class TagAllocatorBase; class LogicalStateHelper; class KmdNotifyHelper; +class GfxCoreHelper; template class TimestampPackets; @@ -332,6 +333,8 @@ class CommandStreamReceiver { const HardwareInfo &peekHwInfo() const; const RootDeviceEnvironment &peekRootDeviceEnvironment() const; + const GfxCoreHelper &getGfxCoreHelper() const; + MOCKABLE_VIRTUAL bool isGpuHangDetected() const; MOCKABLE_VIRTUAL bool checkGpuHangDetected(TimeType currentTime, TimeType &lastHangCheckTime) const; diff --git a/shared/source/device/device.cpp b/shared/source/device/device.cpp index c15467f270..80c97dd45f 100644 --- a/shared/source/device/device.cpp +++ b/shared/source/device/device.cpp @@ -214,7 +214,7 @@ bool Device::createDeviceImpl() { this->executionEnvironment->rootDeviceEnvironments[getRootDeviceIndex()]->initDebugger(); } - auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = getGfxCoreHelper(); if (getDebugger() && gfxCoreHelper.disableL3CacheForDebug(hwInfo)) { getGmmHelper()->forceAllResourcesUncached(); } @@ -269,7 +269,7 @@ bool Device::createDeviceImpl() { uuid.isValid = false; if (DebugManager.flags.EnableChipsetUniqueUUID.get() != 0) { - if (GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily).isChipsetUniqueUUIDSupported()) { + if (gfxCoreHelper.isChipsetUniqueUUIDSupported()) { uuid.isValid = HwInfoConfig::get(hardwareInfo->platform.eProductFamily)->getUuid(this, uuid.id); } } @@ -289,7 +289,8 @@ bool Device::createEngines() { } auto &hwInfo = getHardwareInfo(); - auto gpgpuEngines = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily).getGpgpuEngineInstances(hwInfo); + auto &gfxCoreHelper = getGfxCoreHelper(); + auto gpgpuEngines = gfxCoreHelper.getGpgpuEngineInstances(hwInfo); uint32_t deviceCsrIndex = 0; for (auto &engine : gpgpuEngines) { @@ -302,7 +303,7 @@ bool Device::createEngines() { void Device::addEngineToEngineGroup(EngineControl &engine) { const HardwareInfo &hardwareInfo = this->getHardwareInfo(); - const GfxCoreHelper &gfxCoreHelper = NEO::GfxCoreHelper::get(hardwareInfo.platform.eRenderCoreFamily); + auto &gfxCoreHelper = getGfxCoreHelper(); const EngineGroupType engineGroupType = gfxCoreHelper.getEngineGroupType(engine.getEngineType(), engine.getEngineUsage(), hardwareInfo); if (!gfxCoreHelper.isSubDeviceEngineSupported(hardwareInfo, getDeviceBitfield(), engine.getEngineType())) { @@ -591,7 +592,7 @@ EngineControl &Device::getNextEngineForCommandQueue() { const auto &defaultEngine = this->getDefaultEngine(); const auto &hardwareInfo = this->getHardwareInfo(); - const auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hardwareInfo.platform.eRenderCoreFamily); + const auto &gfxCoreHelper = getGfxCoreHelper(); const auto engineGroupType = gfxCoreHelper.getEngineGroupType(defaultEngine.getEngineType(), defaultEngine.getEngineUsage(), hardwareInfo); const auto defaultEngineGroupIndex = this->getEngineGroupIndexFromEngineGroupType(engineGroupType); @@ -746,6 +747,10 @@ void Device::getAdapterMask(uint32_t &nodeMask) { } } +const GfxCoreHelper &Device::getGfxCoreHelper() const { + return getRootDeviceEnvironment().getHelper(); +} + void Device::allocateRTDispatchGlobals(uint32_t maxBvhLevels) { UNRECOVERABLE_IF(rtDispatchGlobalsInfos.size() < maxBvhLevels + 1); UNRECOVERABLE_IF(rtDispatchGlobalsInfos[maxBvhLevels] != nullptr); diff --git a/shared/source/device/device.h b/shared/source/device/device.h index baf7b7b1f3..882c10b60b 100644 --- a/shared/source/device/device.h +++ b/shared/source/device/device.h @@ -23,6 +23,7 @@ class OSTime; class SourceLevelDebugger; class SubDevice; struct PhysicalDevicePciBusInfo; +class GfxCoreHelper; struct SelectorCopyEngine : NonCopyableOrMovableClass { std::atomic isMainUsed = false; @@ -144,6 +145,7 @@ class Device : public ReferenceTrackedObject { void getAdapterLuid(std::array &luid); MOCKABLE_VIRTUAL bool verifyAdapterLuid(); void getAdapterMask(uint32_t &nodeMask); + const GfxCoreHelper &getGfxCoreHelper() const; std::atomic debugExecutionCounter = 0;