From 72009f1812cb23c72c87a40c82682576d9d727d8 Mon Sep 17 00:00:00 2001 From: "Bill(Shuzhou) Liu" Date: Wed, 28 Jun 2023 09:03:28 -0500 Subject: [PATCH 1/3] Return NOT_SUPPORTED if fail to write to sysfs Check the error and return NOT_SUPPORTED when write to sysfs. Change-Id: Idaa91816197413643552e230a483b79500d44e08 [ROCm/amdsmi commit: 145868ad720450e36c6c2648f7596bc4aa2681a5] --- projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc b/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc index 93ff80be74..e372209ef1 100755 --- a/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc +++ b/projects/amdsmi/rocm_smi/src/rocm_smi_utils.cc @@ -120,6 +120,9 @@ int WriteSysfsStr(std::string path, std::string val) { fs << val; fs.close(); + if (!fs) { + return ENOENT; // Map to NOT_SUPPORT if errors + } return ret; } From 262ef9dba13701b25bd995f01bd045fa27438972 Mon Sep 17 00:00:00 2001 From: "Bill(Shuzhou) Liu" Date: Thu, 29 Jun 2023 07:58:23 -0500 Subject: [PATCH 2/3] Fix fan write unit test failure Even if fan speed can be read, sometimes the set is not supported. Change-Id: I8584e6fe170c34144800af78d76f04234def11c8 [ROCm/amdsmi commit: 9e2fcd0e40fce27cd6e66ab2aaeb41f656cfa208] --- .../amdsmi/tests/amd_smi_test/functional/fan_read_write.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/projects/amdsmi/tests/amd_smi_test/functional/fan_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/fan_read_write.cc index 1ca1313f8d..e3d7c962ad 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/fan_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/fan_read_write.cc @@ -137,6 +137,12 @@ void TestFanReadWrite::Run(void) { } ret = amdsmi_set_gpu_fan_speed(processor_handles_[dv_ind], 0, new_speed); + + // When you can read fan speed, it is not always can set fan speed. + if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { + std::cout << "***System fan set is not supported." << std::endl; + continue; + } CHK_ERR_ASRT(ret) sleep(4); From e7552a95e1ecb3d7432cc13a060edf6f9401f74f Mon Sep 17 00:00:00 2001 From: Maisam Arif Date: Thu, 29 Jun 2023 11:13:31 -0500 Subject: [PATCH 3/3] Corrected temp_vram_limit variable reference Signed-off-by: Maisam Arif Change-Id: Ic54cc62a8ac1ea9c63b2270810d95e6589059160 [ROCm/amdsmi commit: 36671450f07ef4dd64f3c553b5c8d93302b1e12d] --- projects/amdsmi/amdsmi_cli/amdsmi_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py index f3fb36f1bc..27f2c73345 100644 --- a/projects/amdsmi/amdsmi_cli/amdsmi_commands.py +++ b/projects/amdsmi/amdsmi_cli/amdsmi_commands.py @@ -298,7 +298,7 @@ class AMDSMICommands(): temp_vram_limit = amdsmi_interface.amdsmi_get_temp_metric(args.gpu, amdsmi_interface.AmdSmiTemperatureType.VRAM, amdsmi_interface.AmdSmiTemperatureMetric.CRITICAL) except amdsmi_exception.AmdSmiLibraryException as e: - temp_junction_limit = e.get_error_info() + temp_vram_limit = e.get_error_info() if not self.all_arguments: raise e