mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-05 09:09:04 +08:00
Refactor: reduce global productHelper getter usage
Related-To: NEO-6853 Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
fca4fbb0c0
commit
0dbf92d401
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -282,9 +282,8 @@ cl_int ClDevice::getDeviceInfo(cl_device_info paramName,
|
||||
break;
|
||||
}
|
||||
case CL_DEVICE_FEATURE_CAPABILITIES_INTEL: {
|
||||
auto &hwInfo = getHardwareInfo();
|
||||
auto &clGfxCoreHelper = this->getRootDeviceEnvironment().getHelper<ClGfxCoreHelper>();
|
||||
param.bitfield = clGfxCoreHelper.getSupportedDeviceFeatureCapabilities(hwInfo);
|
||||
param.bitfield = clGfxCoreHelper.getSupportedDeviceFeatureCapabilities(this->getRootDeviceEnvironment());
|
||||
src = ¶m.bitfield;
|
||||
retSize = srcSize = sizeof(cl_device_feature_capabilities_intel);
|
||||
break;
|
||||
|
||||
@@ -786,7 +786,7 @@ CompletionStamp CommandQueueHw<GfxFamily>::enqueueNonBlocked(
|
||||
}
|
||||
}
|
||||
|
||||
auto memoryCompressionState = getGpgpuCommandStreamReceiver().getMemoryCompressionState(auxTranslationRequired, device->getHardwareInfo());
|
||||
auto memoryCompressionState = getGpgpuCommandStreamReceiver().getMemoryCompressionState(auxTranslationRequired);
|
||||
|
||||
DispatchFlags dispatchFlags(
|
||||
{}, // csrDependencies
|
||||
|
||||
@@ -24,7 +24,7 @@ void populateFactoryTable<ClGfxCoreHelperHw<Family>>() {
|
||||
}
|
||||
|
||||
template <>
|
||||
cl_device_feature_capabilities_intel ClGfxCoreHelperHw<Family>::getSupportedDeviceFeatureCapabilities(const HardwareInfo &hwInfo) const {
|
||||
cl_device_feature_capabilities_intel ClGfxCoreHelperHw<Family>::getSupportedDeviceFeatureCapabilities(const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
return CL_DEVICE_FEATURE_FLAG_DP4A_INTEL;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -30,8 +30,8 @@ class ClGfxCoreHelper {
|
||||
public:
|
||||
static ClGfxCoreHelper &get(GFXCORE_FAMILY gfxCore);
|
||||
|
||||
virtual bool requiresNonAuxMode(const ArgDescPointer &argAsPtr, const RootDeviceEnvironment &rootDeviceEnvironment) const = 0;
|
||||
virtual bool requiresAuxResolves(const KernelInfo &kernelInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const = 0;
|
||||
virtual bool requiresNonAuxMode(const ArgDescPointer &argAsPtr) const = 0;
|
||||
virtual bool requiresAuxResolves(const KernelInfo &kernelInfo) const = 0;
|
||||
virtual bool allowCompressionForContext(const ClDevice &clDevice, const Context &context) const = 0;
|
||||
virtual cl_command_queue_capabilities_intel getAdditionalDisabledQueueFamilyCapabilities(EngineGroupType type) const = 0;
|
||||
virtual bool getQueueFamilyName(std::string &name, EngineGroupType type) const = 0;
|
||||
@@ -40,7 +40,7 @@ class ClGfxCoreHelper {
|
||||
virtual bool isSupportedKernelThreadArbitrationPolicy() const = 0;
|
||||
virtual std::vector<uint32_t> getSupportedThreadArbitrationPolicies() const = 0;
|
||||
virtual cl_version getDeviceIpVersion(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual cl_device_feature_capabilities_intel getSupportedDeviceFeatureCapabilities(const HardwareInfo &hwInfo) const = 0;
|
||||
virtual cl_device_feature_capabilities_intel getSupportedDeviceFeatureCapabilities(const RootDeviceEnvironment &rootDeviceEnvironment) const = 0;
|
||||
virtual bool allowImageCompression(cl_image_format format) const = 0;
|
||||
virtual bool isFormatRedescribable(cl_image_format format) const = 0;
|
||||
|
||||
@@ -61,8 +61,8 @@ class ClGfxCoreHelperHw : public ClGfxCoreHelper {
|
||||
return clGfxCoreHelper;
|
||||
}
|
||||
|
||||
bool requiresNonAuxMode(const ArgDescPointer &argAsPtr, const RootDeviceEnvironment &rootDeviceEnvironment) const override;
|
||||
bool requiresAuxResolves(const KernelInfo &kernelInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const override;
|
||||
bool requiresNonAuxMode(const ArgDescPointer &argAsPtr) const override;
|
||||
bool requiresAuxResolves(const KernelInfo &kernelInfo) const override;
|
||||
bool allowCompressionForContext(const ClDevice &clDevice, const Context &context) const override;
|
||||
cl_command_queue_capabilities_intel getAdditionalDisabledQueueFamilyCapabilities(EngineGroupType type) const override;
|
||||
bool getQueueFamilyName(std::string &name, EngineGroupType type) const override;
|
||||
@@ -71,7 +71,7 @@ class ClGfxCoreHelperHw : public ClGfxCoreHelper {
|
||||
bool isSupportedKernelThreadArbitrationPolicy() const override;
|
||||
std::vector<uint32_t> getSupportedThreadArbitrationPolicies() const override;
|
||||
cl_version getDeviceIpVersion(const HardwareInfo &hwInfo) const override;
|
||||
cl_device_feature_capabilities_intel getSupportedDeviceFeatureCapabilities(const HardwareInfo &hwInfo) const override;
|
||||
cl_device_feature_capabilities_intel getSupportedDeviceFeatureCapabilities(const RootDeviceEnvironment &rootDeviceEnvironment) const override;
|
||||
bool allowImageCompression(cl_image_format format) const override;
|
||||
bool isFormatRedescribable(cl_image_format format) const override;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -14,12 +14,12 @@
|
||||
namespace NEO {
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline bool ClGfxCoreHelperHw<GfxFamily>::requiresNonAuxMode(const ArgDescPointer &argAsPtr, const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
inline bool ClGfxCoreHelperHw<GfxFamily>::requiresNonAuxMode(const ArgDescPointer &argAsPtr) const {
|
||||
return !argAsPtr.isPureStateful();
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
inline bool ClGfxCoreHelperHw<GfxFamily>::requiresAuxResolves(const KernelInfo &kernelInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
inline bool ClGfxCoreHelperHw<GfxFamily>::requiresAuxResolves(const KernelInfo &kernelInfo) const {
|
||||
return hasStatelessAccessToBuffer(kernelInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -24,7 +24,7 @@ cl_ulong ClGfxCoreHelperHw<GfxFamily>::getKernelPrivateMemSize(const KernelInfo
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
cl_device_feature_capabilities_intel ClGfxCoreHelperHw<GfxFamily>::getSupportedDeviceFeatureCapabilities(const HardwareInfo &hwInfo) const {
|
||||
cl_device_feature_capabilities_intel ClGfxCoreHelperHw<GfxFamily>::getSupportedDeviceFeatureCapabilities(const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
|
||||
#include "opencl/source/helpers/cl_hw_helper.h"
|
||||
@@ -23,8 +24,9 @@ cl_ulong ClGfxCoreHelperHw<GfxFamily>::getKernelPrivateMemSize(const KernelInfo
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
cl_device_feature_capabilities_intel ClGfxCoreHelperHw<GfxFamily>::getSupportedDeviceFeatureCapabilities(const HardwareInfo &hwInfo) const {
|
||||
auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
cl_device_feature_capabilities_intel ClGfxCoreHelperHw<GfxFamily>::getSupportedDeviceFeatureCapabilities(const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
if (productHelper.isMatrixMultiplyAccumulateSupported(hwInfo)) {
|
||||
return CL_DEVICE_FEATURE_FLAG_DPAS_INTEL | CL_DEVICE_FEATURE_FLAG_DP4A_INTEL;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
* Copyright (C) 2018-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -178,7 +178,7 @@ CompletionStamp &CommandComputeKernel::submit(TaskCountType taskLevel, bool term
|
||||
|
||||
const auto &kernelDescriptor = kernel->getKernelInfo().kernelDescriptor;
|
||||
|
||||
auto memoryCompressionState = commandStreamReceiver.getMemoryCompressionState(kernel->isAuxTranslationRequired(), commandQueue.getDevice().getHardwareInfo());
|
||||
auto memoryCompressionState = commandStreamReceiver.getMemoryCompressionState(kernel->isAuxTranslationRequired());
|
||||
|
||||
DispatchFlags dispatchFlags(
|
||||
{}, // csrDependencies
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "shared/source/kernel/kernel_arg_descriptor_extended_vme.h"
|
||||
#include "shared/source/kernel/local_ids_cache.h"
|
||||
#include "shared/source/memory_manager/allocation_properties.h"
|
||||
#include "shared/source/memory_manager/compression_selector.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
#include "shared/source/memory_manager/unified_memory_manager.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
@@ -255,7 +256,7 @@ cl_int Kernel::initialize() {
|
||||
|
||||
auto &clGfxCoreHelper = rootDeviceEnvironment.getHelper<ClGfxCoreHelper>();
|
||||
|
||||
auxTranslationRequired = !program->getIsBuiltIn() && GfxCoreHelper::compressedBuffersSupported(hwInfo) && clGfxCoreHelper.requiresAuxResolves(kernelInfo, rootDeviceEnvironment);
|
||||
auxTranslationRequired = !program->getIsBuiltIn() && GfxCoreHelper::compressedBuffersSupported(hwInfo) && clGfxCoreHelper.requiresAuxResolves(kernelInfo);
|
||||
|
||||
if (DebugManager.flags.ForceAuxTranslationEnabled.get() != -1) {
|
||||
auxTranslationRequired &= !!DebugManager.flags.ForceAuxTranslationEnabled.get();
|
||||
@@ -935,7 +936,7 @@ cl_int Kernel::setArgSvmAlloc(uint32_t argIndex, void *svmPtr, GraphicsAllocatio
|
||||
forceNonAuxMode = true;
|
||||
}
|
||||
disableL3 = (argIndex == 0);
|
||||
} else if (svmAlloc && svmAlloc->isCompressionEnabled() && clGfxCoreHelper.requiresNonAuxMode(argAsPtr, rootDeviceEnvironment)) {
|
||||
} else if (svmAlloc && svmAlloc->isCompressionEnabled() && clGfxCoreHelper.requiresNonAuxMode(argAsPtr)) {
|
||||
forceNonAuxMode = true;
|
||||
}
|
||||
|
||||
@@ -1492,7 +1493,7 @@ cl_int Kernel::setArgBuffer(uint32_t argIndex,
|
||||
forceNonAuxMode = true;
|
||||
}
|
||||
disableL3 = (argIndex == 0);
|
||||
} else if (graphicsAllocation->isCompressionEnabled() && clGfxCoreHelper.requiresNonAuxMode(argAsPtr, rootDeviceEnvironment)) {
|
||||
} else if (graphicsAllocation->isCompressionEnabled() && clGfxCoreHelper.requiresNonAuxMode(argAsPtr)) {
|
||||
forceNonAuxMode = true;
|
||||
}
|
||||
|
||||
@@ -1949,8 +1950,8 @@ std::unique_ptr<KernelObjsForAuxTranslation> Kernel::fillWithKernelObjsForAuxTra
|
||||
}
|
||||
}
|
||||
}
|
||||
const auto &productHelper = getDevice().getProductHelper();
|
||||
if (productHelper.allowStatelessCompression(getDevice().getHardwareInfo())) {
|
||||
|
||||
if (CompressionSelector::allowStatelessCompression()) {
|
||||
for (auto gfxAllocation : kernelUnifiedMemoryGfxAllocations) {
|
||||
if (gfxAllocation->isCompressionEnabled()) {
|
||||
kernelObjsForAuxTranslation->insert({KernelObjForAuxTranslation::Type::GFX_ALLOC, gfxAllocation});
|
||||
@@ -2273,8 +2274,7 @@ bool Kernel::requiresCacheFlushCommand(const CommandQueue &commandQueue) const {
|
||||
}
|
||||
|
||||
void Kernel::updateAuxTranslationRequired() {
|
||||
const auto &productHelper = getDevice().getProductHelper();
|
||||
if (productHelper.allowStatelessCompression(getDevice().getHardwareInfo())) {
|
||||
if (CompressionSelector::allowStatelessCompression()) {
|
||||
if (hasDirectStatelessAccessToHostMemory() ||
|
||||
hasIndirectStatelessAccessToHostMemory() ||
|
||||
hasDirectStatelessAccessToSharedBuffer()) {
|
||||
|
||||
@@ -313,7 +313,7 @@ Buffer *Buffer::create(Context *context,
|
||||
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
|
||||
|
||||
bool compressionEnabled = MemObjHelper::isSuitableForCompression(GfxCoreHelper::compressedBuffersSupported(*hwInfo), memoryProperties, *context,
|
||||
gfxCoreHelper.isBufferSizeSuitableForCompression(size, *hwInfo));
|
||||
gfxCoreHelper.isBufferSizeSuitableForCompression(size));
|
||||
|
||||
allocationInfo.allocationType = getGraphicsAllocationTypeAndCompressionPreference(memoryProperties, *context, compressionEnabled,
|
||||
memoryManager->isLocalMemorySupported(rootDeviceIndex));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
* Copyright (C) 2020-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -11,14 +11,13 @@
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
|
||||
namespace NEO {
|
||||
bool CompressionSelector::preferCompressedAllocation(const AllocationProperties &properties, const HardwareInfo &hwInfo) {
|
||||
bool CompressionSelector::preferCompressedAllocation(const AllocationProperties &properties) {
|
||||
switch (properties.allocationType) {
|
||||
case AllocationType::GLOBAL_SURFACE:
|
||||
case AllocationType::CONSTANT_SURFACE:
|
||||
case AllocationType::SVM_GPU:
|
||||
case AllocationType::PRINTF_SURFACE: {
|
||||
const auto &productHelper = *ProductHelper::get(hwInfo.platform.eProductFamily);
|
||||
return productHelper.allowStatelessCompression(hwInfo);
|
||||
return CompressionSelector::allowStatelessCompression();
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "shared/source/helpers/ptr_math.h"
|
||||
#include "shared/source/kernel/implicit_args.h"
|
||||
#include "shared/source/memory_manager/allocation_properties.h"
|
||||
#include "shared/source/memory_manager/compression_selector.h"
|
||||
#include "shared/source/memory_manager/memory_manager.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/source/program/print_formatter.h"
|
||||
@@ -88,7 +89,7 @@ bool PrintfHandler::printEnqueueOutput() {
|
||||
auto printfOutputSize = static_cast<uint32_t>(printfSurface->getUnderlyingBufferSize());
|
||||
std::unique_ptr<uint8_t[]> printfOutputDecompressed;
|
||||
|
||||
if (productHelper.allowStatelessCompression(hwInfo) || productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *printfSurface)) {
|
||||
if (CompressionSelector::allowStatelessCompression() || productHelper.isBlitCopyRequiredForLocalMemory(hwInfo, *printfSurface)) {
|
||||
printfOutputDecompressed = std::make_unique<uint8_t[]>(printfOutputSize);
|
||||
printfOutputBuffer = printfOutputDecompressed.get();
|
||||
auto &bcsEngine = device.getEngine(EngineHelpers::getBcsEngineType(device.getRootDeviceEnvironment(), device.getDeviceBitfield(), device.getSelectorCopyEngine(), true), EngineUsage::Regular);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
* Copyright (C) 2021-2023 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
@@ -25,7 +25,7 @@ void populateFactoryTable<ClGfxCoreHelperHw<Family>>() {
|
||||
}
|
||||
|
||||
template <>
|
||||
bool ClGfxCoreHelperHw<Family>::requiresAuxResolves(const KernelInfo &kernelInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
bool ClGfxCoreHelperHw<Family>::requiresAuxResolves(const KernelInfo &kernelInfo) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "shared/source/debug_settings/debug_settings_manager.h"
|
||||
#include "shared/source/execution_environment/root_device_environment.h"
|
||||
#include "shared/source/helpers/populate_factory.h"
|
||||
#include "shared/source/memory_manager/compression_selector.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/source/xe_hpg_core/hw_cmds_xe_hpg_core_base.h"
|
||||
|
||||
@@ -28,11 +29,9 @@ void populateFactoryTable<ClGfxCoreHelperHw<Family>>() {
|
||||
}
|
||||
|
||||
template <>
|
||||
bool ClGfxCoreHelperHw<Family>::requiresNonAuxMode(const ArgDescPointer &argAsPtr, const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
bool ClGfxCoreHelperHw<Family>::requiresNonAuxMode(const ArgDescPointer &argAsPtr) const {
|
||||
|
||||
if (productHelper.allowStatelessCompression(hwInfo)) {
|
||||
if (CompressionSelector::allowStatelessCompression()) {
|
||||
return false;
|
||||
} else {
|
||||
return !argAsPtr.isPureStateful();
|
||||
@@ -40,11 +39,9 @@ bool ClGfxCoreHelperHw<Family>::requiresNonAuxMode(const ArgDescPointer &argAsPt
|
||||
}
|
||||
|
||||
template <>
|
||||
bool ClGfxCoreHelperHw<Family>::requiresAuxResolves(const KernelInfo &kernelInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const {
|
||||
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
|
||||
auto &hwInfo = *rootDeviceEnvironment.getHardwareInfo();
|
||||
bool ClGfxCoreHelperHw<Family>::requiresAuxResolves(const KernelInfo &kernelInfo) const {
|
||||
|
||||
if (productHelper.allowStatelessCompression(hwInfo)) {
|
||||
if (CompressionSelector::allowStatelessCompression()) {
|
||||
return false;
|
||||
} else {
|
||||
return hasStatelessAccessToBuffer(kernelInfo);
|
||||
|
||||
Reference in New Issue
Block a user