[SWDEV-518561] Separate Driver Reload from Memory Partition Sets (#582)

Description:
  - Added a new API `amdsmi_gpu_driver_reload()` to reload the AMD GPU driver independently.
  - Updated CLI (`sudo amd-smi reset -r`) and Python bindings to support driver reload functionality.
  - Removed automatic driver reload from `amdsmi_set_gpu_memory_partition()` and `amdsmi_set_gpu_memory_partition_mode()`.
  - Enhanced CLI and test cases to allow users to control when the driver reload occurs.
  - Updated documentation and changelog to reflect the new driver reload process.
  - Improved error handling and logging for driver reload operations.
  - Added progress bar and user confirmation prompts for driver reload commands.

* Update build/test strategy to only allow one test execution at a time
* Modify API verbage + modify systemctl error output
  - Systemctl is typically not enabled on docker.
  - And is an edge case for gpu being active process/etc for display devices.
* Remove AMDSMI_STATUS_AMDGPU_RESTART_ERR from the return values
* Move driver reload to after we save original compute partitions

---------

Signed-off-by: Charis Poag <Charis.Poag@amd.com>
This commit is contained in:
Poag, Charis
2025-08-05 20:44:28 -05:00
committed by GitHub
parent abd3c02a3c
commit d24dc7ef89
16 changed files with 653 additions and 251 deletions
+24 -1
View File
@@ -2346,7 +2346,8 @@ amdsmi_set_gpu_memory_partition(amdsmi_processor_handle processor_handle,
ss << __PRETTY_FUNCTION__
<< " | After attepting to set memory partition to " << req_user_partition << "\n"
<< " | Current memory partition is " << current_partition_str << "\n"
<< " | Returning: " << smi_amdgpu_get_status_string(ret, false);
<< " | Returning: " << smi_amdgpu_get_status_string(ret, false)
<< " | User will need to reload driver in order to see a NPS mode change";
LOG_INFO(ss);
return ret;
}
@@ -2983,6 +2984,8 @@ amdsmi_get_gpu_accelerator_partition_profile(amdsmi_processor_handle processor_h
}
} else {
profile->profile_type = AMDSMI_ACCELERATOR_PARTITION_INVALID;
current_partition_str.clear();
current_partition_str = "N/A";
}
amdsmi_gpu_metrics_t metric_info = {};
@@ -3656,6 +3659,26 @@ amdsmi_status_t amdsmi_reset_gpu(amdsmi_processor_handle processor_handle) {
return ret;
}
amdsmi_status_t amdsmi_gpu_driver_reload(void) {
std::ostringstream ss;
AMDSMI_CHECK_INIT();
// Attempting to speed up processing time
bool is_logger_enabled = ROCmLogging::Logger::getInstance()->isLoggerEnabled();
if (is_logger_enabled) {
ss << __PRETTY_FUNCTION__ << " | ======= start =======";
LOG_INFO(ss);
}
rsmi_status_t ret = rsmi_dev_amdgpu_driver_reload();
amdsmi_status_t amdsmi_status = amd::smi::rsmi_to_amdsmi_status(ret);
if (is_logger_enabled) {
ss << __PRETTY_FUNCTION__
<< " | Returning: " << smi_amdgpu_get_status_string(amdsmi_status, false);
LOG_INFO(ss);
}
return amdsmi_status;
}
amdsmi_status_t amdsmi_get_gpu_busy_percent(amdsmi_processor_handle processor_handle,
uint32_t *gpu_busy_percent) {
return rsmi_wrapper(rsmi_dev_busy_percent_get, processor_handle, 0, gpu_busy_percent);