Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Adding Curve Optimizer with RyzenAdj #84

Open
3 tasks done
alanoo81 opened this issue Mar 22, 2023 · 10 comments
Open
3 tasks done

Adding Curve Optimizer with RyzenAdj #84

alanoo81 opened this issue Mar 22, 2023 · 10 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@alanoo81
Copy link

Please confirm

  • I have searched existing issues
  • This issue is not a duplicate of an existing one
  • I will fill this out to the best of my ability

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

@alanoo81 alanoo81 added the enhancement New feature or request label Mar 22, 2023
@NGnius
Copy link
Owner

NGnius commented Mar 22, 2023

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
Copy link
Author

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
Copy link
Owner

NGnius commented Mar 22, 2023

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:

  • This also seems to change voltage, which could introduce instability which I'm very much against adding to PowerTools. The only way this could be alright is by hiding it until it's enabled manually in a file (maybe by adding/setting a field in pt_limits.json).
  • What benefit does this have over a EFI undervolt? What drawbacks does this have?
  • Does this introduce incompatibilities with other undervolting methods?

@NGnius NGnius added the help wanted Extra attention is needed label Mar 22, 2023
@alanoo81
Copy link
Author

alanoo81 commented Mar 22, 2023

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

@alanoo81 alanoo81 reopened this Mar 22, 2023
@numerant
Copy link

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
Copy link

JamesCJ60 commented Mar 24, 2023

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
Copy link
Owner

NGnius commented Mar 28, 2023

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
Copy link

JamesCJ60 commented Mar 28, 2023

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
Copy link
Owner

NGnius commented Mar 28, 2023

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
Copy link

phush0 commented May 15, 2023

change is already merged in RyzenAdj

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants