Limit gpu max clock for ryzen 2400g

Russell, Kent Kent.Russell at amd.com
Tue Mar 26 12:57:12 UTC 2019


Hi Lauri,

There’s a more efficient method using the Power Profiles (and optionally, the ROCM-SMI tool, found at https://github.com/RadeonOpenCompute/ROC-smi), or the pp_sclk mask, depending on what exactly you want. I’ll list out the methods here and the rocm-smi and non-SMI commands to do it. I’ll assume that this GPU is card0 (it may be card1, card2, etc, depending on what GPUs are installed on your system; “rocm-smi -i” or “cat /sys/class/drm/card?/device/device will give you the GPU IDs of all of the cards, then you can figure out which one you want to use)


  1.  Mask the SCLKs . pp_dpm_sclk allows you to set a mask of what levels to use.
     *   First, read the values (“rocm-smi --showclkfrq” , or “cat /sys/class/drm/card0/device/pp_dpm_sclk”) and see the supported DPM levels for your card.
     *   Mask off the levels that you don’t want. E.g. If you only want to use levels 0-6 (and thus skip level 7), you can do either ‘rocm-smi --setsclk 0 1 2 3 4 5 6’ or ‘echo manual > /sys/class/drm/card0/device/power_dpm_force_performance_level && echo “0 1 2 3 4 5 6” > /sys/class/drm/card0/device/pp_dpm_sclk’ . This will set DPM to only use levels 0-6 and skip level 7. You can do this for any combination of levels or a single level (“0 2 5”, “1 2 7”, “5”, etc). That will tell it to only use the specified DPM levels and will persist until reboot, or until the power_dpm_force_performance is set back to ‘auto’ .
  2.  Set the specific DPM level values manually:
     *   First, you’ll need to enable the Power Profile Overdrive functionality. The easiest way is to add “amdgpu.ppfeaturemask=0xffffffff” to your linux command line parameters (by editing /boot/grub/grub.cfg manually, editing /etc/default/grub and doing an update-grub, or manually entering the kernel parameter in the GRUB menu before booting).
     *   Once that’s enabled, you should see the following file: /sys/class/drm/card0/device/pp_od_clk_voltage.
     *   Check the current DPM level information with “rocm-smi -S” or “cat /sys/class/drm/card0/device/pp_od_clk_voltage file” . Now that we have that, you can see the supported SCLK and voltages for each level.
     *   You can use the rocm-smi tool to manually change the levels through “rocm-smi --setslevel # MHZ VLT”, where:

                                                               i.       # is the level (level 7 is probably the one you want, but you can do it for all of them)

                                                             ii.      MHZ is the speed in MHz

                                                           iii.      VLT is the voltage in mV.

     *   Honestly, you can probably just copy the highest level that you’re comfortable with and set that for all of the levels that exceed the values that you desire. So if you want to keep it to whatever level 6 is, just set level 7 to have the same values as level 6 (that way you don’t have to muck with voltages and such). Or if 5 is the highest that you want, set level 6 and level 7 to match level 5

Hopefully that helps. It also means that you don’t have to constantly try to build your own kernel with a change to cap the SCLK cherry-picked on tpo. Please let me know if you have any questions at all!

Kent

From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Lauri Ehrenpreis
Sent: Friday, March 22, 2019 6:18 AM
To: amd-gfx list <amd-gfx at lists.freedesktop.org>
Subject: Limit gpu max clock for ryzen 2400g

Hi!

Is there a way how to limit gpu max clock rate? Currently I can either leave the clock to automatic mode or force it to specific level via /sys/class/drm/card0/device/pp_dpm_sclk. But ideally I would like the clock to be automatically regulated but specify a different upper limit for power saving reasons.

--
Lauri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20190326/5de79e5f/attachment.html>


More information about the amd-gfx mailing list