mirror of
https://github.com/intel/compute-runtime.git
synced 2025-12-21 17:29:14 +08:00
70 lines
1.8 KiB
C++
70 lines
1.8 KiB
C++
/*
|
|
* Copyright (C) 2021-2025 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
|
|
#include "shared/source/utilities/wait_util.h"
|
|
|
|
#include "shared/source/debug_settings/debug_settings_manager.h"
|
|
#include "shared/source/utilities/cpu_info.h"
|
|
|
|
namespace NEO {
|
|
|
|
namespace WaitUtils {
|
|
|
|
WaitpkgUse waitpkgUse = WaitpkgUse::uninitialized;
|
|
|
|
int64_t waitPkgThresholdInMicroSeconds = defaultWaitPkgThresholdInMicroSeconds;
|
|
uint64_t waitpkgCounterValue = defaultCounterValue;
|
|
uint32_t waitpkgControlValue = defaultControlValue;
|
|
uint32_t waitCount = defaultWaitCount;
|
|
|
|
#ifdef SUPPORTS_WAITPKG
|
|
bool waitpkgSupport = SUPPORTS_WAITPKG;
|
|
#else
|
|
bool waitpkgSupport = false;
|
|
#endif
|
|
|
|
void init(WaitpkgUse inputWaitpkgUse) {
|
|
if (debugManager.flags.WaitLoopCount.get() != -1) {
|
|
waitCount = debugManager.flags.WaitLoopCount.get();
|
|
}
|
|
|
|
if (waitpkgUse > WaitpkgUse::noUse) {
|
|
return;
|
|
}
|
|
|
|
if (!(waitpkgSupport && CpuInfo::getInstance().isFeatureSupported(CpuInfo::featureWaitPkg))) {
|
|
waitpkgUse = WaitpkgUse::noUse;
|
|
return;
|
|
}
|
|
|
|
if (debugManager.flags.EnableWaitpkg.get() != -1) {
|
|
inputWaitpkgUse = static_cast<WaitpkgUse>(debugManager.flags.EnableWaitpkg.get());
|
|
}
|
|
|
|
waitpkgUse = inputWaitpkgUse;
|
|
|
|
if (waitpkgUse == WaitpkgUse::umonitorAndUmwait) {
|
|
waitCount = 0u;
|
|
}
|
|
|
|
if (debugManager.flags.WaitpkgCounterValue.get() != -1) {
|
|
waitpkgCounterValue = debugManager.flags.WaitpkgCounterValue.get();
|
|
}
|
|
|
|
if (debugManager.flags.WaitpkgControlValue.get() != -1) {
|
|
waitpkgControlValue = debugManager.flags.WaitpkgControlValue.get();
|
|
}
|
|
|
|
if (debugManager.flags.WaitpkgThreshold.get() != -1) {
|
|
waitPkgThresholdInMicroSeconds = debugManager.flags.WaitpkgThreshold.get();
|
|
}
|
|
}
|
|
|
|
} // namespace WaitUtils
|
|
|
|
} // namespace NEO
|