fix: Init wait utils after hwInfo init for both OS

Resolves: HSD-18041922513

Signed-off-by: Lukasz Jobczyk <lukasz.jobczyk@intel.com>
This commit is contained in:
Lukasz Jobczyk
2025-03-27 14:00:16 +00:00
committed by Compute-Runtime-Automation
parent ead0842763
commit b43b23b6ed
5 changed files with 43 additions and 3 deletions

View File

@@ -68,6 +68,10 @@ void RootDeviceEnvironment::initDebuggerL0(Device *neoDevice) {
this->debugger = DebuggerL0::create(neoDevice);
}
void RootDeviceEnvironment::initWaitUtils() {
WaitUtils::init(WaitUtils::WaitpkgUse::tpause, *hwInfo);
}
const HardwareInfo *RootDeviceEnvironment::getHardwareInfo() const {
return hwInfo.get();
}
@@ -86,8 +90,6 @@ void RootDeviceEnvironment::setHwInfo(const HardwareInfo *hwInfo) {
if (debugManager.flags.DisableSupportForL0Debugger.get() == 1) {
this->hwInfo->capabilityTable.l0DebuggerSupported = false;
}
WaitUtils::init(WaitUtils::WaitpkgUse::tpause, *hwInfo);
}
bool RootDeviceEnvironment::isFullRangeSvm() const {
@@ -178,6 +180,7 @@ void RootDeviceEnvironment::initHelpers() {
initCompilerProductHelper();
initReleaseHelper();
initAilConfigurationHelper();
initWaitUtils();
}
void RootDeviceEnvironment::initializeGfxCoreHelperFromHwInfo() {

View File

@@ -67,6 +67,7 @@ struct RootDeviceEnvironment : NonCopyableClass {
void initOsTime();
void initGmm();
void initDebuggerL0(Device *neoDevice);
void initWaitUtils();
MOCKABLE_VIRTUAL void initDummyAllocation();
void setDummyBlitProperties(uint32_t rootDeviceIndex);

View File

@@ -472,6 +472,7 @@ int Drm::setupHardwareInfo(const DeviceDescriptor *device, bool setupFeatureTabl
rootDeviceEnvironment.initApiGfxCoreHelper();
rootDeviceEnvironment.initCompilerProductHelper();
rootDeviceEnvironment.initAilConfigurationHelper();
rootDeviceEnvironment.initWaitUtils();
auto result = rootDeviceEnvironment.initAilConfiguration();
if (false == result) {
PRINT_DEBUG_STRING(debugManager.flags.PrintDebugMessages.get(), stderr, "%s", "FATAL: AIL creation failed!\n");

View File

@@ -130,6 +130,7 @@ bool Wddm::init() {
if (productHelper.configureHwInfoWddm(hardwareInfo, hardwareInfo, rootDeviceEnvironment)) {
return false;
}
rootDeviceEnvironment.initWaitUtils();
setPlatformSupportEvictIfNecessaryFlag(productHelper);
auto preemptionMode = PreemptionHelper::getDefaultPreemptionMode(*hardwareInfo);

View File

@@ -5,6 +5,8 @@
*
*/
#include "shared/source/device/device.h"
#include "shared/source/os_interface/device_factory.h"
#include "shared/source/utilities/wait_util.h"
#include "shared/test/common/helpers/debug_manager_state_restore.h"
#include "shared/test/common/helpers/default_hw_info.h"
@@ -201,7 +203,7 @@ TEST_F(WaitPkgTest, givenEnabledWaitPkgSetToTpauseAndWaitpkgSupportTrueWhenWaitI
EXPECT_EQ(defaultHwInfo->capabilityTable.isIntegratedDevice ? 12 : 28, WaitUtils::waitPkgThresholdInMicroSeconds);
}
TEST_F(WaitPkgTest, givenWaitpkgSupportTrueWhenSetHwInfoThenWaitPkgEnabled) {
TEST_F(WaitPkgTest, givenWaitpkgSupportTrueWhenCreateExecutionEnvironmentThenWaitPkgEnabled) {
CpuInfo::cpuidFunc = mockCpuidEnableAll;
WaitUtils::waitpkgSupport = true;
@@ -215,6 +217,38 @@ TEST_F(WaitPkgTest, givenWaitpkgSupportTrueWhenSetHwInfoThenWaitPkgEnabled) {
EXPECT_EQ(defaultHwInfo->capabilityTable.isIntegratedDevice ? 12 : 28, WaitUtils::waitPkgThresholdInMicroSeconds);
}
TEST_F(WaitPkgTest, givenWaitpkgSupportTrueWhenCreateDevicesThenWaitPkgEnabled) {
CpuInfo::cpuidFunc = mockCpuidEnableAll;
WaitUtils::waitpkgSupport = true;
auto executionEnvironment = new NEO::ExecutionEnvironment;
executionEnvironment->incRefInternal();
NEO::DeviceFactory::createDevices(*executionEnvironment);
executionEnvironment->decRefInternal();
EXPECT_EQ(1u, WaitUtils::waitCount);
EXPECT_EQ(16000u, WaitUtils::waitpkgCounterValue);
EXPECT_EQ(0u, WaitUtils::waitpkgControlValue);
EXPECT_EQ(WaitUtils::waitpkgUse, WaitUtils::WaitpkgUse::tpause);
EXPECT_EQ(defaultHwInfo->capabilityTable.isIntegratedDevice ? 12 : 28, WaitUtils::waitPkgThresholdInMicroSeconds);
}
TEST_F(WaitPkgTest, givenWaitpkgSupportTrueWhenPrepareDeviceEnvironmentsThenWaitPkgEnabled) {
CpuInfo::cpuidFunc = mockCpuidEnableAll;
WaitUtils::waitpkgSupport = true;
ExecutionEnvironment executionEnvironment;
EXPECT_TRUE(NEO::DeviceFactory::prepareDeviceEnvironments(executionEnvironment));
EXPECT_EQ(1u, WaitUtils::waitCount);
EXPECT_EQ(16000u, WaitUtils::waitpkgCounterValue);
EXPECT_EQ(0u, WaitUtils::waitpkgControlValue);
EXPECT_EQ(WaitUtils::waitpkgUse, WaitUtils::WaitpkgUse::tpause);
EXPECT_EQ(defaultHwInfo->capabilityTable.isIntegratedDevice ? 12 : 28, WaitUtils::waitPkgThresholdInMicroSeconds);
}
TEST_F(WaitPkgTest, givenEnabledWaitPkgSetToTpauseAndWaitpkgThresholdAndWaitpkgSupportTrueWhenWaitInitializedAndCpuSupportsOperandThenWaitPkgEnabled) {
CpuInfo::cpuidFunc = mockCpuidEnableAll;