[SWDEV-488276/SWDEV-497613] Update memory partition set functionality

Changes:
  - [CLI] Added warning screen to AMD SMI users
    setting memory partition
  - [CLI] Added a progress bar time-bar for CLI sets display to 40 seconds
  - [API] Updated to wait until the driver reloads with SYSFS files active
  - [CLI] Now users can set or reset without providing:
    amd-smi set -g all <set arguments>
    or amd-smi reset -g all <set arguments>
    now can directly call -> sudo amd-smi set <set arguments>
    or sudo amd-smi reset <set arguments>
  - [SWDEV-475712][CLI/API] Fixed target_graphics_version field
    not properly displaying for older MI or Navi ASICs.
  - [All APIs] Added a catch for the driver to report invalid arguments
    now these APIs will show AMDSMI_STATUS_INVAL
    (ex. changing to NPS8 if the device does not support it)
  - [Install] Modified paths for Python install commands to support
    multi-ROCm installs

Change-Id: Id11f25d68a82d23c6b2d77ccb30b51e860dd0ca7
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
This commit is contained in:
Charis Poag
2024-11-08 17:31:25 -06:00
parent 19cc4718c0
commit 3ea4a42a6e
24 changed files with 1711 additions and 726 deletions
+1
View File
@@ -88,6 +88,7 @@ class AmdSmiLibraryException(AmdSmiException):
amdsmi_wrapper.AMDSMI_STATUS_FILE_NOT_FOUND : "AMDSMI_STATUS_FILE_NOT_FOUND - File or directory not found",
amdsmi_wrapper.AMDSMI_STATUS_ARG_PTR_NULL : "AMDSMI_STATUS_ARG_PTR_NULL - Parsed argument is invalid",
amdsmi_wrapper.AMDSMI_STATUS_MAP_ERROR : "AMDSMI_STATUS_MAP_ERROR - The internal library error did not map to a status code",
amdsmi_wrapper.AMDSMI_STATUS_AMDGPU_RESTART_ERR: "AMDSMI_STATUS_AMDGPU_RESTART_ERR - AMDGPU restart failed, please check dmsg for errors",
amdsmi_wrapper.AMDSMI_STATUS_UNKNOWN_ERROR : "AMDSMI_STATUS_UNKNOWN_ERROR - An unknown error occurred"
}
+7 -2
View File
@@ -1653,8 +1653,13 @@ def amdsmi_get_gpu_asic_info(
processor_handle, ctypes.byref(asic_info_struct))
)
market_name = _pad_hex_value(asic_info_struct.market_name.decode("utf-8"), 4)
target_graphics_version = str(asic_info_struct.target_graphics_version)
if len(target_graphics_version) == 4 and ("Instinct MI2" in market_name):
hex_part = str(hex(int(str(asic_info_struct.target_graphics_version)[2:]))).replace("0x", "")
target_graphics_version = str(asic_info_struct.target_graphics_version)[:2] + hex_part
asic_info = {
"market_name": _pad_hex_value(asic_info_struct.market_name.decode("utf-8"), 4),
"market_name": market_name,
"vendor_id": asic_info_struct.vendor_id,
"vendor_name": asic_info_struct.vendor_name.decode("utf-8"),
"subvendor_id": asic_info_struct.subvendor_id,
@@ -1663,7 +1668,7 @@ def amdsmi_get_gpu_asic_info(
"asic_serial": asic_info_struct.asic_serial.decode("utf-8"),
"oam_id": asic_info_struct.oam_id,
"num_compute_units": asic_info_struct.num_of_compute_units,
"target_graphics_version": "gfx" + str(asic_info_struct.target_graphics_version)
"target_graphics_version": "gfx" + target_graphics_version
}
string_values = ["market_name", "vendor_name"]
+2 -2
View File
@@ -987,12 +987,12 @@ struct_amdsmi_accelerator_partition_profile_t._pack_ = 1 # source:False
struct_amdsmi_accelerator_partition_profile_t._fields_ = [
('profile_type', amdsmi_accelerator_partition_type_t),
('num_partitions', ctypes.c_uint32),
('profile_index', ctypes.c_uint32),
('memory_caps', amdsmi_nps_caps_t),
('profile_index', ctypes.c_uint32),
('num_resources', ctypes.c_uint32),
('resources', ctypes.c_uint32 * 32 * 8),
('PADDING_0', ctypes.c_ubyte * 4),
('reserved', ctypes.c_uint64 * 6),
('reserved', ctypes.c_uint64 * 13),
]
amdsmi_accelerator_partition_profile_t = struct_amdsmi_accelerator_partition_profile_t