Revert "refactor: extract common logic from wddm and drm product helpers"

This reverts commit 585caab757.

Signed-off-by: Compute-Runtime-Validation <compute-runtime-validation@intel.com>
This commit is contained in:
Compute-Runtime-Validation 2024-07-17 04:25:37 +02:00 committed by Compute-Runtime-Automation
parent 1a6a4c39e4
commit e3053121cb
12 changed files with 69 additions and 64 deletions

View File

@ -20,7 +20,7 @@ constexpr static auto gfxProduct = IGFX_DG1;
namespace NEO {
template <>
void ProductHelperHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) const {
void ProductHelperHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) {
coherencyFlag = false;
}

View File

@ -20,7 +20,7 @@ constexpr static auto gfxProduct = IGFX_TIGERLAKE_LP;
namespace NEO {
template <>
void ProductHelperHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) const {
void ProductHelperHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) {
coherencyFlag = true;
if (GfxCoreHelper::isWorkaroundRequired(REVISION_A0, REVISION_B, hwInfo, *this)) {

View File

@ -5,9 +5,12 @@
*
*/
#include "shared/source/command_stream/preemption.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/os_interface/linux/drm_neo.h"
#include "shared/source/os_interface/os_interface.h"
@ -132,26 +135,42 @@ int ProductHelper::configureHwInfoDrm(const HardwareInfo *inHwInfo, HardwareInfo
int maxGpuFreq = 0;
drm->getMaxGpuFrequency(*outHwInfo, maxGpuFreq);
ret = setupProductSpecificConfig(*outHwInfo, rootDeviceEnvironment);
ret = configureHardwareCustom(outHwInfo, osInterface);
if (ret != 0) {
*outHwInfo = {};
return ret;
}
configureCacheInfo(outHwInfo);
featureTable->flags.ftrEDram = (gtSystemInfo->EdramSizeInKb != 0) ? 1 : 0;
outHwInfo->capabilityTable.maxRenderFrequency = maxGpuFreq;
outHwInfo->capabilityTable.ftrSvm = featureTable->flags.ftrSVM;
setupCoherencySupport(*outHwInfo, rootDeviceEnvironment);
setupDefaultEngineType(*outHwInfo, rootDeviceEnvironment);
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
outHwInfo->capabilityTable.ftrSupportsCoherency = false;
gfxCoreHelper.adjustDefaultEngineType(outHwInfo, *this, rootDeviceEnvironment.ailConfiguration.get());
outHwInfo->capabilityTable.defaultEngineType = getChosenEngineType(*outHwInfo);
drm->checkQueueSliceSupport();
drm->checkNonPersistentContextsSupport();
drm->checkPreemptionSupport();
setupPreemptionMode(*outHwInfo, rootDeviceEnvironment, drm->isPreemptionSupported());
bool preemption = drm->isPreemptionSupported();
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
PreemptionHelper::adjustDefaultPreemptionMode(outHwInfo->capabilityTable,
compilerProductHelper.isMidThreadPreemptionSupported(*outHwInfo) && preemption,
static_cast<bool>(outHwInfo->featureTable.flags.ftrGpGpuThreadGroupLevelPreempt) && preemption,
static_cast<bool>(outHwInfo->featureTable.flags.ftrGpGpuMidBatchPreempt) && preemption);
setupPreemptionSurfaceSize(*outHwInfo, rootDeviceEnvironment);
setupKmdNotifyProperties(outHwInfo->capabilityTable.kmdNotifyProperties);
setupImageSupport(*outHwInfo);
return ret;
if (debugManager.flags.ForceImagesSupport.get() != -1) {
outHwInfo->capabilityTable.supportsImages = debugManager.flags.ForceImagesSupport.get();
}
return 0;
}
} // namespace NEO

View File

@ -8,10 +8,8 @@
#include "shared/source/os_interface/product_helper.h"
#include "shared/source/built_ins/sip_kernel_type.h"
#include "shared/source/command_stream/preemption.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/hw_info.h"
@ -45,37 +43,4 @@ void ProductHelper::setupKmdNotifyProperties(KmdNotifyProperties &kmdNotifyPrope
KmdNotifyHelper::overrideFromDebugVariable(debugManager.flags.OverrideEnableQuickKmdSleepForDirectSubmission.get(), kmdNotifyProperties.enableQuickKmdSleepForDirectSubmission);
KmdNotifyHelper::overrideFromDebugVariable(debugManager.flags.OverrideDelayQuickKmdSleepForDirectSubmissionMicroseconds.get(), kmdNotifyProperties.delayQuickKmdSleepForDirectSubmissionMicroseconds);
}
int ProductHelper::setupProductSpecificConfig(HardwareInfo &hwInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const {
auto osInterface = rootDeviceEnvironment.osInterface.get();
int ret = configureHardwareCustom(&hwInfo, osInterface);
if (ret != 0) {
hwInfo = {};
}
return ret;
}
void ProductHelper::setupPreemptionMode(HardwareInfo &hwInfo, const RootDeviceEnvironment &rootDeviceEnvironment, bool kmdPreemptionSupport) {
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
PreemptionHelper::adjustDefaultPreemptionMode(hwInfo.capabilityTable,
compilerProductHelper.isMidThreadPreemptionSupported(hwInfo) && kmdPreemptionSupport,
static_cast<bool>(hwInfo.featureTable.flags.ftrGpGpuThreadGroupLevelPreempt) && kmdPreemptionSupport,
static_cast<bool>(hwInfo.featureTable.flags.ftrGpGpuMidBatchPreempt) && kmdPreemptionSupport);
}
void ProductHelper::setupImageSupport(HardwareInfo &hwInfo) {
if (debugManager.flags.ForceImagesSupport.get() != -1) {
hwInfo.capabilityTable.supportsImages = debugManager.flags.ForceImagesSupport.get();
}
}
void ProductHelper::setupDefaultEngineType(HardwareInfo &hwInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const {
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
gfxCoreHelper.adjustDefaultEngineType(&hwInfo, *this, rootDeviceEnvironment.ailConfiguration.get());
hwInfo.capabilityTable.defaultEngineType = getChosenEngineType(hwInfo);
}
void ProductHelper::setupCoherencySupport(HardwareInfo &hwInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const {
this->setCapabilityCoherencyFlag(hwInfo, hwInfo.capabilityTable.ftrSupportsCoherency);
hwInfo.capabilityTable.ftrSupportsCoherency &= hwInfo.featureTable.flags.ftrL3IACoherency;
}
} // namespace NEO

View File

@ -115,7 +115,7 @@ class ProductHelper {
virtual TimeoutParams getDirectSubmissionControllerTimeoutParams(bool acLineConnected, QueueThrottle queueThrottle) const = 0;
virtual std::pair<bool, bool> isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo, bool isRcs, const ReleaseHelper *releaseHelper) const = 0;
virtual bool heapInLocalMem(const HardwareInfo &hwInfo) const = 0;
virtual void setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) const = 0;
virtual void setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) = 0;
virtual bool isAdditionalMediaSamplerProgrammingRequired() const = 0;
virtual bool isInitialFlagsProgrammingRequired() const = 0;
virtual bool isReturnedCmdSizeForMediaSamplerAdjustmentRequired() const = 0;
@ -247,12 +247,7 @@ class ProductHelper {
virtual LocalMemoryAccessMode getDefaultLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0;
virtual void fillScmPropertiesSupportStructureBase(StateComputeModePropertiesSupport &propertiesSupport) const = 0;
void setupDefaultEngineType(HardwareInfo &hwInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const;
void setupCoherencySupport(HardwareInfo &hwInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const;
int setupProductSpecificConfig(HardwareInfo &hwInfo, const RootDeviceEnvironment &rootDeviceEnvironment) const;
static void setupPreemptionSurfaceSize(HardwareInfo &hwInfo, const RootDeviceEnvironment &rootDeviceEnvironment);
static void setupKmdNotifyProperties(KmdNotifyProperties &kmdNotifyProperties);
static void setupPreemptionMode(HardwareInfo &hwInfo, const RootDeviceEnvironment &rootDeviceEnvironment, bool kmdPreemptionSupport);
static void setupImageSupport(HardwareInfo &hwInfo);
};
} // namespace NEO

View File

@ -61,7 +61,7 @@ bool ProductHelperHw<gfxProduct>::useGemCreateExtInAllocateMemoryByKMD() const {
}
template <PRODUCT_FAMILY gfxProduct>
void ProductHelperHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) const {
void ProductHelperHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) {
coherencyFlag = true;
}

View File

@ -59,7 +59,7 @@ class ProductHelperHw : public ProductHelper {
TimeoutParams getDirectSubmissionControllerTimeoutParams(bool acLineConnected, QueueThrottle queueThrottle) const override;
std::pair<bool, bool> isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo, bool isRcs, const ReleaseHelper *releaseHelper) const override;
bool heapInLocalMem(const HardwareInfo &hwInfo) const override;
void setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) const override;
void setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) override;
bool isAdditionalMediaSamplerProgrammingRequired() const override;
bool isInitialFlagsProgrammingRequired() const override;
bool isReturnedCmdSizeForMediaSamplerAdjustmentRequired() const override;

