<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=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><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:DengXian;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@DengXian";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* 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.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></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 Alex,<o:p></o:p></p>
<p class="MsoNormal">We have confirmed that the performance on Vega20 in the compute mode is expected and doesn’t need the similar change.<o:p></o:p></p>
<p class="MsoNormal">This is because that  by default on Vega20 all the deep sleep features are disabled, and ulv feature doesn’t involve reducing mclk in Vega20
<o:p></o:p></p>
<p class="MsoNormal">while it does in Vega10. <o:p></o:p></p>
<p class="MsoNormal">We then need this change on MI100/MI200 since these deep sleep features are enabled by default.<o:p></o:p></p>
<p class="MsoNormal">Thanks.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Deucher, Alexander <Alexander.Deucher@amd.com> <br>
<b>Sent:</b> Friday, November 8, 2019 10:45 PM<br>
<b>To:</b> Feng, Kenneth <Kenneth.Feng@amd.com>; amd-gfx@lists.freedesktop.org<br>
<b>Subject:</b> Re: [PATCH v2] drm/amd/powerplay: dynamically disable ds and ulv for compute<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Do we need something similar for vega20?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12.0pt;color:black">Alex<o:p></o:p></span></p>
</div>
<div class="MsoNormal" align="center" style="text-align:center">
<hr size="2" width="98%" align="center">
</div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><span style="color:black">From:</span></b><span style="color:black"> amd-gfx <<a href="mailto:amd-gfx-bounces@lists.freedesktop.org">amd-gfx-bounces@lists.freedesktop.org</a>> on behalf of Kenneth Feng <<a href="mailto:kenneth.feng@amd.com">kenneth.feng@amd.com</a>><br>
<b>Sent:</b> Friday, November 8, 2019 12:42 AM<br>
<b>To:</b> <a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a> <<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a>><br>
<b>Cc:</b> Feng, Kenneth <<a href="mailto:Kenneth.Feng@amd.com">Kenneth.Feng@amd.com</a>><br>
<b>Subject:</b> [PATCH v2] drm/amd/powerplay: dynamically disable ds and ulv for compute</span>
<o:p></o:p></p>
<div>
<p class="MsoNormal"> <o:p></o:p></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal">This is to improve the performance in the compute mode<br>
for vega10. For example, the original performance for a rocm<br>
bandwidth test: 2G internal GPU copy, is about 99GB/s.<br>
With the idle power features disabled dynamically, the porformance<br>
is promoted to about 215GB/s.<br>
<br>
Signed-off-by: Kenneth Feng <<a href="mailto:kenneth.feng@amd.com">kenneth.feng@amd.com</a>><br>
---<br>
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c      |  7 +++<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 55 ++++++++++++++++++++++<br>
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h          |  2 +<br>
 3 files changed, 64 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c<br>
index 0314476..bd35f65 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c<br>
@@ -969,6 +969,13 @@ static int pp_dpm_switch_power_profile(void *handle,<br>
                 workload = hwmgr->workload_setting[index];<br>
         }<br>
 <br>
+       if (type == PP_SMC_POWER_PROFILE_COMPUTE &&<br>
+               hwmgr->hwmgr_func->disable_power_features_for_compute_performance)<br>
+                       if (hwmgr->hwmgr_func->disable_power_features_for_compute_performance(hwmgr, en)) {<br>
+                               mutex_unlock(&hwmgr->smu_lock);<br>
+                               return -EINVAL;<br>
+                       }<br>
+<br>
         if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL)<br>
                 hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, &workload, 0);<br>
         mutex_unlock(&hwmgr->smu_lock);<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
index 4ea63a2..d3229c2 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c<br>
@@ -5263,6 +5263,59 @@ static int vega10_get_performance_level(struct pp_hwmgr *hwmgr, const struct pp_<br>
         return 0;<br>
 }<br>
 <br>
