mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
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:
committed by
Compute-Runtime-Automation
parent
5b1c9ac584
commit
6c7ca96f28
@@ -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),
|
||||
|
||||
@@ -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_";
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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()));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user