mirror of
https://github.com/intel/compute-runtime.git
synced 2025-09-15 13:01:45 +08:00
Use hardware support flags for state compute mode state changes
Related-To: NEO-5019 Signed-off-by: Zbigniew Zdanowicz <zbigniew.zdanowicz@intel.com>
This commit is contained in:

committed by
Compute-Runtime-Automation

parent
2de3cdc90c
commit
f656707fc0
@ -35,9 +35,12 @@ struct StateComputeModeProperties {
|
||||
void clearIsDirty();
|
||||
|
||||
bool isDirtyExtra() const;
|
||||
void setPropertiesExtra(const StateComputeModePropertiesSupport &supportFlags);
|
||||
void setPropertiesExtra();
|
||||
void setPropertiesExtra(const StateComputeModeProperties &properties);
|
||||
void clearIsDirtyExtra();
|
||||
|
||||
StateComputeModePropertiesSupport scmPropertiesSupport = {};
|
||||
bool propertiesSupportLoaded = false;
|
||||
};
|
||||
|
||||
struct FrontEndPropertiesSupport {
|
||||
|
@ -16,17 +16,22 @@ using namespace NEO;
|
||||
|
||||
void StateComputeModeProperties::setProperties(bool requiresCoherency, uint32_t numGrfRequired, int32_t threadArbitrationPolicy, PreemptionMode devicePreemptionMode,
|
||||
const HardwareInfo &hwInfo) {
|
||||
auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
|
||||
StateComputeModePropertiesSupport scmPropertiesSupport = {};
|
||||
hwInfoConfig.fillScmPropertiesSupportStructure(scmPropertiesSupport);
|
||||
if (this->propertiesSupportLoaded == false) {
|
||||
auto &hwInfoConfig = *HwInfoConfig::get(hwInfo.platform.eProductFamily);
|
||||
hwInfoConfig.fillScmPropertiesSupportStructure(this->scmPropertiesSupport);
|
||||
this->propertiesSupportLoaded = true;
|
||||
}
|
||||
|
||||
auto &hwHelper = HwHelper::get(hwInfo.platform.eRenderCoreFamily);
|
||||
clearIsDirty();
|
||||
|
||||
int32_t isCoherencyRequired = (requiresCoherency ? 1 : 0);
|
||||
this->isCoherencyRequired.set(isCoherencyRequired);
|
||||
if (this->scmPropertiesSupport.coherencyRequired) {
|
||||
int32_t isCoherencyRequired = (requiresCoherency ? 1 : 0);
|
||||
this->isCoherencyRequired.set(isCoherencyRequired);
|
||||
}
|
||||
|
||||
if (scmPropertiesSupport.largeGrfMode &&
|
||||
if (this->scmPropertiesSupport.largeGrfMode &&
|
||||
(this->largeGrfMode.value == -1 || numGrfRequired != GrfConfig::NotApplicable)) {
|
||||
int32_t largeGrfMode = (numGrfRequired == GrfConfig::LargeGrfNumber ? 1 : 0);
|
||||
this->largeGrfMode.set(largeGrfMode);
|
||||
@ -36,13 +41,17 @@ void StateComputeModeProperties::setProperties(bool requiresCoherency, uint32_t
|
||||
if (DebugManager.flags.ForceZPassAsyncComputeThreadLimit.get() != -1) {
|
||||
zPassAsyncComputeThreadLimit = DebugManager.flags.ForceZPassAsyncComputeThreadLimit.get();
|
||||
}
|
||||
this->zPassAsyncComputeThreadLimit.set(zPassAsyncComputeThreadLimit);
|
||||
if (zPassAsyncComputeThreadLimit != -1 && this->scmPropertiesSupport.zPassAsyncComputeThreadLimit) {
|
||||
this->zPassAsyncComputeThreadLimit.set(zPassAsyncComputeThreadLimit);
|
||||
}
|
||||
|
||||
int32_t pixelAsyncComputeThreadLimit = -1;
|
||||
if (DebugManager.flags.ForcePixelAsyncComputeThreadLimit.get() != -1) {
|
||||
pixelAsyncComputeThreadLimit = DebugManager.flags.ForcePixelAsyncComputeThreadLimit.get();
|
||||
}
|
||||
this->pixelAsyncComputeThreadLimit.set(pixelAsyncComputeThreadLimit);
|
||||
if (pixelAsyncComputeThreadLimit != -1 && this->scmPropertiesSupport.pixelAsyncComputeThreadLimit) {
|
||||
this->pixelAsyncComputeThreadLimit.set(pixelAsyncComputeThreadLimit);
|
||||
}
|
||||
|
||||
bool setDefaultThreadArbitrationPolicy = (threadArbitrationPolicy == ThreadArbitrationPolicy::NotPresent) &&
|
||||
(NEO::DebugManager.flags.ForceDefaultThreadArbitrationPolicyIfNotSpecified.get() ||
|
||||
@ -53,15 +62,15 @@ void StateComputeModeProperties::setProperties(bool requiresCoherency, uint32_t
|
||||
if (DebugManager.flags.OverrideThreadArbitrationPolicy.get() != -1) {
|
||||
threadArbitrationPolicy = DebugManager.flags.OverrideThreadArbitrationPolicy.get();
|
||||
}
|
||||
if (scmPropertiesSupport.threadArbitrationPolicy) {
|
||||
if (this->scmPropertiesSupport.threadArbitrationPolicy) {
|
||||
this->threadArbitrationPolicy.set(threadArbitrationPolicy);
|
||||
}
|
||||
|
||||
if (hwHelper.isDevicePreemptionModeTrackedInScm()) {
|
||||
if (this->scmPropertiesSupport.devicePreemptionMode) {
|
||||
this->devicePreemptionMode.set(static_cast<int32_t>(devicePreemptionMode));
|
||||
}
|
||||
|
||||
setPropertiesExtra(scmPropertiesSupport);
|
||||
setPropertiesExtra();
|
||||
}
|
||||
|
||||
void StateComputeModeProperties::setProperties(const StateComputeModeProperties &properties) {
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
using namespace NEO;
|
||||
|
||||
void StateComputeModeProperties::setPropertiesExtra(const StateComputeModePropertiesSupport &supportFlags) {
|
||||
void StateComputeModeProperties::setPropertiesExtra() {
|
||||
}
|
||||
void StateComputeModeProperties::setPropertiesExtra(const StateComputeModeProperties &properties) {
|
||||
}
|
||||
|
@ -158,7 +158,6 @@ class HwHelper {
|
||||
virtual const void *getBatchBufferEndReference() const = 0;
|
||||
virtual bool isPlatformFlushTaskEnabled(const NEO::HardwareInfo &hwInfo) const = 0;
|
||||
virtual bool isPatIndexFallbackWaRequired() const = 0;
|
||||
virtual bool isDevicePreemptionModeTrackedInScm() const = 0;
|
||||
|
||||
protected:
|
||||
HwHelper() = default;
|
||||
@ -399,7 +398,6 @@ class HwHelperHw : public HwHelper {
|
||||
const void *getBatchBufferEndReference() const override;
|
||||
bool isPlatformFlushTaskEnabled(const NEO::HardwareInfo &hwInfo) const override;
|
||||
bool isPatIndexFallbackWaRequired() const override;
|
||||
bool isDevicePreemptionModeTrackedInScm() const override;
|
||||
|
||||
protected:
|
||||
static const AuxTranslationMode defaultAuxTranslationMode;
|
||||
|
@ -718,8 +718,4 @@ bool HwHelperHw<GfxFamily>::isPatIndexFallbackWaRequired() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename GfxFamily>
|
||||
bool HwHelperHw<GfxFamily>::isDevicePreemptionModeTrackedInScm() const {
|
||||
return false;
|
||||
}
|
||||
} // namespace NEO
|
||||
|
@ -411,7 +411,7 @@ bool HwInfoConfigHw<gfxProduct>::isGrfNumReportedWithScm() const {
|
||||
if (DebugManager.flags.ForceGrfNumProgrammingWithScm.get() != -1) {
|
||||
return DebugManager.flags.ForceGrfNumProgrammingWithScm.get();
|
||||
}
|
||||
return true;
|
||||
return HwInfoConfigHw<gfxProduct>::getScmPropertyLargeGrfModeSupport();
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
@ -419,7 +419,7 @@ bool HwInfoConfigHw<gfxProduct>::isThreadArbitrationPolicyReportedWithScm() cons
|
||||
if (DebugManager.flags.ForceThreadArbitrationPolicyProgrammingWithScm.get() != -1) {
|
||||
return DebugManager.flags.ForceThreadArbitrationPolicyProgrammingWithScm.get();
|
||||
}
|
||||
return true;
|
||||
return HwInfoConfigHw<gfxProduct>::getScmPropertyThreadArbitrationPolicySupport();
|
||||
}
|
||||
|
||||
template <PRODUCT_FAMILY gfxProduct>
|
||||
|
@ -368,10 +368,6 @@ template <>
|
||||
void HwInfoConfigHw<IGFX_UNKNOWN>::updateIddCommand(void *const commandPtr, uint32_t numGrf, int32_t threadArbitrationPolicy) {
|
||||
}
|
||||
|
||||
template <>
|
||||
bool HwInfoConfigHw<IGFX_UNKNOWN>::isGrfNumReportedWithScm() const {
|
||||
return false;
|
||||
}
|
||||
template <>
|
||||
void HwInfoConfigHw<IGFX_UNKNOWN>::enableCompression(HardwareInfo *hwInfo) {
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "shared/source/command_stream/stream_properties.h"
|
||||
#include "shared/source/command_stream/thread_arbitration_policy.h"
|
||||
#include "shared/source/helpers/hw_helper.h"
|
||||
#include "shared/source/os_interface/hw_info_config.h"
|
||||
#include "shared/test/common/helpers/debug_manager_state_restore.h"
|
||||
#include "shared/test/common/helpers/default_hw_info.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
@ -65,7 +66,9 @@ TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValu
|
||||
DebugManager.flags.ForceGrfNumProgrammingWithScm.set(1);
|
||||
DebugManager.flags.ForceThreadArbitrationPolicyProgrammingWithScm.set(1);
|
||||
|
||||
auto isDevicePreemptionModeTrackedInScm = HwHelper::get(defaultHwInfo->platform.eRenderCoreFamily).isDevicePreemptionModeTrackedInScm();
|
||||
StateComputeModePropertiesSupport scmPropertiesSupport = {};
|
||||
auto hwInfoConfig = HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
hwInfoConfig->fillScmPropertiesSupportStructure(scmPropertiesSupport);
|
||||
|
||||
int32_t threadArbitrationPolicyValues[] = {
|
||||
ThreadArbitrationPolicy::AgeBased, ThreadArbitrationPolicy::RoundRobin,
|
||||
@ -80,12 +83,16 @@ TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValu
|
||||
for (auto threadArbitrationPolicy : threadArbitrationPolicyValues) {
|
||||
properties.stateComputeMode.setProperties(requiresCoherency, largeGrf ? 256 : 128, threadArbitrationPolicy, preemptionMode, *defaultHwInfo);
|
||||
EXPECT_EQ(largeGrf, properties.stateComputeMode.largeGrfMode.value);
|
||||
EXPECT_EQ(requiresCoherency, properties.stateComputeMode.isCoherencyRequired.value);
|
||||
if (scmPropertiesSupport.coherencyRequired) {
|
||||
EXPECT_EQ(requiresCoherency, properties.stateComputeMode.isCoherencyRequired.value);
|
||||
} else {
|
||||
EXPECT_EQ(-1, properties.stateComputeMode.isCoherencyRequired.value);
|
||||
}
|
||||
EXPECT_EQ(-1, properties.stateComputeMode.zPassAsyncComputeThreadLimit.value);
|
||||
EXPECT_EQ(-1, properties.stateComputeMode.pixelAsyncComputeThreadLimit.value);
|
||||
EXPECT_EQ(threadArbitrationPolicy, properties.stateComputeMode.threadArbitrationPolicy.value);
|
||||
|
||||
if (isDevicePreemptionModeTrackedInScm) {
|
||||
if (scmPropertiesSupport.devicePreemptionMode) {
|
||||
EXPECT_EQ(preemptionMode, static_cast<PreemptionMode>(properties.stateComputeMode.devicePreemptionMode.value));
|
||||
} else {
|
||||
EXPECT_EQ(-1, properties.stateComputeMode.devicePreemptionMode.value);
|
||||
@ -98,19 +105,31 @@ TEST(StreamPropertiesTests, whenSettingStateComputeModePropertiesThenCorrectValu
|
||||
for (auto forceZPassAsyncComputeThreadLimit : ::testing::Bool()) {
|
||||
DebugManager.flags.ForceZPassAsyncComputeThreadLimit.set(forceZPassAsyncComputeThreadLimit);
|
||||
properties.stateComputeMode.setProperties(false, 0u, 0u, PreemptionMode::MidBatch, *defaultHwInfo);
|
||||
EXPECT_EQ(forceZPassAsyncComputeThreadLimit, properties.stateComputeMode.zPassAsyncComputeThreadLimit.value);
|
||||
if (scmPropertiesSupport.zPassAsyncComputeThreadLimit) {
|
||||
EXPECT_EQ(forceZPassAsyncComputeThreadLimit, properties.stateComputeMode.zPassAsyncComputeThreadLimit.value);
|
||||
} else {
|
||||
EXPECT_EQ(-1, properties.stateComputeMode.zPassAsyncComputeThreadLimit.value);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto forcePixelAsyncComputeThreadLimit : ::testing::Bool()) {
|
||||
DebugManager.flags.ForcePixelAsyncComputeThreadLimit.set(forcePixelAsyncComputeThreadLimit);
|
||||
properties.stateComputeMode.setProperties(false, 0u, 0u, PreemptionMode::MidBatch, *defaultHwInfo);
|
||||
EXPECT_EQ(forcePixelAsyncComputeThreadLimit, properties.stateComputeMode.pixelAsyncComputeThreadLimit.value);
|
||||
if (scmPropertiesSupport.pixelAsyncComputeThreadLimit) {
|
||||
EXPECT_EQ(forcePixelAsyncComputeThreadLimit, properties.stateComputeMode.pixelAsyncComputeThreadLimit.value);
|
||||
} else {
|
||||
EXPECT_EQ(-1, properties.stateComputeMode.pixelAsyncComputeThreadLimit.value);
|
||||
}
|
||||
}
|
||||
|
||||
for (auto threadArbitrationPolicy : threadArbitrationPolicyValues) {
|
||||
DebugManager.flags.OverrideThreadArbitrationPolicy.set(threadArbitrationPolicy);
|
||||
properties.stateComputeMode.setProperties(false, 0u, 0u, PreemptionMode::MidBatch, *defaultHwInfo);
|
||||
EXPECT_EQ(threadArbitrationPolicy, properties.stateComputeMode.threadArbitrationPolicy.value);
|
||||
if (scmPropertiesSupport.threadArbitrationPolicy) {
|
||||
EXPECT_EQ(threadArbitrationPolicy, properties.stateComputeMode.threadArbitrationPolicy.value);
|
||||
} else {
|
||||
EXPECT_EQ(-1, properties.stateComputeMode.threadArbitrationPolicy.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,9 +50,9 @@ HWTEST_F(HwInfoConfigTest, givenHwInfoConfigWhenGetThreadEuRatioForScratchThen8I
|
||||
EXPECT_EQ(8u, hwInfoConfig.getThreadEuRatioForScratch(*defaultHwInfo));
|
||||
}
|
||||
|
||||
HWTEST_F(HwInfoConfigTest, whenIsGrfNumReportedWithScmIsQueriedThenTrueIsReturned) {
|
||||
HWTEST_F(HwInfoConfigTest, givenDefaultSettingWhenIsGrfNumReportedIsCalledThenScmSupportProductValueIsReturned) {
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_TRUE(hwInfoConfig.isGrfNumReportedWithScm());
|
||||
EXPECT_EQ(hwInfoConfig.getScmPropertyLargeGrfModeSupport(), hwInfoConfig.isGrfNumReportedWithScm());
|
||||
}
|
||||
|
||||
HWTEST_F(HwInfoConfigTest, givenForceGrfNumProgrammingWithScmFlagSetWhenIsGrfNumReportedWithScmIsQueriedThenCorrectValueIsReturned) {
|
||||
@ -66,9 +66,9 @@ HWTEST_F(HwInfoConfigTest, givenForceGrfNumProgrammingWithScmFlagSetWhenIsGrfNum
|
||||
EXPECT_TRUE(hwInfoConfig.isGrfNumReportedWithScm());
|
||||
}
|
||||
|
||||
HWTEST_F(HwInfoConfigTest, whenIsThreadArbitrationPolicyReportedWithScmIsQueriedThenTrueIsReturned) {
|
||||
HWTEST_F(HwInfoConfigTest, givenDefaultSettingWhenIsThreadArbitrationPolicyReportedIsCalledThenScmSupportProductValueReturned) {
|
||||
const auto &hwInfoConfig = *HwInfoConfig::get(defaultHwInfo->platform.eProductFamily);
|
||||
EXPECT_TRUE(hwInfoConfig.isThreadArbitrationPolicyReportedWithScm());
|
||||
EXPECT_EQ(hwInfoConfig.getScmPropertyThreadArbitrationPolicySupport(), hwInfoConfig.isThreadArbitrationPolicyReportedWithScm());
|
||||
}
|
||||
|
||||
HWTEST_F(HwInfoConfigTest, givenForceThreadArbitrationPolicyProgrammingWithScmFlagSetWhenIsThreadArbitrationPolicyReportedWithScmIsQueriedThenCorrectValueIsReturned) {
|
||||
|
Reference in New Issue
Block a user