Revert "refactor: move getProductMaxPreferredSlmSize to release helper"

This reverts commit 944c332371.

Signed-off-by: Kamil Kopryk <kamil.kopryk@intel.com>
This commit is contained in:
Kamil Kopryk
2023-05-24 15:08:32 +00:00
committed by Compute-Runtime-Automation
parent f32d62970d
commit 223eb3e3fc
10 changed files with 26 additions and 47 deletions

View File

@@ -102,6 +102,7 @@ class ProductHelper {
virtual bool allowCompression(const HardwareInfo &hwInfo) const = 0;
virtual LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const = 0;
virtual bool isAllocationSizeAdjustmentRequired(const HardwareInfo &hwInfo) const = 0;
virtual int getProductMaxPreferredSlmSize(const HardwareInfo &hwInfo, int preferredEnumValue) const = 0;
virtual bool isNewResidencyModelSupported() const = 0;
virtual bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const = 0;
virtual std::pair<bool, bool> isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo, bool isRcs, const ReleaseHelper *releaseHelper) const = 0;

View File

@@ -284,7 +284,10 @@ template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isAllocationSizeAdjustmentRequired(const HardwareInfo &hwInfo) const {
return false;
}
template <PRODUCT_FAMILY gfxProduct>
int ProductHelperHw<gfxProduct>::getProductMaxPreferredSlmSize(const HardwareInfo &hwInfo, int preferredEnumValue) const {
return preferredEnumValue;
}
template <PRODUCT_FAMILY gfxProduct>
bool ProductHelperHw<gfxProduct>::isAssignEngineRoundRobinSupported() const {
return false;

View File

@@ -55,6 +55,7 @@ class ProductHelperHw : public ProductHelper {
bool allowCompression(const HardwareInfo &hwInfo) const override;
LocalMemoryAccessMode getLocalMemoryAccessMode(const HardwareInfo &hwInfo) const override;
bool isAllocationSizeAdjustmentRequired(const HardwareInfo &hwInfo) const override;
int getProductMaxPreferredSlmSize(const HardwareInfo &hwInfo, int preferredEnumValue) const override;
bool isNewResidencyModelSupported() const override;
bool isDirectSubmissionSupported(const HardwareInfo &hwInfo) const override;
std::pair<bool, bool> isPipeControlPriorToNonPipelinedStateCommandsWARequired(const HardwareInfo &hwInfo, bool isRcs, const ReleaseHelper *releaseHelper) const override;

View File

@@ -28,7 +28,6 @@ class ReleaseHelper {
virtual bool isMatrixMultiplyAccumulateSupported() const = 0;
virtual bool isPipeControlPriorToNonPipelinedStateCommandsWARequired() const = 0;
virtual bool isPrefetchDisablingRequired() const = 0;
virtual int getProductMaxPreferredSlmSize(int preferredEnumValue) const = 0;
protected:
ReleaseHelper(HardwareIpVersion hardwareIpVersion) : hardwareIpVersion(hardwareIpVersion) {}
@@ -46,7 +45,6 @@ class ReleaseHelperHw : public ReleaseHelper {
bool isMatrixMultiplyAccumulateSupported() const override;
bool isPipeControlPriorToNonPipelinedStateCommandsWARequired() const override;
bool isPrefetchDisablingRequired() const override;
int getProductMaxPreferredSlmSize(int preferredEnumValue) const override;
private:
ReleaseHelperHw(HardwareIpVersion hardwareIpVersion) : ReleaseHelper(hardwareIpVersion) {}

View File

@@ -7,7 +7,6 @@
#include "shared/source/release_helper/release_helper.h"
#include "shared/source/release_helper/release_helper_base.inl"
#include "shared/source/xe_hpg_core/hw_cmds_xe_hpg_core_base.h"
#include "platforms.h"
#include "release_definitions.h"
@@ -20,16 +19,6 @@ bool ReleaseHelperHw<release>::isPipeControlPriorToNonPipelinedStateCommandsWARe
return hardwareIpVersion.value == AOT::MTL_M_A0;
}
template <>
int ReleaseHelperHw<release>::getProductMaxPreferredSlmSize(int preferredEnumValue) const {
using PREFERRED_SLM_ALLOCATION_SIZE = typename XeHpgCoreFamily::INTERFACE_DESCRIPTOR_DATA::PREFERRED_SLM_ALLOCATION_SIZE;
if (hardwareIpVersion.value == AOT::MTL_M_A0) {
return static_cast<int>(PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_96K);
}
return preferredEnumValue;
}
} // namespace NEO
#include "shared/source/release_helper/release_helper_common_xe_lpg.inl"

View File

@@ -7,7 +7,6 @@
#include "shared/source/release_helper/release_helper.h"
#include "shared/source/release_helper/release_helper_base.inl"
#include "shared/source/xe_hpg_core/hw_cmds_xe_hpg_core_base.h"
#include "platforms.h"
#include "release_definitions.h"
@@ -19,15 +18,6 @@ template <>
bool ReleaseHelperHw<release>::isPipeControlPriorToNonPipelinedStateCommandsWARequired() const {
return hardwareIpVersion.value == AOT::MTL_P_A0;
}
template <>
int ReleaseHelperHw<release>::getProductMaxPreferredSlmSize(int preferredEnumValue) const {
using PREFERRED_SLM_ALLOCATION_SIZE = typename XeHpgCoreFamily::INTERFACE_DESCRIPTOR_DATA::PREFERRED_SLM_ALLOCATION_SIZE;
if (hardwareIpVersion.value == AOT::MTL_P_A0) {
return static_cast<int>(PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_96K);
}
return preferredEnumValue;
}
} // namespace NEO

View File

@@ -27,9 +27,5 @@ template <ReleaseType releaseType>
bool ReleaseHelperHw<releaseType>::isPrefetchDisablingRequired() const {
return false;
}
template <ReleaseType releaseType>
int ReleaseHelperHw<releaseType>::getProductMaxPreferredSlmSize(int preferredEnumValue) const {
return preferredEnumValue;
}
} // namespace NEO

