[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>
Este cometimento está contido em:
cometido por
GitHub
ascendente
abd3c02a3c
cometimento
d24dc7ef89
@@ -588,6 +588,8 @@ int main() {
|
||||
// Since memory partition effects entire GPU hive (and modifies current
|
||||
// compute/accelerator partition), we'll default to only changing the
|
||||
// first device for the first socket (GPU #0)
|
||||
// Note: Any device can be requested to change memory partition,
|
||||
// but for simplicity, we will only change GPU #0.
|
||||
if (gpu_number == 0) {
|
||||
std::cout << " **Changing memory partition for GPU #"
|
||||
<< gpu_number << "...**\n";
|
||||
@@ -613,6 +615,20 @@ int main() {
|
||||
<< memoryPartitionString(updatePartition) << "): "
|
||||
<< err_str << "\n\n";
|
||||
|
||||
// Reload only if the memory partition was set successfully
|
||||
if (ret_set == AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "\t**Reloading GPU driver to apply memory "
|
||||
<< "partition change, this may take some time... **\n";
|
||||
amdsmi_status_t reload_status = amdsmi_gpu_driver_reload();
|
||||
amdsmi_status_code_to_string(reload_status, &err_str);
|
||||
if (reload_status == AMDSMI_STATUS_SUCCESS) {
|
||||
PRINT_AMDSMI_RET(reload_status)
|
||||
std::cout << "\tamdsmi_gpu_driver_reload(): " << err_str << "\n\n";
|
||||
} else {
|
||||
std::cout << "\tamdsmi_gpu_driver_reload(): " << err_str << "\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Get the current memory partition
|
||||
char current_memory_partition[AMDSMI_MAX_STRING_LENGTH];
|
||||
ret = amdsmi_get_gpu_memory_partition(processor_handles[device_index],
|
||||
@@ -678,6 +694,17 @@ int main() {
|
||||
std::cout << "\t**Device Index: " << device_index << std::endl;
|
||||
std::cout << "\t**Device Handle: " << processor_handles[device_index] << std::endl;
|
||||
std::cout << "\t**GPU Number: " << gpu_number << std::endl;
|
||||
// Since memory partition effects entire GPU hive (and modifies current
|
||||
// compute/accelerator partition), we'll default to only changing the
|
||||
// first device for the first socket (GPU #0)
|
||||
// Note: Any device can be requested to change memory partition,
|
||||
// but for simplicity, we will only change GPU #0.
|
||||
if (gpu_number != 0) {
|
||||
std::cout << " **Skipping memory partition reset for GPU #"
|
||||
<< gpu_number << "...**\n";
|
||||
gpu_number++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Reset to original memory partition settings
|
||||
amdsmi_memory_partition_type_t orig_partition =
|
||||
@@ -693,6 +720,19 @@ int main() {
|
||||
std::cout << "\tamdsmi_set_gpu_memory_partition(" << gpu_number << ", "
|
||||
<< memoryPartitionString(orig_partition) << "): "
|
||||
<< err_str << "\n\n";
|
||||
// Reload only if the memory partition was set successfully
|
||||
if (ret_set == AMDSMI_STATUS_SUCCESS) {
|
||||
std::cout << "\t**Reloading GPU driver to apply memory "
|
||||
<< "partition change, this may take some time... **\n";
|
||||
amdsmi_status_t reload_status = amdsmi_gpu_driver_reload();
|
||||
amdsmi_status_code_to_string(reload_status, &err_str);
|
||||
if (reload_status == AMDSMI_STATUS_SUCCESS) {
|
||||
PRINT_AMDSMI_RET(reload_status)
|
||||
std::cout << "\tamdsmi_gpu_driver_reload(): " << err_str << "\n\n";
|
||||
} else {
|
||||
std::cout << "\tamdsmi_gpu_driver_reload(): " << err_str << "\n\n";
|
||||
}
|
||||
}
|
||||
// Get the current memory partition
|
||||
char current_memory_partition[AMDSMI_MAX_STRING_LENGTH];
|
||||
ret = amdsmi_get_gpu_memory_partition(processor_handles[device_index],
|
||||
|
||||
Criar uma nova questão referindo esta
Bloquear um utilizador