<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Do we need something similar for vega20?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Alex<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Kenneth Feng <kenneth.feng@amd.com><br>
<b>Sent:</b> Friday, November 8, 2019 12:42 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Feng, Kenneth <Kenneth.Feng@amd.com><br>
<b>Subject:</b> [PATCH v2] drm/amd/powerplay: dynamically disable ds and ulv for compute</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">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 <kenneth.feng@amd.com><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>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
</span></font></div>
</body>
</html>