Added support for configuring PPT1 power cap
- Updated python integration test to account for PPT1 support changes - Updated set/reset power-cap input format - Adjusted python API and updated C++ API test Signed-off-by: gabrpham_amdeng <Gabriel.Pham@amd.com> Change-Id: Ia9d02868b6e91c88c10a9772d9e2d9f37c3c352f
This commit is contained in:
committed by
Arif, Maisam
parent
4dfe74eb72
commit
18faddf6f3
+28
-10
@@ -288,6 +288,30 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
return AMDSMIFreqArgs
|
||||
|
||||
|
||||
def _power_cap_options(self):
|
||||
"""Custom action for setting power cap options"""
|
||||
output_format = self.helpers.get_output_format()
|
||||
|
||||
class AMDSMIPowerCapArgs(argparse.Action):
|
||||
def __call__(self, parser: AMDSMIParser, namespace: argparse.Namespace,
|
||||
values: list, option_string: Optional[str] = None) -> None:
|
||||
if len(values) != 2:
|
||||
raise amdsmi_cli_exceptions.AmdSmiInvalidParameterException(sys.argv[1], values, output_format)
|
||||
|
||||
power_cap_type = values[0]
|
||||
power_cap_value = values[1]
|
||||
|
||||
if power_cap_type not in ['ppt0', 'ppt1']:
|
||||
raise amdsmi_cli_exceptions.AmdSmiInvalidParameterException(sys.argv[1], power_cap_type, output_format)
|
||||
|
||||
if not power_cap_value.isdigit():
|
||||
raise amdsmi_cli_exceptions.AmdSmiInvalidParameterValueException(sys.argv[1], power_cap_value, output_format)
|
||||
|
||||
power_cap_args = collections.namedtuple('power_cap_args', ['pwr_type', 'watts'])
|
||||
setattr(namespace, self.dest, power_cap_args(power_cap_type, int(power_cap_value)))
|
||||
return AMDSMIPowerCapArgs
|
||||
|
||||
|
||||
def _check_folder_path(self):
|
||||
""" Argument action validator:
|
||||
Returns a path to folder from the folder path provided.
|
||||
@@ -1235,14 +1259,8 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
xgmi_plpd_help_info = ", ".join(self.helpers.get_xgmi_plpd_policies())
|
||||
set_xgmi_plpd_help = f"Set the GPU XGMI per-link power down policy using policy id, an integer. Valid id's include:\n\t{xgmi_plpd_help_info}"
|
||||
set_clock_freq_help = "Set one or more sclk (aka gfxclk), mclk, fclk, pcie, or socclk frequency levels.\n\tUse `amd-smi static --clock` to find acceptable levels.\n\tUse `amd-smi static --bus` to find acceptable pcie levels."
|
||||
power_cap_min, power_cap_max = self.helpers.get_power_caps()
|
||||
if power_cap_max != "N/A":
|
||||
power_cap_max = self.helpers.convert_SI_unit(power_cap_max, AMDSMIHelpers.SI_Unit.MICRO)
|
||||
power_cap_max = str(power_cap_max) + ' W'
|
||||
if power_cap_min != "N/A":
|
||||
power_cap_min = self.helpers.convert_SI_unit(power_cap_min, AMDSMIHelpers.SI_Unit.MICRO)
|
||||
power_cap_min = str(power_cap_min) + ' W'
|
||||
set_power_cap_help = f"Set power capacity limit:\n\tmin cap: {power_cap_min}, max cap: {power_cap_max}"
|
||||
ppt0_power_cap_min, ppt0_power_cap_max, ppt1_power_cap_min, ppt1_power_cap_max = self.helpers.get_power_caps()
|
||||
set_power_cap_help = f"Set either PPT0 or PPT1 power capacity limit:\n\tex: amd-smi set -o ppt0 1300\n\tPPT0 min cap: {ppt0_power_cap_min}, PPT0 max cap: {ppt0_power_cap_max}\n\tPPT1 min cap: {ppt1_power_cap_min}, PPT1 max cap: {ppt1_power_cap_max}"
|
||||
set_clk_limit_help = "Sets the sclk (aka gfxclk) or mclk minimum and maximum frequencies. \n\tex: amd-smi set -L (sclk | mclk) (min | max) value"
|
||||
set_process_isolation_help = "Enable or disable the GPU process isolation on a per partition basis:\n 0 for disable and 1 for enable.\n"
|
||||
|
||||
@@ -1281,7 +1299,7 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
required=False, help=set_compute_partition_help, metavar=('TYPE/INDEX'))
|
||||
set_value_exclusive_group.add_argument('-M', '--memory-partition', action='store', choices=self.helpers.get_memory_partition_types(), type=str.upper, required=False, help=set_memory_partition_help, metavar='PARTITION')
|
||||
# Power cap is enabled on guest, maintain order
|
||||
set_value_exclusive_group.add_argument('-o', '--power-cap', action='store', type=lambda value: self._positive_int(value, '--power-cap'), required=False, help=set_power_cap_help, metavar='WATTS')
|
||||
set_value_exclusive_group.add_argument('-o', '--power-cap', action=self._power_cap_options(), nargs=2, required=False, help=set_power_cap_help, metavar=('PWR_TYPE', 'WATTS'))
|
||||
if self.helpers.is_baremetal():
|
||||
set_value_exclusive_group.add_argument('-p', '--soc-pstate', action='store', required=False, type=lambda value: self._not_negative_int(value, '--soc-pstate'), help=set_soc_pstate_help, metavar='POLICY_ID')
|
||||
set_value_exclusive_group.add_argument('-x', '--xgmi-plpd', action='store', required=False, type=lambda value: self._not_negative_int(value, '--xgmi-plpd'), help=set_xgmi_plpd_help, metavar='POLICY_ID')
|
||||
@@ -1338,7 +1356,7 @@ class AMDSMIParser(argparse.ArgumentParser):
|
||||
reset_profile_help = "Reset power profile back to default"
|
||||
reset_xgmierr_help = "Reset XGMI error counts"
|
||||
reset_perf_det_help = "Disable performance determinism"
|
||||
reset_power_cap_help = "Reset power capacity limit to max capable"
|
||||
reset_power_cap_help = "Reset the PPT0 and PPT1 power capacity limit to max capable"
|
||||
reset_gpu_clean_local_data_help = "Clean up local data in LDS/GPRs on a per partition basis"
|
||||
reset_gpu_driver_help = "Reset (reload) AMD GPU driver"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user