[SWDEV-450553] Added gpu memory overdrive to metric function

Signed-off-by: gabrpham <Gabriel.Pham@amd.com>
Change-Id: If7bd6865d641a5a83c594a4d3c57938b1b6dc18e


[ROCm/amdsmi commit: 7d8e54d0e1]
Этот коммит содержится в:
gabrpham
2024-08-29 10:21:06 -05:00
коммит произвёл Maisam Arif
родитель 53964b5b4a
Коммит 614c89889c
10 изменённых файлов: 133 добавлений и 12 удалений
+3
Просмотреть файл
@@ -13,6 +13,9 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr
- **Changed the `power` parameter in `amdsmi_get_energy_count()` to `energy_accumulator`**.
Changes propagate forwards into the python interface as well, however we are maintaing backwards compatibility and keeping the `power` field in the python API until ROCm 6.4.
- **Added GPU memory overdrive percentage to `amd-smi metric -o`**.
Added `amdsmi_get_gpu_mem_overdrive_level()` function to amd-smi C and Python Libraries.
### Removals
- N/A
+10 -9
Просмотреть файл
@@ -1851,18 +1851,19 @@ class AMDSMICommands():
if args.overdrive:
try:
overdrive_level = amdsmi_interface.amdsmi_get_gpu_overdrive_level(args.gpu)
od_unit = '%'
if self.logger.is_human_readable_format():
overdrive_level = f"{overdrive_level} {od_unit}"
if self.logger.is_json_format():
overdrive_level = {"value" : overdrive_level,
"unit" : od_unit}
values_dict['overdrive'] = overdrive_level
values_dict['overdrive'] = self.helpers.unit_format(self.logger, overdrive_level, od_unit)
except amdsmi_exception.AmdSmiLibraryException as e:
values_dict['overdrive'] = "N/A"
logging.debug("Failed to get overdrive level for gpu %s | %s", gpu_id, e.get_error_info())
logging.debug("Failed to get gpu overdrive level for gpu %s | %s", gpu_id, e.get_error_info())
try:
mem_overdrive_level = amdsmi_interface.amdsmi_get_gpu_mem_overdrive_level(args.gpu)
od_unit = '%'
values_dict['mem_overdrive'] = self.helpers.unit_format(self.logger, mem_overdrive_level, od_unit)
except amdsmi_exception.AmdSmiLibraryException as e:
values_dict['mem_overdrive'] = "N/A"
logging.debug("Failed to get mem overdrive level for gpu %s | %s", gpu_id, e.get_error_info())
if "perf_level" in current_platform_args:
if args.perf_level:
try:
+1 -1
Просмотреть файл
@@ -740,7 +740,7 @@ class AMDSMIParser(argparse.ArgumentParser):
# Help text for Arguments only on Linux Baremetal platforms
fan_help = "Current fan speed"
vc_help = "Display voltage curve"
overdrive_help = "Current GPU clock overdrive level"
overdrive_help = "Current GPU clock overdrive and GPU memory clock overdrive level"
perf_level_help = "Current DPM performance level"
xgmi_err_help = "XGMI error information since last read"
energy_help = "Amount of energy consumed"
+33 -1
Просмотреть файл
@@ -1610,7 +1610,7 @@ except AmdSmiException as e:
### amdsmi_set_gpu_od_clk_info
Description: This function sets the clock frequency information
Description: This function sets the clock frequency information.
It is not supported on virtual machine guest
Input parameters:
@@ -2156,6 +2156,38 @@ except AmdSmiException as e:
print(e)
```
### amdsmi_get_gpu_mem_overdrive_level
Description: Get the GPU memory clock overdrive percent associated with the device with provided
device handle. It is not supported on virtual machine guest
Input parameters:
* `processor_handle` handle for the given device
Output: Overdrive percentage as integer
Exceptions that can be thrown by `amdsmi_get_gpu_mem_overdrive_level` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
```python
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
od_level = amdsmi_get_gpu_mem_overdrive_level(dev)
print(od_level)
except AmdSmiException as e:
print(e)
```
### amdsmi_get_clk_freq
Description: Get the list of possible system clock speeds of device for a
+24
Просмотреть файл
@@ -2957,6 +2957,30 @@ amdsmi_set_gpu_perf_determinism_mode(amdsmi_processor_handle processor_handle, u
amdsmi_status_t amdsmi_get_gpu_overdrive_level(amdsmi_processor_handle processor_handle,
uint32_t *od);
/**
* @brief Get the GPU memory clock overdrive percent associated with the device with provided
* processor handle. It is not supported on virtual machine guest
*
* @platform{gpu_bm_linux}
*
* @details Given a processor handle @p processor_handle and a pointer to a uint32_t @p od,
* this function will write the overdrive percentage to the uint32_t pointed
* to by @p od
*
* @param[in] processor_handle a processor handle
*
* @param[in,out] od a pointer to uint32_t to which the GPU memory clock overdrive percentage
* will be written
* If this parameter is nullptr, this function will return
* ::AMDSMI_STATUS_INVAL if the function is supported with the provided,
* arguments and ::AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the
* provided arguments.
*
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
*/
amdsmi_status_t amdsmi_get_gpu_mem_overdrive_level(amdsmi_processor_handle processor_handle,
uint32_t *od);
/**
* @brief Get the list of possible system clock speeds of device for a
* specified clock type. It is not supported on virtual machine guest
+32
Просмотреть файл
@@ -2156,6 +2156,38 @@ except AmdSmiException as e:
print(e)
```
### amdsmi_get_gpu_mem_overdrive_level
Description: Get the GPU memory clock overdrive percent associated with the device with provided
device handle. It is not supported on virtual machine guest
Input parameters:
* `processor_handle` handle for the given device
Output: Overdrive percentage as integer
Exceptions that can be thrown by `amdsmi_get_gpu_mem_overdrive_level` function:
* `AmdSmiLibraryException`
* `AmdSmiRetryException`
* `AmdSmiParameterException`
Example:
```python
try:
devices = amdsmi_get_processor_handles()
if len(devices) == 0:
print("No GPUs on machine")
else:
for device in devices:
od_level = amdsmi_get_gpu_mem_overdrive_level(dev)
print(od_level)
except AmdSmiException as e:
print(e)
```
### amdsmi_get_clk_freq
Description: Get the list of possible system clock speeds of device for a
+1
Просмотреть файл
@@ -150,6 +150,7 @@ from .amdsmi_interface import amdsmi_get_gpu_volt_metric
from .amdsmi_interface import amdsmi_get_utilization_count
from .amdsmi_interface import amdsmi_get_gpu_perf_level
from .amdsmi_interface import amdsmi_get_gpu_overdrive_level
from .amdsmi_interface import amdsmi_get_gpu_mem_overdrive_level
from .amdsmi_interface import amdsmi_get_clk_freq
from .amdsmi_interface import amdsmi_get_gpu_od_volt_info
from .amdsmi_interface import amdsmi_get_gpu_metrics_info
+18
Просмотреть файл
@@ -3458,6 +3458,24 @@ def amdsmi_get_gpu_overdrive_level(
return od_level.value
def amdsmi_get_gpu_mem_overdrive_level(
processor_handle: amdsmi_wrapper.amdsmi_processor_handle,
) -> int:
if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle):
raise AmdSmiParameterException(
processor_handle, amdsmi_wrapper.amdsmi_processor_handle
)
mem_od_level = ctypes.c_uint32()
_check_res(
amdsmi_wrapper.amdsmi_get_gpu_mem_overdrive_level(
processor_handle, ctypes.byref(mem_od_level)
)
)
return mem_od_level.value
def amdsmi_get_clk_freq(
processor_handle: amdsmi_wrapper.amdsmi_processor_handle, clk_type: AmdSmiClkType
) -> Dict[str, Any]:
+5 -1
Просмотреть файл
@@ -2060,6 +2060,9 @@ amdsmi_set_gpu_perf_determinism_mode.argtypes = [amdsmi_processor_handle, uint64
amdsmi_get_gpu_overdrive_level = _libraries['libamd_smi.so'].amdsmi_get_gpu_overdrive_level
amdsmi_get_gpu_overdrive_level.restype = amdsmi_status_t
amdsmi_get_gpu_overdrive_level.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
amdsmi_get_gpu_mem_overdrive_level = _libraries['libamd_smi.so'].amdsmi_get_gpu_mem_overdrive_level
amdsmi_get_gpu_mem_overdrive_level.restype = amdsmi_status_t
amdsmi_get_gpu_mem_overdrive_level.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)]
amdsmi_get_clk_freq = _libraries['libamd_smi.so'].amdsmi_get_clk_freq
amdsmi_get_clk_freq.restype = amdsmi_status_t
amdsmi_get_clk_freq.argtypes = [amdsmi_processor_handle, amdsmi_clk_type_t, ctypes.POINTER(struct_amdsmi_frequencies_t)]
@@ -2671,7 +2674,8 @@ __all__ = \
'amdsmi_get_gpu_ecc_enabled', 'amdsmi_get_gpu_ecc_status',
'amdsmi_get_gpu_event_notification', 'amdsmi_get_gpu_fan_rpms',
'amdsmi_get_gpu_fan_speed', 'amdsmi_get_gpu_fan_speed_max',
'amdsmi_get_gpu_id', 'amdsmi_get_gpu_memory_partition',
'amdsmi_get_gpu_id', 'amdsmi_get_gpu_mem_overdrive_level',
'amdsmi_get_gpu_memory_partition',
'amdsmi_get_gpu_memory_reserved_pages',
'amdsmi_get_gpu_memory_total', 'amdsmi_get_gpu_memory_usage',
'amdsmi_get_gpu_metrics_header_info',
+6
Просмотреть файл
@@ -1506,6 +1506,12 @@ amdsmi_status_t amdsmi_get_gpu_overdrive_level(
return rsmi_wrapper(rsmi_dev_overdrive_level_get, processor_handle, od);
}
amdsmi_status_t amdsmi_get_gpu_mem_overdrive_level(
amdsmi_processor_handle processor_handle,
uint32_t *od) {
return rsmi_wrapper(rsmi_dev_mem_overdrive_level_get, processor_handle, od);
}
amdsmi_status_t amdsmi_set_gpu_overdrive_level(
amdsmi_processor_handle processor_handle, uint32_t od) {
return rsmi_wrapper(rsmi_dev_overdrive_level_set_v1, processor_handle, od);