Adjust amdgpu version output for amd-smi (#2563)

* Fix the amdgpu version string comparison

The intention behind it was to avoid showing the string if it's not
got information.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>

* Display the kernel version in amd-smi output

This is an interesting debugging point, especially in the case of
not having a DKMS package installed.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>

* Moving os_kernel_version to static --driver

Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>

---------

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Maisam Arif <Maisam.Arif@amd.com>
Co-authored-by: Maisam Arif <Maisam.Arif@amd.com>
This commit is contained in:
Mario Limonciello
2026-01-15 13:11:58 -06:00
committed by GitHub
szülő fe60c39256
commit 838b3dccf1
4 fájl változott, egészen pontosan 20 új sor hozzáadva és 4 régi sor törölve
+3 -2
Fájl megtekintése
@@ -4,11 +4,12 @@ Full documentation for amd_smi_lib is available at [https://rocm.docs.amd.com/pr
***All information listed below is for reference and subject to change.***
## amd_smi_lib for ROCm 7.3.0
## amd_smi_lib for ROCm 7.11.0
### Added
- N/A
- **Added `os_kernel_version` to `amd-smi static --driver` output and default output**.
- Displays the Linux kernel version from `os.uname().release`.
### Changed
@@ -799,7 +799,8 @@ class AMDSMICommands():
static_dict['limit'] = limit_info
if args.driver:
driver_info_dict = {"name" : "N/A",
"version" : "N/A"}
"version" : "N/A",
"os_kernel_version" : "N/A"}
try:
driver_info = amdsmi_interface.amdsmi_get_gpu_driver_info(args.gpu)
@@ -808,6 +809,11 @@ class AMDSMICommands():
except amdsmi_exception.AmdSmiLibraryException as e:
logging.debug("Failed to get driver info for gpu %s | %s", gpu_id, e.get_error_info())
try:
driver_info_dict["os_kernel_version"] = os.uname().release
except (AttributeError, OSError) as e:
logging.debug("Failed to get os kernel version for gpu %s | %s", gpu_id, e)
static_dict['driver'] = driver_info_dict
if args.board:
static_dict['board'] = {"model_number": "N/A",
@@ -7517,10 +7523,12 @@ class AMDSMICommands():
processors = amdsmi_interface.amdsmi_get_processor_handles()
version_info = {"amd-smi": "N/A",
"amdgpu version": "N/A",
"kernel version": "N/A",
"fw pldm version": "N/A",
"vbios version": "N/A",
"rocm version": (False, "N/A")}
version_info['rocm version'] = amdsmi_interface.amdsmi_get_rocm_version()
version_info['kernel version'] = os.uname().release
try:
version_info["amdgpu version"] = amdsmi_interface.amdsmi_get_gpu_driver_info(processors[0])
except amdsmi_exception.AmdSmiLibraryException as e:
@@ -1036,13 +1036,19 @@ class AMDSMILogger():
amdgpu_version = str(driver_version['driver_version'])[:80]
fw_pldm_version = str(output['version_info']['fw pldm version'])
vbios_version = str(output['version_info']['vbios version'])
kernel_version = str(output['version_info']['kernel version'])
# print GPU info
print(default_line_1)
# Split the version line into 3 lines, each wrapping to the same width
print("| AMD-SMI {0:40s} {1:19s}|".format(amd_smi_version.ljust(40), ""))
if amdgpu_version != "N/A":
# Print amdgpu or kernel version based on availability, if neither then don't print
if amdgpu_version.strip() != "N/A":
print("| amdgpu Version: {0:40s} {1:19s}|".format(amdgpu_version, ""))
elif kernel_version.strip() != "N/A":
print("| OS kernel Version: {0:40s} {1:19s}|".format(kernel_version, ""))
if rocm_version != "N/A":
print("| ROCm Version: {0:40s} {1:19s}|".format(rocm_version, ""))
@@ -3086,6 +3086,7 @@ def amdsmi_get_gpu_driver_info(
)
)
# Not including os_kernel_version here due to it just being os.uname().release
driver_info = {
"driver_name": info.driver_name.decode("utf-8"),
"driver_version": info.driver_version.decode("utf-8"),