View File

@ -97,7 +97,7 @@ uint32_t ProductHelperHw<gfxProduct>::getInternalHeapsPreallocated() const {
}
template <PRODUCT_FAMILY gfxProduct>
void ProductHelperHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) const {
void ProductHelperHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) {
coherencyFlag = false;
}

View File

@ -65,7 +65,7 @@ bool ProductHelperHw<gfxProduct>::deferMOCSToPatIndex() const {
}
template <PRODUCT_FAMILY gfxProduct>
void ProductHelperHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) const {
void ProductHelperHw<gfxProduct>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) {
coherencyFlag = false;
}

View File

@ -5,8 +5,12 @@
*
*/
#include "shared/source/command_stream/preemption.h"
#include "shared/source/debug_settings/debug_settings_manager.h"
#include "shared/source/execution_environment/root_device_environment.h"
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/helpers/constants.h"
#include "shared/source/helpers/gfx_core_helper.h"
#include "shared/source/helpers/hw_info.h"
#include "shared/source/os_interface/product_helper.h"
@ -15,14 +19,35 @@
namespace NEO {
int ProductHelper::configureHwInfoWddm(const HardwareInfo *inHwInfo, HardwareInfo *outHwInfo, const RootDeviceEnvironment &rootDeviceEnvironment) {
auto &gfxCoreHelper = rootDeviceEnvironment.getHelper<GfxCoreHelper>();
auto &compilerProductHelper = rootDeviceEnvironment.getHelper<CompilerProductHelper>();
outHwInfo->capabilityTable.ftrSvm = outHwInfo->featureTable.flags.ftrSVM;
setupDefaultEngineType(*outHwInfo, rootDeviceEnvironment);
setupCoherencySupport(*outHwInfo, rootDeviceEnvironment);
setupPreemptionMode(*outHwInfo, rootDeviceEnvironment, true);
gfxCoreHelper.adjustDefaultEngineType(outHwInfo, *this, rootDeviceEnvironment.ailConfiguration.get());
outHwInfo->capabilityTable.defaultEngineType = getChosenEngineType(*outHwInfo);
this->setCapabilityCoherencyFlag(*outHwInfo, outHwInfo->capabilityTable.ftrSupportsCoherency);
outHwInfo->capabilityTable.ftrSupportsCoherency &= inHwInfo->featureTable.flags.ftrL3IACoherency;
PreemptionHelper::adjustDefaultPreemptionMode(outHwInfo->capabilityTable,
compilerProductHelper.isMidThreadPreemptionSupported(*outHwInfo),
static_cast<bool>(outHwInfo->featureTable.flags.ftrGpGpuThreadGroupLevelPreempt),
static_cast<bool>(outHwInfo->featureTable.flags.ftrGpGpuMidBatchPreempt));
setupPreemptionSurfaceSize(*outHwInfo, rootDeviceEnvironment);
setupKmdNotifyProperties(outHwInfo->capabilityTable.kmdNotifyProperties);
auto ret = setupProductSpecificConfig(*outHwInfo, rootDeviceEnvironment);
setupImageSupport(*outHwInfo);
auto osInterface = rootDeviceEnvironment.osInterface.get();
// Product specific config
int ret = configureHardwareCustom(outHwInfo, osInterface);
if (ret != 0) {
*outHwInfo = {};
}
if (debugManager.flags.ForceImagesSupport.get() != -1) {
outHwInfo->capabilityTable.supportsImages = debugManager.flags.ForceImagesSupport.get();
}
return ret;
}

View File

@ -213,7 +213,7 @@ bool ProductHelperHw<IGFX_UNKNOWN>::heapInLocalMem(const HardwareInfo &hwInfo) c
}
template <>
void ProductHelperHw<IGFX_UNKNOWN>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) const {
void ProductHelperHw<IGFX_UNKNOWN>::setCapabilityCoherencyFlag(const HardwareInfo &hwInfo, bool &coherencyFlag) {
}
template <>

View File

@ -80,16 +80,17 @@ TEST_F(ProductHelperTestWindows, givenInstrumentationForHardwareIsEnabledOrDisab
}
HWTEST_F(ProductHelperTestWindows, givenFtrIaCoherencyFlagWhenConfiguringHwInfoThenSetCoherencySupportCorrectly) {
HardwareInfo initialHwInfo = *defaultHwInfo;
bool initialCoherencyStatus = false;
productHelper->setCapabilityCoherencyFlag(outHwInfo, initialCoherencyStatus);
outHwInfo.featureTable.flags.ftrL3IACoherency = false;
productHelper->configureHwInfoWddm(&outHwInfo, &outHwInfo, *rootDeviceEnvironment.get());
initialHwInfo.featureTable.flags.ftrL3IACoherency = false;
productHelper->configureHwInfoWddm(&initialHwInfo, &outHwInfo, *rootDeviceEnvironment.get());
EXPECT_FALSE(outHwInfo.capabilityTable.ftrSupportsCoherency);
outHwInfo.featureTable.flags.ftrL3IACoherency = true;
productHelper->configureHwInfoWddm(&outHwInfo, &outHwInfo, *rootDeviceEnvironment.get());
initialHwInfo.featureTable.flags.ftrL3IACoherency = true;
productHelper->configureHwInfoWddm(&initialHwInfo, &outHwInfo, *rootDeviceEnvironment.get());
EXPECT_EQ(initialCoherencyStatus, outHwInfo.capabilityTable.ftrSupportsCoherency);
}
} // namespace NEO