Reduce usage of global gfx core helper getter [2/n]

Related-To: NEO-6853
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-12-12 12:39:04 +00:00
committed by Compute-Runtime-Automation
parent ca14e411e4
commit ecea487cf0
7 changed files with 22 additions and 15 deletions

View File

@@ -177,7 +177,7 @@ BlitOperationResult BlitHelper::blitMemoryToAllocationBanks(const Device &device
if (!hwInfo.capabilityTable.blitterOperationsSupported) { if (!hwInfo.capabilityTable.blitterOperationsSupported) {
return BlitOperationResult::Unsupported; return BlitOperationResult::Unsupported;
} }
auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily); auto &gfxCoreHelper = device.getGfxCoreHelper();
UNRECOVERABLE_IF(memoryBanks.none()); UNRECOVERABLE_IF(memoryBanks.none());

View File

@@ -168,7 +168,8 @@ bool isBcsEnabled(const HardwareInfo &hwInfo, aub_stream::EngineType engineType)
} }
bool linkCopyEnginesSupported(const HardwareInfo &hwInfo, const DeviceBitfield &deviceBitfield) { bool linkCopyEnginesSupported(const HardwareInfo &hwInfo, const DeviceBitfield &deviceBitfield) {
const aub_stream::EngineType engine1 = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily).isSubDeviceEngineSupported(hwInfo, deviceBitfield, aub_stream::ENGINE_BCS1) auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
const aub_stream::EngineType engine1 = gfxCoreHelper.isSubDeviceEngineSupported(hwInfo, deviceBitfield, aub_stream::ENGINE_BCS1)
? aub_stream::ENGINE_BCS1 ? aub_stream::ENGINE_BCS1
: aub_stream::ENGINE_BCS4; : aub_stream::ENGINE_BCS4;
const aub_stream::EngineType engine2 = aub_stream::ENGINE_BCS2; const aub_stream::EngineType engine2 = aub_stream::ENGINE_BCS2;
@@ -177,6 +178,7 @@ bool linkCopyEnginesSupported(const HardwareInfo &hwInfo, const DeviceBitfield &
} }
aub_stream::EngineType selectLinkCopyEngine(const HardwareInfo &hwInfo, const DeviceBitfield &deviceBitfield, std::atomic<uint32_t> &selectorCopyEngine) { aub_stream::EngineType selectLinkCopyEngine(const HardwareInfo &hwInfo, const DeviceBitfield &deviceBitfield, std::atomic<uint32_t> &selectorCopyEngine) {
auto &gfxCoreHelper = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily);
auto enableCmdQRoundRobindBcsEngineAssign = false; auto enableCmdQRoundRobindBcsEngineAssign = false;
if (DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssign.get() != -1) { if (DebugManager.flags.EnableCmdQRoundRobindBcsEngineAssign.get() != -1) {
@@ -216,14 +218,14 @@ aub_stream::EngineType selectLinkCopyEngine(const HardwareInfo &hwInfo, const De
engineType = static_cast<aub_stream::EngineType>(aub_stream::EngineType::ENGINE_BCS1 + selectEngineValue); engineType = static_cast<aub_stream::EngineType>(aub_stream::EngineType::ENGINE_BCS1 + selectEngineValue);
} }
} while (!GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily).isSubDeviceEngineSupported(hwInfo, deviceBitfield, engineType) || !hwInfo.featureTable.ftrBcsInfo.test(engineType == aub_stream::EngineType::ENGINE_BCS } while (!gfxCoreHelper.isSubDeviceEngineSupported(hwInfo, deviceBitfield, engineType) || !hwInfo.featureTable.ftrBcsInfo.test(engineType == aub_stream::EngineType::ENGINE_BCS
? 0 ? 0
: engineType - aub_stream::EngineType::ENGINE_BCS1 + 1)); : engineType - aub_stream::EngineType::ENGINE_BCS1 + 1));
return engineType; return engineType;
} }
const aub_stream::EngineType engine1 = GfxCoreHelper::get(hwInfo.platform.eRenderCoreFamily).isSubDeviceEngineSupported(hwInfo, deviceBitfield, aub_stream::ENGINE_BCS1) const aub_stream::EngineType engine1 = gfxCoreHelper.isSubDeviceEngineSupported(hwInfo, deviceBitfield, aub_stream::ENGINE_BCS1)
? aub_stream::ENGINE_BCS1 ? aub_stream::ENGINE_BCS1
: aub_stream::ENGINE_BCS4; : aub_stream::ENGINE_BCS4;
const aub_stream::EngineType engine2 = aub_stream::ENGINE_BCS2; const aub_stream::EngineType engine2 = aub_stream::ENGINE_BCS2;

View File

