NGnius / PowerTools

Moved to
https://git.ngni.us/NG-SD-Plugins/PowerTools
GNU General Public License v3.0
414 stars 29 forks source link

Adding Curve Optimizer with RyzenAdj #84

Open alanoo81 opened 1 year ago

alanoo81 commented 1 year ago

Please confirm

Describe what you'd like to be able to do

Curve Optimizer works great on my Deck in Windows.

As it looks like PowerTools is using RyzenAdj too, is there a possibility to add the --set-coall option (there's also options for iGPU curve optimizer with --set-cogfx) Would help a lot with performance and thermals, and works better than undervolting with Smokeless EFI

Describe alternatives you've considered

Was looking at compiling Ryzenadj myself, but checking if Powertools is using it, I found out it was, so why not asking ?

Anything else?

No response

NGnius commented 1 year ago

If this were added, I'd probably want to add a UI to set each clock in the curve manually along with a button or something that does an automatic optimization of all clocks. From discussions I've seen, undervolting and this sort of thing usually only results in a few % improvement, so I'm weary that it's not worth the effort.

Worth noting: PowerTools does use RyzenAdj, but not for the Steam Deck.

alanoo81 commented 1 year ago

Afaik you can't edit manually the full curve, you just pass a value, so just a slider would work, as there is already in your UI.

Next upgrade would be making it available per core, but I think it's overkill for the SD, as these should easily max out a -30 slider (most official CO optimisation apps/bios use -30 as max value). At low TDP it used to give quite a few % improvement, although I agree that I can't find any result for 15W CPUs. It's more effective than undervolting as it's smarter in its implementation (basically it's not a "flat" -30mV, but it's a value that ramps differently with frequency and boost, optimized by AMD)

NGnius commented 1 year ago

I looked into this a bit more, and it seems like set_coall/per aren't supported with Van Gogh -- they'll just return an unsupported error. I'm not against adding it for other systems, but since I've heard absolutely nothing about using PowerTools on other devices despite support existing, I have no interest in working on this change.

In case someone else wants to add this, here are some things to consider:

alanoo81 commented 1 year ago

Thanks for looking into that.

What is sure is that it works in @JamesCJ60 ´s UXTU in Windows on my Dual boot steamdeck. James also said in an issue that SteamDeck’s APU is supported in his UXTU, not sure if he uses a custom version of Ryzenadj as he contributes in the project too ? Maybe he could advise and help ?

You’re also right that it could introduce instability, even if it’s somewhat (much) safer that the EFI undervolt considering how Smokeless UMAF gives access to real dangerous settings.

edit : sorry for the wrong closed / reopen issue click… my bad… big fingers on small screen

numerant commented 1 year ago

As for Van Gogh not being supported, I've tested JamesCJ60's fork of RyzenAdj which adds Curve Optimizer support for this APU and I can confirm that it works. It's just a matter of setting CO offset the same way as on Rembrandt.

JamesCJ60 commented 1 year ago

Providing no issues are found, my changes should be merged into RyzenAdj soon, but for the time being, just use my fork for RyzenAdj. The calculation below will be from my code, so alter them to whatever language is being used here.

To set a per-core offset (--set_coper=), you use a calculation like so: (Core << 20) | (Magnitude & 0xFFFF)

So if you wanted to set -25 on only the first core, you would do (0 << 20) | (-25 & 0xFFFF)

To set all core offsets (--set_coall=): For negative offsets, you use this calculation: 0x100000 - Magnitude. So for -25, you would do 0x100000 - 25. For positive offsets, you send the RyzenAdj command just the magnitude.

Some APUs will be limited to +/-30, and some won't have limits on the max/minimum Curve Optimiser offset.

You will also need to reapply the Curve Optimiser offsets when unplugging and plugging from/into the wall.

NGnius commented 1 year ago

Came across a nice way to do it specifically for Steam Deck: https://docs.kernel.org/5.19/gpu/amdgpu/thermal.html#pp-od-clk-voltage

This is nice because you can set each voltage individually and it uses power_dpm_force_performance_level stuff, which the Steam Deck component drivers already use. Also nice because PowerTools can continue to not rely on RyzenAdj for Steam Deck.

JamesCJ60 commented 1 year ago

Came across a nice way to do it specifically for Steam Deck: https://docs.kernel.org/5.19/gpu/amdgpu/thermal.html#pp-od-clk-voltage

This is nice because you can set each voltage individually and it uses power_dpm_force_performance_level stuff, which the Steam Deck component drivers already use. Also nice because PowerTools can continue to not rely on RyzenAdj for Steam Deck.

What you have found only works with the iGPU on VanGogh and does not work like Curve Optimiser. What’s been requested here is specifically for the CPU.

NGnius commented 1 year ago

Yes sorry I should've said "nice way to do [some of] it specifically for Steam Deck". I got a bit too excited because it was more like what I wanted than what anything else could do.

phush0 commented 1 year ago

change is already merged in RyzenAdj