+static int vega10_disable_power_features_for_compute_performance(struct pp_hwmgr *hwmgr, bool disable)<br>
+{<br>
+       struct vega10_hwmgr *data = hwmgr->backend;<br>
+       uint32_t feature_mask = 0;<br>
+<br>
+       if (disable) {<br>
+               feature_mask |= data->smu_features[GNLD_ULV].enabled ?<br>
+                       data->smu_features[GNLD_ULV].smu_feature_bitmap : 0;<br>
+               feature_mask |= data->smu_features[GNLD_DS_GFXCLK].enabled ?<br>
+                       data->smu_features[GNLD_DS_GFXCLK].smu_feature_bitmap : 0;<br>
+               feature_mask |= data->smu_features[GNLD_DS_SOCCLK].enabled ?<br>
+                       data->smu_features[GNLD_DS_SOCCLK].smu_feature_bitmap : 0;<br>
+               feature_mask |= data->smu_features[GNLD_DS_LCLK].enabled ?<br>
+                       data->smu_features[GNLD_DS_LCLK].smu_feature_bitmap : 0;<br>
+               feature_mask |= data->smu_features[GNLD_DS_DCEFCLK].enabled ?<br>
+                       data->smu_features[GNLD_DS_DCEFCLK].smu_feature_bitmap : 0;<br>
+       } else {<br>
+               feature_mask |= (!data->smu_features[GNLD_ULV].enabled) ?<br>
+                       data->smu_features[GNLD_ULV].smu_feature_bitmap : 0;<br>
+               feature_mask |= (!data->smu_features[GNLD_DS_GFXCLK].enabled) ?<br>
+                       data->smu_features[GNLD_DS_GFXCLK].smu_feature_bitmap : 0;<br>
+               feature_mask |= (!data->smu_features[GNLD_DS_SOCCLK].enabled) ?<br>
+                       data->smu_features[GNLD_DS_SOCCLK].smu_feature_bitmap : 0;<br>
+               feature_mask |= (!data->smu_features[GNLD_DS_LCLK].enabled) ?<br>
+                       data->smu_features[GNLD_DS_LCLK].smu_feature_bitmap : 0;<br>
+               feature_mask |= (!data->smu_features[GNLD_DS_DCEFCLK].enabled) ?<br>
+                       data->smu_features[GNLD_DS_DCEFCLK].smu_feature_bitmap : 0;<br>
+       }<br>
+<br>
+       if (feature_mask)<br>
+               PP_ASSERT_WITH_CODE(!vega10_enable_smc_features(hwmgr,<br>
+                               !disable, feature_mask),<br>
+                               "enable/disable power features for compute performance Failed!",<br>
+                               return -EINVAL);<br>
+<br>
+       if (disable) {<br>
+               data->smu_features[GNLD_ULV].enabled = false;<br>
+               data->smu_features[GNLD_DS_GFXCLK].enabled = false;<br>
+               data->smu_features[GNLD_DS_SOCCLK].enabled = false;<br>
+               data->smu_features[GNLD_DS_LCLK].enabled = false;<br>
+               data->smu_features[GNLD_DS_DCEFCLK].enabled = false;<br>
+       } else {<br>
+               data->smu_features[GNLD_ULV].enabled = true;<br>
+               data->smu_features[GNLD_DS_GFXCLK].enabled = true;<br>
+               data->smu_features[GNLD_DS_SOCCLK].enabled = true;<br>
+               data->smu_features[GNLD_DS_LCLK].enabled = true;<br>
+               data->smu_features[GNLD_DS_DCEFCLK].enabled = true;<br>
+       }<br>
+<br>
+       return 0;<br>
+<br>
+}<br>
+<br>
 static const struct pp_hwmgr_func vega10_hwmgr_funcs = {<br>
         .backend_init = vega10_hwmgr_backend_init,<br>
         .backend_fini = vega10_hwmgr_backend_fini,<br>
@@ -5330,6 +5383,8 @@ static const struct pp_hwmgr_func vega10_hwmgr_funcs = {<br>
         .get_ppfeature_status = vega10_get_ppfeature_status,<br>
         .set_ppfeature_status = vega10_set_ppfeature_status,<br>
         .set_mp1_state = vega10_set_mp1_state,<br>
+       .disable_power_features_for_compute_performance =<br>
+                       vega10_disable_power_features_for_compute_performance,<br>
 };<br>
 <br>
 int vega10_hwmgr_init(struct pp_hwmgr *hwmgr)<br>
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h<br>
index 40403bc..af97767 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h<br>
+++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h<br>
@@ -357,6 +357,8 @@ struct pp_hwmgr_func {<br>
         int (*smu_i2c_bus_access)(struct pp_hwmgr *hwmgr, bool aquire);<br>
         int (*set_df_cstate)(struct pp_hwmgr *hwmgr, enum pp_df_cstate state);<br>
         int (*set_xgmi_pstate)(struct pp_hwmgr *hwmgr, uint32_t pstate);<br>
+       int (*disable_power_features_for_compute_performance)(struct pp_hwmgr *hwmgr,<br>
+                                       bool disable);<br>
 };<br>
 <br>
 struct pp_table_func {<br>
-- <br>
2.7.4<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
<a href="mailto:amd-gfx@lists.freedesktop.org">amd-gfx@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>