1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
/*
* Copyright (C) 2021-2024 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 {
constexpr uint64_t defaultCounterValue = 10000;
constexpr uint32_t defaultControlValue = 0;
constexpr bool defaultEnableWaitPkg = false;
uint64_t waitpkgCounterValue = defaultCounterValue;
uint32_t waitpkgControlValue = defaultControlValue;
uint32_t waitCount = defaultWaitCount;
#ifdef SUPPORTS_WAITPKG
bool waitpkgSupport = SUPPORTS_WAITPKG;
#else
bool waitpkgSupport = false;
#endif
bool waitpkgUse = false;
void init() {
bool enableWaitPkg = defaultEnableWaitPkg;
int32_t overrideEnableWaitPkg = debugManager.flags.EnableWaitpkg.get();
if (overrideEnableWaitPkg != -1) {
enableWaitPkg = !!(overrideEnableWaitPkg);
}
if (enableWaitPkg && waitpkgSupport) {
if (CpuInfo::getInstance().isFeatureSupported(CpuInfo::featureWaitPkg)) {
waitpkgUse = true;
waitCount = 0;
}
}
int64_t overrideWaitPkgCounter = debugManager.flags.WaitpkgCounterValue.get();
if (overrideWaitPkgCounter != -1) {
waitpkgCounterValue = static_cast<uint64_t>(overrideWaitPkgCounter);
}
int32_t overrideWaitPkgControl = debugManager.flags.WaitpkgControlValue.get();
if (overrideWaitPkgControl != -1) {
waitpkgControlValue = static_cast<uint32_t>(overrideWaitPkgControl);
}
int32_t overrideWaitCount = debugManager.flags.WaitLoopCount.get();
if (overrideWaitCount != -1) {
waitCount = static_cast<uint32_t>(overrideWaitCount);
}
}
} // namespace WaitUtils
} // namespace NEO
|