Reduce usage of global product helper getter [1/n]

Related-To: NEO-6853
Signed-off-by: Mateusz Jablonski <mateusz.jablonski@intel.com>
This commit is contained in:
Mateusz Jablonski
2022-12-15 13:33:28 +00:00
committed by Compute-Runtime-Automation
parent 5b1c9ac584
commit 6c7ca96f28
19 changed files with 32 additions and 29 deletions

View File

@@ -48,7 +48,7 @@ const SipKernel &BuiltIns::getSipKernel(SipKernelType type, Device &device) {
auto sipAllocation = device.getMemoryManager()->allocateGraphicsMemoryWithProperties(properties);
auto &hwInfo = device.getHardwareInfo();
auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
auto &productHelper = device.getProductHelper();
if (sipAllocation) {
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *sipAllocation),

View File

@@ -87,9 +87,9 @@ StackVec<std::string, 3> getBuiltinResourceNames(EBuiltInOps::Type builtin, Buil
const auto revisionId = std::to_string(hwInfo.platform.usRevId);
const auto builtinName = getBuiltinAsString(builtin);
const auto extension = BuiltinCode::getExtension(type);
auto getAddressingMode = [type, &hwInfo, builtin]() {
auto getAddressingMode = [type, &productHelper, builtin]() {
if (type == BuiltinCode::ECodeType::Binary) {
const bool requiresStatelessAddressing = (false == ProductHelper::get(hwInfo.platform.eProductFamily)->isStatefulAddressingModeSupported());
const bool requiresStatelessAddressing = (false == productHelper.isStatefulAddressingModeSupported());
const bool builtInUsesStatelessAddressing = EBuiltInOps::isStateless(builtin);
if (builtInUsesStatelessAddressing || requiresStatelessAddressing) {
return "stateless_";

View File

@@ -140,7 +140,7 @@ bool SipKernel::initRawBinaryFromFileKernel(SipKernelType type, Device &device,
}
auto &hwInfo = device.getHardwareInfo();
auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
auto &productHelper = device.getProductHelper();
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *sipAllocation),
device, sipAllocation, 0, alignedBuffer,
@@ -202,7 +202,7 @@ bool SipKernel::initHexadecimalArraySipKernel(SipKernelType type, Device &device
if (sipAllocation == nullptr) {
return false;
}
auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
auto &productHelper = device.getProductHelper();
MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *sipAllocation),
device, sipAllocation, 0, sipKernelBinary,
kernelBinarySize);

View File

@@ -154,7 +154,7 @@ void AUBCommandStreamReceiverHw<GfxFamily>::initFile(const std::string &fileName
}
// Add the file header
auto &hwInfo = this->peekHwInfo();
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
const auto &productHelper = this->getProductHelper();
stream->init(productHelper.getAubStreamSteppingFromHwRevId(hwInfo), aubDeviceId);
}
}

View File

@@ -303,7 +303,7 @@ CompletionStamp CommandStreamReceiverHw<GfxFamily>::flushTask(
levelClosed = true;
// if we guard with ppc, flush dc as well to speed up completion latency
if (dispatchFlags.guardCommandBufferWithPipeControl) {
const auto &productHelper = *NEO::ProductHelper::get(hwInfo.platform.eProductFamily);
const auto &productHelper = getProductHelper();
if (productHelper.isDcFlushAllowed()) {
dispatchFlags.dcFlush = true;
}
@@ -1433,7 +1433,7 @@ inline MemoryCompressionState CommandStreamReceiverHw<GfxFamily>::getMemoryCompr
template <typename GfxFamily>
inline bool CommandStreamReceiverHw<GfxFamily>::isPipelineSelectAlreadyProgrammed() const {
const auto &productHelper = *ProductHelper::get(peekHwInfo().platform.eProductFamily);
const auto &productHelper = getProductHelper();
return this->streamProperties.stateComputeMode.isDirty() && productHelper.is3DPipelineSelectWARequired() && isRcs();
}

View File

@@ -39,7 +39,7 @@ size_t CommandStreamReceiverHw<GfxFamily>::getRequiredStateBaseAddressSize(const
using PIPELINE_SELECT = typename GfxFamily::PIPELINE_SELECT;
size_t size = 0;
const auto &productHelper = *ProductHelper::get(peekHwInfo().platform.eProductFamily);
const auto &productHelper = getProductHelper();
if (productHelper.is3DPipelineSelectWARequired()) {
size += (2 * PreambleHelper<GfxFamily>::getCmdSizeForPipelineSelect(peekHwInfo()));
}

View File

@@ -36,8 +36,8 @@ template <>
size_t CommandStreamReceiverHw<Family>::getCmdSizeForPerDssBackedBuffer(const HardwareInfo &hwInfo) {
size_t size = sizeof(_3DSTATE_BTD);
auto productHelper = ProductHelper::get(hwInfo.platform.eProductFamily);
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs());
auto &productHelper = getProductHelper();
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs());
std::ignore = isBasicWARequired;
if (isExtendedWARequired) {
@@ -58,8 +58,8 @@ inline void CommandStreamReceiverHw<GfxFamily>::addPipeControlBefore3dState(Line
}
auto &hwInfo = peekHwInfo();
auto productHelper = ProductHelper::get(hwInfo.platform.eProductFamily);
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs());
auto &productHelper = getProductHelper();
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs());
std::ignore = isBasicWARequired;
PipeControlArgs args;

View File

@@ -33,7 +33,7 @@ size_t CommandStreamReceiverHw<GfxFamily>::getRequiredStateBaseAddressSize(const
size += MemorySynchronizationCommands<GfxFamily>::getSizeForSingleBarrier(false);
auto &hwInfo = *device.getRootDeviceEnvironment().getHardwareInfo();
auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
auto &productHelper = getProductHelper();
if (productHelper.isAdditionalStateBaseAddressWARequired(hwInfo)) {
size += sizeof(typename GfxFamily::STATE_BASE_ADDRESS);
}
@@ -140,11 +140,11 @@ template <typename GfxFamily>
inline void CommandStreamReceiverHw<GfxFamily>::addPipeControlBeforeStateSip(LinearStream &commandStream, Device &device) {
auto &hwInfo = peekHwInfo();
auto &gfxCoreHelper = getGfxCoreHelper();
auto productHelper = ProductHelper::get(hwInfo.platform.eProductFamily);
auto &productHelper = getProductHelper();
bool debuggingEnabled = device.getDebugger() != nullptr;
PipeControlArgs args;
args.dcFlushEnable = this->dcFlushSupport;
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs());
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs());
std::ignore = isExtendedWARequired;
if (isBasicWARequired && debuggingEnabled && !gfxCoreHelper.isSipWANeeded(hwInfo)) {

View File

@@ -81,8 +81,8 @@ size_t PreemptionHelper::getRequiredStateSipCmdSize<GfxFamily>(Device &device, b
size += MemorySynchronizationCommands<GfxFamily>::getSizeForSingleBarrier(false);
size += 2 * sizeof(typename GfxFamily::MI_LOAD_REGISTER_IMM);
} else {
auto productHelper = ProductHelper::get(hwInfo.platform.eProductFamily);
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper->isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs);
auto &productHelper = device.getProductHelper();
const auto &[isBasicWARequired, isExtendedWARequired] = productHelper.isPipeControlPriorToNonPipelinedStateCommandsWARequired(hwInfo, isRcs);
const auto isWARequired = isBasicWARequired || isExtendedWARequired;
if (isWARequired) {

View File

@@ -86,7 +86,8 @@ bool tryWritePartitionLayoutWithinProcess(Wddm &wddm, GMM_GFX_PARTITIONING &part
bool adjustGfxPartitionLayout(GMM_GFX_PARTITIONING &partitionLayout, uint64_t gpuAddressSpace, uintptr_t minAllowedAddress, Wddm &wddm, PRODUCT_FAMILY productFamily) {
bool requiresRepartitioning = (gpuAddressSpace == maxNBitValue(47)) && wddm.getFeatureTable().flags.ftrCCSRing;
requiresRepartitioning |= ProductHelper::get(productFamily)->overrideGfxPartitionLayoutForWsl();
auto &productHelper = wddm.getRootDeviceEnvironment().getHelper<ProductHelper>();
requiresRepartitioning |= productHelper.overrideGfxPartitionLayoutForWsl();
if (false == requiresRepartitioning) {
return true;
}

View File

@@ -548,7 +548,8 @@ bool Wddm::mapGpuVirtualAddress(Gmm *gmm, D3DKMT_HANDLE handle, D3DGPU_VIRTUAL_A
kmDafListener->notifyMapGpuVA(featureTable->flags.ftrKmdDaf, getAdapter(), device, handle, mapGPUVA.VirtualAddress, getGdi()->escape);
bool ret = true;
if (gmm->isCompressionEnabled && ProductHelper::get(gfxPlatform->eProductFamily)->isPageTableManagerSupported(*rootDeviceEnvironment.getHardwareInfo())) {
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
if (gmm->isCompressionEnabled && productHelper.isPageTableManagerSupported(*rootDeviceEnvironment.getHardwareInfo())) {
for (auto engine : rootDeviceEnvironment.executionEnvironment.memoryManager->getRegisteredEngines()) {
if (engine.commandStreamReceiver->pageTableManager.get()) {
ret &= engine.commandStreamReceiver->pageTableManager->updateAuxTable(gpuPtr, gmm, true);

View File

@@ -547,7 +547,8 @@ void WddmMemoryManager::freeGraphicsMemoryImpl(GraphicsAllocation *gfxAllocation
auto defaultGmm = gfxAllocation->getDefaultGmm();
auto hwInfo = executionEnvironment.rootDeviceEnvironments[gfxAllocation->getRootDeviceIndex()]->getHardwareInfo();
if (gfxAllocation->isCompressionEnabled() && ProductHelper::get(hwInfo->platform.eProductFamily)->isPageTableManagerSupported(*hwInfo)) {
auto &productHelper = executionEnvironment.rootDeviceEnvironments[gfxAllocation->getRootDeviceIndex()]->getHelper<ProductHelper>();
if (gfxAllocation->isCompressionEnabled() && productHelper.isPageTableManagerSupported(*hwInfo)) {
for (auto engine : registeredEngines) {
if (engine.commandStreamReceiver->pageTableManager.get()) {
[[maybe_unused]] auto status = engine.commandStreamReceiver->pageTableManager->updateAuxTable(input->getGpuAddress(), defaultGmm, false);

View File

@@ -136,7 +136,7 @@ bool KernelInfo::createKernelAllocation(const Device &device, bool internalIsa)
kernelAllocation = kernelAllocations->second.kernelAllocation;
kernelAllocations->second.reuseCounter++;
auto &hwInfo = device.getHardwareInfo();
auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
auto &productHelper = device.getProductHelper();
return MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *kernelAllocation),
device, kernelAllocation, 0, heapInfo.pKernelHeap,
@@ -154,7 +154,7 @@ bool KernelInfo::createKernelAllocation(const Device &device, bool internalIsa)
}
auto &hwInfo = device.getHardwareInfo();
auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
auto &productHelper = device.getProductHelper();
return MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *kernelAllocation),
device, kernelAllocation, 0, heapInfo.pKernelHeap,

View File

@@ -59,7 +59,7 @@ GraphicsAllocation *allocateGlobalsSurface(NEO::SVMAllocsManager *const svmAlloc
}
auto &hwInfo = device.getHardwareInfo();
auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
auto &productHelper = device.getProductHelper();
auto success = MemoryTransferHelper::transferMemoryToAllocation(productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *gpuAllocation),
device, gpuAllocation, 0, initData, size);

View File

@@ -62,7 +62,7 @@ void EncodeDispatchKernel<Family>::programBarrierEnable(INTERFACE_DESCRIPTOR_DAT
template <>
void EncodeDispatchKernel<Family>::adjustInterfaceDescriptorData(INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, const Device &device, const HardwareInfo &hwInfo, const uint32_t threadGroupCount, const uint32_t numGrf) {
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
const auto &productHelper = device.getProductHelper();
if (productHelper.isDisableOverdispatchAvailable(hwInfo)) {
interfaceDescriptor.setThreadGroupDispatchSize(INTERFACE_DESCRIPTOR_DATA::THREAD_GROUP_DISPATCH_SIZE_TG_SIZE_1);
}

View File

@@ -34,7 +34,7 @@ void populateFactoryTable<CommandStreamReceiverHw<Family>>() {
template <>
MemoryCompressionState CommandStreamReceiverHw<Family>::getMemoryCompressionState(bool auxTranslationRequired, const HardwareInfo &hwInfo) const {
auto memoryCompressionState = MemoryCompressionState::NotApplicable;
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
const auto &productHelper = getProductHelper();
if (productHelper.allowStatelessCompression(hwInfo)) {
memoryCompressionState = auxTranslationRequired ? MemoryCompressionState::Disabled : MemoryCompressionState::Enabled;
}

View File

@@ -32,7 +32,7 @@ void EncodeDispatchKernel<Family>::adjustTimestampPacket(WALKER_TYPE &walkerCmd,
template <>
void EncodeDispatchKernel<Family>::adjustInterfaceDescriptorData(INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, const Device &device, const HardwareInfo &hwInfo, const uint32_t threadGroupCount, const uint32_t numGrf) {
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
const auto &productHelper = device.getProductHelper();
if (productHelper.isDisableOverdispatchAvailable(hwInfo)) {
interfaceDescriptor.setThreadGroupDispatchSize(INTERFACE_DESCRIPTOR_DATA::THREAD_GROUP_DISPATCH_SIZE_TG_SIZE_1);

View File

@@ -87,7 +87,7 @@ void EncodeDispatchKernel<Family>::appendAdditionalIDDFields(INTERFACE_DESCRIPTO
template <>
void EncodeDispatchKernel<Family>::adjustInterfaceDescriptorData(INTERFACE_DESCRIPTOR_DATA &interfaceDescriptor, const Device &device, const HardwareInfo &hwInfo, const uint32_t threadGroupCount, const uint32_t numGrf) {
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
const auto &productHelper = device.getProductHelper();
if (productHelper.isDisableOverdispatchAvailable(hwInfo)) {
if (interfaceDescriptor.getNumberOfThreadsInGpgpuThreadGroup() == 1) {
interfaceDescriptor.setThreadGroupDispatchSize(static_cast<INTERFACE_DESCRIPTOR_DATA::THREAD_GROUP_DISPATCH_SIZE>(2u));

View File

@@ -35,7 +35,7 @@ void populateFactoryTable<CommandStreamReceiverHw<Family>>() {
template <>
MemoryCompressionState CommandStreamReceiverHw<Family>::getMemoryCompressionState(bool auxTranslationRequired, const HardwareInfo &hwInfo) const {
auto memoryCompressionState = MemoryCompressionState::NotApplicable;
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
const auto &productHelper = getProductHelper();
if (productHelper.allowStatelessCompression(hwInfo)) {
memoryCompressionState = auxTranslationRequired ? MemoryCompressionState::Disabled : MemoryCompressionState::Enabled;
}