mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-03 06:49:52 +08:00
performance: add power throttling debug key
Set windows process power throttling hint to HIGH on wddm init Related-To: NEO-8215 Signed-off-by: Dominik Dabek <dominik.dabek@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
933e5ab818
commit
6cf6a8def8
@@ -93,6 +93,9 @@ DWORD getFileAttributesResult = TRUE;
|
||||
size_t setFilePointerCalled = 0u;
|
||||
DWORD setFilePointerResult = 0;
|
||||
|
||||
size_t setProcessPowerThrottlingStateCalled = 0u;
|
||||
ProcessPowerThrottlingState setProcessPowerThrottlingStateLastValue{};
|
||||
|
||||
bool pathExists(const std::string &path) {
|
||||
std::string tempP1 = path;
|
||||
if (!path.empty() && path.back() == PATH_SEPARATOR) {
|
||||
@@ -273,6 +276,11 @@ void coTaskMemFree(LPVOID pv) {
|
||||
return;
|
||||
}
|
||||
|
||||
void setProcessPowerThrottlingState(ProcessPowerThrottlingState state) {
|
||||
setProcessPowerThrottlingStateCalled++;
|
||||
setProcessPowerThrottlingStateLastValue = state;
|
||||
}
|
||||
|
||||
LSTATUS regOpenKeyExA(HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult) {
|
||||
if (regOpenKeySuccessCount > 0) {
|
||||
regOpenKeySuccessCount--;
|
||||
|
||||
@@ -566,4 +566,5 @@ SetAmountOfInternalHeapsToPreallocate = -1
|
||||
DoNotUseProductConfigForValidationWa = 0
|
||||
EnableDeviceStateVerificationAfterFailedSubmission = -1
|
||||
InOrderAtomicSignallingEnabled = -1
|
||||
SetProcessPowerThrottlingState = -1
|
||||
# Please don't edit below this line
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "shared/source/os_interface/windows/driver_info_windows.h"
|
||||
#include "shared/source/os_interface/windows/dxgi_wrapper.h"
|
||||
#include "shared/source/os_interface/windows/sharedata_wrapper.h"
|
||||
#include "shared/source/os_interface/windows/sys_calls.h"
|
||||
#include "shared/source/os_interface/windows/wddm_engine_mapper.h"
|
||||
#include "shared/source/os_interface/windows/wddm_memory_manager.h"
|
||||
#include "shared/source/utilities/debug_settings_reader.h"
|
||||
@@ -24,11 +25,12 @@
|
||||
#include "shared/test/common/os_interface/windows/ult_dxcore_factory.h"
|
||||
#include "shared/test/common/os_interface/windows/wddm_fixture.h"
|
||||
#include "shared/test/common/test_macros/hw_test.h"
|
||||
|
||||
namespace NEO {
|
||||
namespace SysCalls {
|
||||
extern const wchar_t *currentLibraryPath;
|
||||
}
|
||||
extern size_t setProcessPowerThrottlingStateCalled;
|
||||
extern SysCalls::ProcessPowerThrottlingState setProcessPowerThrottlingStateLastValue;
|
||||
} // namespace SysCalls
|
||||
extern uint32_t numRootDevicesToEnum;
|
||||
std::unique_ptr<HwDeviceIdWddm> createHwDeviceIdFromAdapterLuid(OsEnvironmentWin &osEnvironment, LUID adapterLuid, uint32_t adapterNodeOrdinalIn);
|
||||
} // namespace NEO
|
||||
@@ -323,3 +325,50 @@ TEST_F(WddmGfxPartitionTest, WhenInitializingGfxPartitionThenAllHeapsAreInitiali
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(WddmTestWithMockGdiDll, givenSetProcessPowerThrottlingStateDefaultWhenInitWddmThenPowerThrottlingStateIsNotSet) {
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.SetProcessPowerThrottlingState.set(-1);
|
||||
SysCalls::setProcessPowerThrottlingStateCalled = 0u;
|
||||
SysCalls::setProcessPowerThrottlingStateLastValue = SysCalls::ProcessPowerThrottlingState::Eco;
|
||||
wddm->init();
|
||||
EXPECT_EQ(0u, SysCalls::setProcessPowerThrottlingStateCalled);
|
||||
}
|
||||
|
||||
TEST_F(WddmTestWithMockGdiDll, givenSetProcessPowerThrottlingState0WhenInitWddmThenPowerThrottlingStateIsNotSet) {
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.SetProcessPowerThrottlingState.set(0);
|
||||
SysCalls::setProcessPowerThrottlingStateCalled = 0u;
|
||||
SysCalls::setProcessPowerThrottlingStateLastValue = SysCalls::ProcessPowerThrottlingState::Eco;
|
||||
wddm->init();
|
||||
EXPECT_EQ(0u, SysCalls::setProcessPowerThrottlingStateCalled);
|
||||
}
|
||||
|
||||
TEST_F(WddmTestWithMockGdiDll, givenSetProcessPowerThrottlingState1WhenInitWddmThenPowerThrottlingStateIsSetToEco) {
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.SetProcessPowerThrottlingState.set(1);
|
||||
SysCalls::setProcessPowerThrottlingStateCalled = 0u;
|
||||
SysCalls::setProcessPowerThrottlingStateLastValue = SysCalls::ProcessPowerThrottlingState::High;
|
||||
wddm->init();
|
||||
EXPECT_EQ(1u, SysCalls::setProcessPowerThrottlingStateCalled);
|
||||
EXPECT_EQ(SysCalls::ProcessPowerThrottlingState::Eco, SysCalls::setProcessPowerThrottlingStateLastValue);
|
||||
}
|
||||
|
||||
TEST_F(WddmTestWithMockGdiDll, givenSetProcessPowerThrottlingState2WhenInitWddmThenPowerThrottlingStateIsSetToHigh) {
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.SetProcessPowerThrottlingState.set(2);
|
||||
SysCalls::setProcessPowerThrottlingStateCalled = 0u;
|
||||
SysCalls::setProcessPowerThrottlingStateLastValue = SysCalls::ProcessPowerThrottlingState::Eco;
|
||||
wddm->init();
|
||||
EXPECT_EQ(1u, SysCalls::setProcessPowerThrottlingStateCalled);
|
||||
EXPECT_EQ(SysCalls::ProcessPowerThrottlingState::High, SysCalls::setProcessPowerThrottlingStateLastValue);
|
||||
}
|
||||
|
||||
TEST_F(WddmTestWithMockGdiDll, givenSetProcessPowerThrottlingStateUnsupportedWhenInitWddmThenPowerThrottlingStateIsNotSet) {
|
||||
DebugManagerStateRestore restorer;
|
||||
debugManager.flags.SetProcessPowerThrottlingState.set(3);
|
||||
SysCalls::setProcessPowerThrottlingStateCalled = 0u;
|
||||
SysCalls::setProcessPowerThrottlingStateLastValue = SysCalls::ProcessPowerThrottlingState::Eco;
|
||||
wddm->init();
|
||||
EXPECT_EQ(0u, SysCalls::setProcessPowerThrottlingStateCalled);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user