refactor: Split waitpkg params for ulls light and default

Related-To: NEO-14866

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2025-05-09 09:48:37 +00:00
committed by Compute-Runtime-Automation
parent df2c776aab
commit 5cd5bbafc5
4 changed files with 47 additions and 0 deletions

View File

@@ -1452,6 +1452,7 @@ inline bool CommandStreamReceiverHw<GfxFamily>::initDirectSubmission() {
if (this->osContext->isDirectSubmissionLightActive()) {
this->pushAllocationsForMakeResident = false;
WaitUtils::init(WaitUtils::WaitpkgUse::tpause, *this->peekExecutionEnvironment().rootDeviceEnvironments[this->getRootDeviceIndex()]->getHardwareInfo());
WaitUtils::adjustWaitpkgParamsForUllsLight();
}
}
}

View File

@@ -56,6 +56,10 @@ void init(WaitpkgUse inputWaitpkgUse, const HardwareInfo &hwInfo) {
waitCount = 0u;
}
overrideWaitpkgParams();
}
void overrideWaitpkgParams() {
if (debugManager.flags.WaitpkgCounterValue.get() != -1) {
waitpkgCounterValue = debugManager.flags.WaitpkgCounterValue.get();
}
@@ -69,6 +73,12 @@ void init(WaitpkgUse inputWaitpkgUse, const HardwareInfo &hwInfo) {
}
}
void adjustWaitpkgParamsForUllsLight() {
waitPkgThresholdInMicroSeconds = defaultWaitPkgThresholdForUllsLightInMicroSeconds;
waitpkgCounterValue = defaultCounterValueForUllsLight;
overrideWaitpkgParams();
}
} // namespace WaitUtils
} // namespace NEO

View File

@@ -32,6 +32,9 @@ constexpr uint64_t defaultCounterValue = 16000;
constexpr uint32_t defaultControlValue = 0;
constexpr uint32_t defaultWaitCount = 1u;
constexpr int64_t defaultWaitPkgThresholdForUllsLightInMicroSeconds = 1;
constexpr uint64_t defaultCounterValueForUllsLight = 16000;
extern WaitpkgUse waitpkgUse;
extern int64_t waitPkgThresholdInMicroSeconds;
extern uint64_t waitpkgCounterValue;
@@ -81,6 +84,9 @@ inline bool waitFunction(volatile TagAddressType *pollAddress, TaskCountType exp
}
void init(WaitpkgUse inputWaitpkgUse, const HardwareInfo &hwInfo);
void overrideWaitpkgParams();
void adjustWaitpkgParamsForUllsLight();
} // namespace WaitUtils
} // namespace NEO

View File

@@ -33,6 +33,36 @@ HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenDirectSubmissionLi
csr->initDirectSubmission();
EXPECT_EQ(WaitUtils::waitpkgUse, WaitUtils::WaitpkgUse::tpause);
EXPECT_EQ(WaitUtils::waitpkgCounterValue, WaitUtils::defaultCounterValueForUllsLight);
EXPECT_EQ(WaitUtils::waitPkgThresholdInMicroSeconds, WaitUtils::defaultWaitPkgThresholdForUllsLightInMicroSeconds);
CpuInfo::cpuidFunc = savedCpuIdFunc;
}
HWTEST_TEMPLATED_F(DrmCommandStreamDirectSubmissionTest, givenWaitpkgParamsSetByDebugVariablesAndDirectSubmissionLightWhenInitThenUseTpauseWaitpkg) {
using CpuIdFuncT = void (*)(int *, int);
DebugManagerStateRestore restorer;
debugManager.flags.WaitpkgThreshold.set(35);
debugManager.flags.WaitpkgCounterValue.set(1000);
auto mockCpuInfo = getMockCpuInfo(CpuInfo::getInstance());
VariableBackup<MockCpuInfo> cpuInfoBackup(mockCpuInfo);
mockCpuInfo->features = CpuInfo::featureNone;
CpuIdFuncT savedCpuIdFunc = CpuInfo::cpuidFunc;
CpuInfo::cpuidFunc = mockCpuidEnableAll;
VariableBackup<bool> backupWaitpkgSupport(&WaitUtils::waitpkgSupport, true);
auto testedCsr = static_cast<TestedDrmCommandStreamReceiver<FamilyType> *>(csr);
testedCsr->directSubmission.reset();
csr->initDirectSubmission();
EXPECT_EQ(WaitUtils::waitpkgUse, WaitUtils::WaitpkgUse::tpause);
EXPECT_EQ(WaitUtils::waitpkgCounterValue, 1000u);
EXPECT_EQ(WaitUtils::waitPkgThresholdInMicroSeconds, 35);
CpuInfo::cpuidFunc = savedCpuIdFunc;
}