@@ -49,10 +49,12 @@ MemoryManager::MemoryManager(ExecutionEnvironment &executionEnvironment) : execu
isaInLocalMemory.resize(rootEnvCount); isaInLocalMemory.resize(rootEnvCount);
for (uint32_t rootDeviceIndex = 0; rootDeviceIndex < rootEnvCount; ++rootDeviceIndex) { for (uint32_t rootDeviceIndex = 0; rootDeviceIndex < rootEnvCount; ++rootDeviceIndex) {
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo(); auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[rootDeviceIndex];
auto hwInfo = rootDeviceEnvironment.getHardwareInfo();
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
internalLocalMemoryUsageBankSelector.emplace_back(new LocalMemoryUsageBankSelector(GfxCoreHelper::getSubDevicesCount(hwInfo))); internalLocalMemoryUsageBankSelector.emplace_back(new LocalMemoryUsageBankSelector(GfxCoreHelper::getSubDevicesCount(hwInfo)));
externalLocalMemoryUsageBankSelector.emplace_back(new LocalMemoryUsageBankSelector(GfxCoreHelper::getSubDevicesCount(hwInfo))); externalLocalMemoryUsageBankSelector.emplace_back(new LocalMemoryUsageBankSelector(GfxCoreHelper::getSubDevicesCount(hwInfo)));
this->localMemorySupported.push_back(GfxCoreHelper::get(hwInfo->platform.eRenderCoreFamily).getEnableLocalMemory(*hwInfo)); this->localMemorySupported.push_back(gfxCoreHelper.getEnableLocalMemory(*hwInfo));
this->enable64kbpages.push_back(OSInterface::osEnabled64kbPages && hwInfo->capabilityTable.ftr64KBpages && !!DebugManager.flags.Enable64kbpages.get()); this->enable64kbpages.push_back(OSInterface::osEnabled64kbPages && hwInfo->capabilityTable.ftr64KBpages && !!DebugManager.flags.Enable64kbpages.get());
gfxPartitions.push_back(std::make_unique<GfxPartition>(reservedCpuAddressRange)); gfxPartitions.push_back(std::make_unique<GfxPartition>(reservedCpuAddressRange));
@@ -937,4 +939,4 @@ bool MemoryTransferHelper::transferMemoryToAllocationBanks(const Device &device,
} }
return true; return true;
} }
} // namespace NEO } // namespace NEO

View File

@@ -108,10 +108,12 @@ GraphicsAllocation *OsAgnosticMemoryManager::allocateGraphicsMemoryWithAlignment
memoryAllocation->storageInfo = allocationData.storageInfo; memoryAllocation->storageInfo = allocationData.storageInfo;
} }
auto pHwInfo = executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getHardwareInfo(); auto &rootDeviceEnvironment = *executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex];
if (GfxCoreHelper::get(pHwInfo->platform.eRenderCoreFamily).compressedBuffersSupported(*pHwInfo) && auto pHwInfo = rootDeviceEnvironment.getHardwareInfo();
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
if (gfxCoreHelper.compressedBuffersSupported(*pHwInfo) &&
allocationData.flags.preferCompressed) { allocationData.flags.preferCompressed) {
auto gmm = std::make_unique<Gmm>(executionEnvironment.rootDeviceEnvironments[allocationData.rootDeviceIndex]->getGmmHelper(), auto gmm = std::make_unique<Gmm>(rootDeviceEnvironment.getGmmHelper(),
allocationData.hostPtr, allocationData.hostPtr,
sizeAligned, sizeAligned,
alignment, alignment,

View File

@@ -89,7 +89,7 @@ bool DeviceFactory::prepareDeviceEnvironmentsForProductFamilyOverride(ExecutionE
auto csrType = DebugManager.flags.SetCommandStreamReceiver.get(); auto csrType = DebugManager.flags.SetCommandStreamReceiver.get();
if (csrType > 0) { if (csrType > 0) {
auto &gfxCoreHelper = GfxCoreHelper::get(hardwareInfo->platform.eRenderCoreFamily); auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
auto localMemoryEnabled = gfxCoreHelper.getEnableLocalMemory(*hardwareInfo); auto localMemoryEnabled = gfxCoreHelper.getEnableLocalMemory(*hardwareInfo);
rootDeviceEnvironment.initGmm(); rootDeviceEnvironment.initGmm();
rootDeviceEnvironment.initAubCenter(localMemoryEnabled, "", static_cast<CommandStreamReceiverType>(csrType)); rootDeviceEnvironment.initAubCenter(localMemoryEnabled, "", static_cast<CommandStreamReceiverType>(csrType));

View File

@@ -55,7 +55,8 @@ DrmCommandStreamReceiver<GfxFamily>::DrmCommandStreamReceiver(ExecutionEnvironme
} }
auto hwInfo = rootDeviceEnvironment->getHardwareInfo(); auto hwInfo = rootDeviceEnvironment->getHardwareInfo();
auto localMemoryEnabled = GfxCoreHelper::get(hwInfo->platform.eRenderCoreFamily).getEnableLocalMemory(*hwInfo); auto &gfxCoreHelper = rootDeviceEnvironment->getHelper<GfxCoreHelper>();
auto localMemoryEnabled = gfxCoreHelper.getEnableLocalMemory(*hwInfo);
this->dispatchMode = localMemoryEnabled ? DispatchMode::BatchedDispatch : DispatchMode::ImmediateDispatch; this->dispatchMode = localMemoryEnabled ? DispatchMode::BatchedDispatch : DispatchMode::ImmediateDispatch;

View File

@@ -220,7 +220,7 @@ void DrmMemoryManager::releaseGpuRange(void *address, size_t unmapSize, uint32_t
bool DrmMemoryManager::isKmdMigrationAvailable(uint32_t rootDeviceIndex) { bool DrmMemoryManager::isKmdMigrationAvailable(uint32_t rootDeviceIndex) {
auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo(); auto hwInfo = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHardwareInfo();
auto &gfxCoreHelper = NEO::GfxCoreHelper::get(hwInfo->platform.eRenderCoreFamily); auto &gfxCoreHelper = executionEnvironment.rootDeviceEnvironments[rootDeviceIndex]->getHelper<GfxCoreHelper>();
auto useKmdMigration = gfxCoreHelper.isKmdMigrationSupported(*hwInfo); auto useKmdMigration = gfxCoreHelper.isKmdMigrationSupported(*hwInfo);