Adding Curve Optimizer with RyzenAdj #84

Open
opened 2023-03-22 09:49:20 +00:00 by alanoo81 · 10 comments
alanoo81 commented 2023-03-22 09:49:20 +00:00 (Migrated from github.com)

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

### Please confirm - [X] I have searched existing issues - [X] This issue is not a duplicate of an existing one - [X] 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_
NGnius commented 2023-03-22 12:06:26 +00:00 (Migrated from github.com)

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.

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 2023-03-22 12:18:20 +00:00 (Migrated from github.com)

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)

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 2023-03-22 20:33:02 +00:00 (Migrated from github.com)

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?
I looked into this a bit more, and it seems like [set_coall/per aren't supported with Van Gogh](https://github.com/FlyGoat/RyzenAdj/blob/master/lib/api.c#L1142) -- 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?
alanoo81 commented 2023-03-22 21:21:08 +00:00 (Migrated from github.com)

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

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 2023-03-24 12:10:55 +00:00 (Migrated from github.com)

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.

As for Van Gogh not being supported, I've tested [JamesCJ60's fork of RyzenAdj](https://github.com/JamesCJ60/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 2023-03-24 12:40:34 +00:00 (Migrated from github.com)

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.

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 2023-03-28 01:22:24 +01:00 (Migrated from github.com)

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.

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 2023-03-28 13:17:15 +01:00 (Migrated from github.com)

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.

> 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 2023-03-28 21:22:15 +01:00 (Migrated from github.com)

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.

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 2023-05-15 09:01:30 +01:00 (Migrated from github.com)

change is already merged in RyzenAdj

change is already merged in RyzenAdj
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: NG-SD-Plugins/PowerTools#84
No description provided.