HP implemented an interesting form of aggressive thermal throttling on my notebook. After reaching a certain temperature, it would throttle the CPU to a lower power state. On mobile Ryzen CPUs (and on desktops too), the power states can be modified. I used an existing closed source tool to modify the lower power states to be equivalent to the higher power states, effectively disabling HPs thermal throttling. However, I wanted to automate that and no open source solution that works with shell scripts existed for Windows.
A commandline application that can modify the power states on almost all Zen based AMD CPUs and can be used in shell scripts.
By running scripts to change the power states before starting games, I can have a much more consistent performance ingame.
The documentation, source code and current build is available on GitHub: https://github.com/saschabrunner/Ryzen-Pstates
Note: Existing safeguards in the CPU stay enabled, it will still throttle under (real) thermal emergencies and respect the current and power limits.
Other applications (ryzenadj) can be used to adjust those limits.
It was a great new exercise for me to perform such low level operations on a system.
I learned that AMD provides registers on the CPU to control power states, documented here. By using WinRing0 (OpenLibSys), I was able to easily execute the x86 instructions RDMSR and WRMSR. These instructions allow you to read and write those model specific registers required to change power states on AMD Zen CPUs.