<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1064455307;
mso-list-type:hybrid;
mso-list-template-ids:-2112867404 67698705 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l0:level1
{mso-level-text:"%1\)";
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l0:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l0:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hi Lauri,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">There’s a more efficient method using the Power Profiles (and optionally, the ROCM-SMI tool, found at
<a href="https://github.com/RadeonOpenCompute/ROC-smi">https://github.com/RadeonOpenCompute/ROC-smi</a>), 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)<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<ol style="margin-top:0in" start="1" type="1">
<li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level1 lfo1">Mask the SCLKs . pp_dpm_sclk allows you to set a mask of what levels to use.
<o:p></o:p></li><ol style="margin-top:0in" start="1" type="a">
<li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level2 lfo1">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.
<o:p></o:p></li><li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level2 lfo1">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’ .<o:p></o:p></li></ol>
<li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level1 lfo1">Set the specific DPM level values manually:<o:p></o:p></li><ol style="margin-top:0in" start="1" type="a">
<li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level2 lfo1">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).<o:p></o:p></li><li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level2 lfo1">Once that’s enabled, you should see the following file: /sys/class/drm/card0/device/pp_od_clk_voltage.<o:p></o:p></li><li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level2 lfo1">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. <o:p></o:p></li><li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level2 lfo1">You can use the rocm-smi tool to manually change the levels through “rocm-smi --setslevel # MHZ VLT”, where:<o:p></o:p></li></ol>
</ol>
<p class="MsoListParagraph" style="margin-left:1.5in;text-indent:-1.5in;mso-text-indent-alt:-9.0pt;mso-list:l0 level3 lfo1">
<![if !supportLists]><span style="mso-list:Ignore"><span style="font:7.0pt "Times New Roman"">
</span>i.<span style="font:7.0pt "Times New Roman""> </span></span><![endif]> # is the level (level 7 is probably the one you want, but you can do it for all of them)<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.5in;text-indent:-1.5in;mso-text-indent-alt:-9.0pt;mso-list:l0 level3 lfo1">
<![if !supportLists]><span style="mso-list:Ignore"><span style="font:7.0pt "Times New Roman"">
</span>ii.<span style="font:7.0pt "Times New Roman""> </span></span><![endif]>MHZ is the speed in MHz<o:p></o:p></p>
<p class="MsoListParagraph" style="margin-left:1.5in;text-indent:-1.5in;mso-text-indent-alt:-9.0pt;mso-list:l0 level3 lfo1">
<![if !supportLists]><span style="mso-list:Ignore"><span style="font:7.0pt "Times New Roman"">
</span>iii.<span style="font:7.0pt "Times New Roman""> </span></span><![endif]>VLT is the voltage in mV.
<o:p></o:p></p>
<ol style="margin-top:0in" start="2" type="1">
<ol style="margin-top:0in" start="5" type="a">
<li class="MsoListParagraph" style="margin-left:0in;mso-list:l0 level2 lfo1">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<o:p></o:p></li></ol>
</ol>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">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!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Kent<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org>
<b>On Behalf Of </b>Lauri Ehrenpreis<br>
<b>Sent:</b> Friday, March 22, 2019 6:18 AM<br>
<b>To:</b> amd-gfx list <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> Limit gpu max clock for ryzen 2400g<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">Hi!<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">--<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Lauri<o:p></o:p></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>