View File

@@ -67,18 +67,14 @@ void EncodeDispatchKernel<Family>::appendAdditionalIDDFields(INTERFACE_DESCRIPTO
}};
auto programmableIdPreferredSlmSize = PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K;
auto *releaseHelper = rootDeviceEnvironment.getReleaseHelper();
programmableIdPreferredSlmSize = static_cast<PREFERRED_SLM_ALLOCATION_SIZE>(
releaseHelper->getProductMaxPreferredSlmSize(programmableIdPreferredSlmSize));
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
programmableIdPreferredSlmSize = static_cast<PREFERRED_SLM_ALLOCATION_SIZE>(productHelper.getProductMaxPreferredSlmSize(hwInfo, programmableIdPreferredSlmSize));
for (auto &range : ranges) {
if (slmSize <= range.upperLimit) {
programmableIdPreferredSlmSize = range.valueToProgram;
break;
}
}
auto &productHelper = rootDeviceEnvironment.getHelper<ProductHelper>();
if (productHelper.isAllocationSizeAdjustmentRequired(hwInfo)) {
pInterfaceDescriptor->setPreferredSlmAllocationSize(PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_128K);
} else {

View File

@@ -92,6 +92,16 @@ uint64_t ProductHelperHw<gfxProduct>::overridePatIndex(AllocationType allocation
return patIndex;
}
template <>
int ProductHelperHw<gfxProduct>::getProductMaxPreferredSlmSize(const HardwareInfo &hwInfo, int preferredEnumValue) const {
using PREFERRED_SLM_ALLOCATION_SIZE = typename XeHpgCoreFamily::INTERFACE_DESCRIPTOR_DATA::PREFERRED_SLM_ALLOCATION_SIZE;
if (getProductConfigFromHwInfo(hwInfo) == AOT::MTL_M_A0 || getProductConfigFromHwInfo(hwInfo) == AOT::MTL_P_A0) {
return static_cast<int>(PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_96K);
} else {
return preferredEnumValue;
}
}
template <>
bool ProductHelperHw<gfxProduct>::isDummyBlitWaRequired() const {
return true;

View File

@@ -11,7 +11,6 @@
#include "shared/source/helpers/compiler_product_helper.h"
#include "shared/source/memory_manager/allocation_type.h"
#include "shared/source/os_interface/product_helper.h"
#include "shared/source/release_helper/release_helper.h"
#include "shared/source/xe_hpg_core/hw_cmds_mtl.h"
#include "shared/test/common/fixtures/device_fixture.h"
#include "shared/test/common/helpers/default_hw_info.h"
@@ -213,7 +212,7 @@ MTLTEST_F(MtlProductHelper, givenMtlLpgWhenIsBFloat16ConversionSupportedIsCalled
EXPECT_FALSE(compilerProductHelper.isBFloat16ConversionSupported(hwInfo));
}
MTLTEST_F(MtlProductHelper, givenMtlMA0WhenGetProductMaxPreferredSlmSizeThen96KbValueReturned) {
MTLTEST_F(MtlProductHelper, givenMtlMA0WhengetProductMaxPreferredSlmSizeThen96KbValueReturned) {
using PREFERRED_SLM_ALLOCATION_SIZE = typename XeHpgCoreFamily::INTERFACE_DESCRIPTOR_DATA::PREFERRED_SLM_ALLOCATION_SIZE;
PREFERRED_SLM_ALLOCATION_SIZE preferredEnumValue = PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_0K;
auto hwInfo = *defaultHwInfo.get();
@@ -221,12 +220,11 @@ MTLTEST_F(MtlProductHelper, givenMtlMA0WhenGetProductMaxPreferredSlmSizeThen96Kb
aotConfig.value = AOT::MTL_M_A0;
auto &compilerProductHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper<CompilerProductHelper>();
compilerProductHelper.setProductConfigForHwInfo(hwInfo, aotConfig);
refreshReleaseHelper(&hwInfo);
preferredEnumValue = static_cast<PREFERRED_SLM_ALLOCATION_SIZE>(releaseHelper->getProductMaxPreferredSlmSize(preferredEnumValue));
preferredEnumValue = static_cast<PREFERRED_SLM_ALLOCATION_SIZE>(productHelper->getProductMaxPreferredSlmSize(hwInfo, preferredEnumValue));
EXPECT_EQ(preferredEnumValue, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_96K);
}
MTLTEST_F(MtlProductHelper, givenMtlPA0WhenGetProductMaxPreferredSlmSizeThen96KbValueReturned) {
MTLTEST_F(MtlProductHelper, givenMtlPA0WhengetProductMaxPreferredSlmSizeThen96KbValueReturned) {
using PREFERRED_SLM_ALLOCATION_SIZE = typename XeHpgCoreFamily::INTERFACE_DESCRIPTOR_DATA::PREFERRED_SLM_ALLOCATION_SIZE;
PREFERRED_SLM_ALLOCATION_SIZE preferredEnumValue = PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_0K;
auto hwInfo = *defaultHwInfo.get();
@@ -234,11 +232,10 @@ MTLTEST_F(MtlProductHelper, givenMtlPA0WhenGetProductMaxPreferredSlmSizeThen96Kb
aotConfig.value = AOT::MTL_P_A0;
auto &compilerProductHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper<CompilerProductHelper>();
compilerProductHelper.setProductConfigForHwInfo(hwInfo, aotConfig);
refreshReleaseHelper(&hwInfo);
preferredEnumValue = static_cast<PREFERRED_SLM_ALLOCATION_SIZE>(releaseHelper->getProductMaxPreferredSlmSize(preferredEnumValue));
preferredEnumValue = static_cast<PREFERRED_SLM_ALLOCATION_SIZE>(productHelper->getProductMaxPreferredSlmSize(hwInfo, preferredEnumValue));
EXPECT_EQ(preferredEnumValue, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_96K);
}
MTLTEST_F(MtlProductHelper, givenMtlMB0WhenGetProductMaxPreferredSlmSizeThenPassedValueReturned) {
MTLTEST_F(MtlProductHelper, givenMtlMB0WhengetProductMaxPreferredSlmSizeThenPassedValueReturned) {
using PREFERRED_SLM_ALLOCATION_SIZE = typename XeHpgCoreFamily::INTERFACE_DESCRIPTOR_DATA::PREFERRED_SLM_ALLOCATION_SIZE;
PREFERRED_SLM_ALLOCATION_SIZE preferredEnumValue = PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_0K;
auto hwInfo = *defaultHwInfo.get();
@@ -246,12 +243,11 @@ MTLTEST_F(MtlProductHelper, givenMtlMB0WhenGetProductMaxPreferredSlmSizeThenPass
aotConfig.value = AOT::MTL_M_B0;
auto &compilerProductHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper<CompilerProductHelper>();
compilerProductHelper.setProductConfigForHwInfo(hwInfo, aotConfig);
refreshReleaseHelper(&hwInfo);
preferredEnumValue = static_cast<PREFERRED_SLM_ALLOCATION_SIZE>(releaseHelper->getProductMaxPreferredSlmSize(preferredEnumValue));
preferredEnumValue = static_cast<PREFERRED_SLM_ALLOCATION_SIZE>(productHelper->getProductMaxPreferredSlmSize(hwInfo, preferredEnumValue));
EXPECT_EQ(preferredEnumValue, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_0K);
}
MTLTEST_F(MtlProductHelper, givenMtlPB0WhenGetProductMaxPreferredSlmSizeThenPassedValueReturned) {
MTLTEST_F(MtlProductHelper, givenMtlPB0WhengetProductMaxPreferredSlmSizeThenPassedValueReturned) {
using PREFERRED_SLM_ALLOCATION_SIZE = typename XeHpgCoreFamily::INTERFACE_DESCRIPTOR_DATA::PREFERRED_SLM_ALLOCATION_SIZE;
PREFERRED_SLM_ALLOCATION_SIZE preferredEnumValue = PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_0K;
auto hwInfo = *defaultHwInfo.get();
@@ -259,8 +255,7 @@ MTLTEST_F(MtlProductHelper, givenMtlPB0WhenGetProductMaxPreferredSlmSizeThenPass
aotConfig.value = AOT::MTL_P_B0;
auto &compilerProductHelper = this->executionEnvironment->rootDeviceEnvironments[0]->getHelper<CompilerProductHelper>();
compilerProductHelper.setProductConfigForHwInfo(hwInfo, aotConfig);
refreshReleaseHelper(&hwInfo);
preferredEnumValue = static_cast<PREFERRED_SLM_ALLOCATION_SIZE>(releaseHelper->getProductMaxPreferredSlmSize(preferredEnumValue));
preferredEnumValue = static_cast<PREFERRED_SLM_ALLOCATION_SIZE>(productHelper->getProductMaxPreferredSlmSize(hwInfo, preferredEnumValue));
EXPECT_EQ(preferredEnumValue, PREFERRED_SLM_ALLOCATION_SIZE::PREFERRED_SLM_ALLOCATION_SIZE_0K);
}