From 56aa8059f8e44463a0caf1aed98e9c53b4e14f86 Mon Sep 17 00:00:00 2001 From: Suma Hegde Date: Sun, 26 Feb 2023 20:54:22 -0500 Subject: [PATCH] Renamed API amdsmi_dev_get_gpu_clk_freq It is renamed to amdsmi_get_clk_freq grep -rli 'amdsmi_dev_get_gpu_clk_freq' * | xargs -i@ sed -i 's/amdsmi_dev_get_gpu_clk_freq/amdsmi_get_clk_freq/g' @ Change-Id: Ia12dd1282ab501f17667cf9f1f9b7284c2648198 --- include/amd_smi/amdsmi.h | 6 +++--- py-interface/README.md | 6 +++--- py-interface/__init__.py | 2 +- py-interface/amdsmi_interface.py | 4 ++-- py-interface/amdsmi_wrapper.py | 8 ++++---- py-interface/rocm_smi_tool.py | 4 ++-- src/amd_smi/amd_smi.cc | 4 ++-- tests/amd_smi_test/functional/frequencies_read.cc | 6 +++--- tests/amd_smi_test/functional/frequencies_read_write.cc | 8 ++++---- tests/amd_smi_test/functional/mutual_exclusion.cc | 2 +- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/amd_smi/amdsmi.h b/include/amd_smi/amdsmi.h index 2ff71574e8..11c5230de4 100644 --- a/include/amd_smi/amdsmi.h +++ b/include/amd_smi/amdsmi.h @@ -1592,7 +1592,7 @@ amdsmi_status_t amdsmi_get_gpu_pci_replay_counter(amdsmi_processor_handle proce * @details Given a processor handle @p processor_handle and a 64 bit bitmask @p bw_bitmask, * this function will limit the set of allowable bandwidths. If a bit in @p * bw_bitmask has a value of 1, then the frequency (as ordered in an - * ::amdsmi_frequencies_t returned by :: amdsmi_dev_get_gpu_clk_freq()) corresponding + * ::amdsmi_frequencies_t returned by :: amdsmi_get_clk_freq()) corresponding * to that bit index will be allowed. * * This function will change the performance level to @@ -2240,7 +2240,7 @@ amdsmi_status_t amdsmi_dev_get_overdrive_level(amdsmi_processor_handle processor * * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ -amdsmi_status_t amdsmi_dev_get_gpu_clk_freq(amdsmi_processor_handle processor_handle, +amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle, amdsmi_clk_type_t clk_type, amdsmi_frequencies_t *f); /** @@ -2572,7 +2572,7 @@ amdsmi_status_t amdsmi_dev_set_overdrive_level_v1(amdsmi_processor_handle proce * 64 bit bitmask @p freq_bitmask, this function will limit the set of * allowable frequencies. If a bit in @p freq_bitmask has a value of 1, then * the frequency (as ordered in an ::amdsmi_frequencies_t returned by - * amdsmi_dev_get_gpu_clk_freq()) corresponding to that bit index will be + * amdsmi_get_clk_freq()) corresponding to that bit index will be * allowed. * * This function will change the performance level to diff --git a/py-interface/README.md b/py-interface/README.md index 80e27fe3cc..3ab27093bb 100644 --- a/py-interface/README.md +++ b/py-interface/README.md @@ -2038,7 +2038,7 @@ try: except AmdSmiException as e: print(e) ``` -## amdsmi_dev_get_gpu_clk_freq +## amdsmi_get_clk_freq Description: Get the list of possible system clock speeds of device for a specified clock type @@ -2054,7 +2054,7 @@ Field | Description `current`| The current frequency index `frequency`| List of frequencies, only the first num_supported frequencies are valid -Exceptions that can be thrown by ` amdsmi_dev_get_gpu_clk_freq` function: +Exceptions that can be thrown by ` amdsmi_get_clk_freq` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2067,7 +2067,7 @@ try: print("No GPUs on machine") else: for device in devices: - amdsmi_dev_get_gpu_clk_freq(device, AmdSmiClkType.SYS) + amdsmi_get_clk_freq(device, AmdSmiClkType.SYS) except AmdSmiException as e: print(e) ``` diff --git a/py-interface/__init__.py b/py-interface/__init__.py index 9a40aaae44..3d3c3e73e7 100644 --- a/py-interface/__init__.py +++ b/py-interface/__init__.py @@ -109,7 +109,7 @@ from .amdsmi_interface import amdsmi_get_utilization_count from .amdsmi_interface import amdsmi_get_gpu_perf_level from .amdsmi_interface import amdsmi_set_gpu_perf_determinism_mode from .amdsmi_interface import amdsmi_dev_get_overdrive_level -from .amdsmi_interface import amdsmi_dev_get_gpu_clk_freq +from .amdsmi_interface import amdsmi_get_clk_freq from .amdsmi_interface import amdsmi_dev_get_od_volt_info from .amdsmi_interface import amdsmi_dev_get_gpu_metrics_info from .amdsmi_interface import amdsmi_dev_get_od_volt_curve_regions diff --git a/py-interface/amdsmi_interface.py b/py-interface/amdsmi_interface.py index a4e842686b..650cd660bc 100644 --- a/py-interface/amdsmi_interface.py +++ b/py-interface/amdsmi_interface.py @@ -2285,7 +2285,7 @@ def amdsmi_dev_get_overdrive_level( return od_level.value -def amdsmi_dev_get_gpu_clk_freq( +def amdsmi_get_clk_freq( processor_handle: amdsmi_wrapper.amdsmi_processor_handle, clk_type: AmdSmiClkType ) -> Dict[str, Any]: if not isinstance(processor_handle, amdsmi_wrapper.amdsmi_processor_handle): @@ -2297,7 +2297,7 @@ def amdsmi_dev_get_gpu_clk_freq( freq = amdsmi_wrapper.amdsmi_frequencies_t() _check_res( - amdsmi_wrapper. amdsmi_dev_get_gpu_clk_freq( + amdsmi_wrapper. amdsmi_get_clk_freq( processor_handle, clk_type, ctypes.byref(freq) ) ) diff --git a/py-interface/amdsmi_wrapper.py b/py-interface/amdsmi_wrapper.py index 767115f986..d1e1a09c42 100644 --- a/py-interface/amdsmi_wrapper.py +++ b/py-interface/amdsmi_wrapper.py @@ -1529,9 +1529,9 @@ amdsmi_set_gpu_perf_determinism_mode.argtypes = [amdsmi_processor_handle, uint64 amdsmi_dev_get_overdrive_level = _libraries['libamd_smi.so'].amdsmi_dev_get_overdrive_level amdsmi_dev_get_overdrive_level.restype = amdsmi_status_t amdsmi_dev_get_overdrive_level.argtypes = [amdsmi_processor_handle, ctypes.POINTER(ctypes.c_uint32)] -amdsmi_dev_get_gpu_clk_freq = _libraries['libamd_smi.so'].amdsmi_dev_get_gpu_clk_freq -amdsmi_dev_get_gpu_clk_freq.restype = amdsmi_status_t -amdsmi_dev_get_gpu_clk_freq.argtypes = [amdsmi_processor_handle, amdsmi_clk_type_t, ctypes.POINTER(struct_c__SA_amdsmi_frequencies_t)] +amdsmi_get_clk_freq = _libraries['libamd_smi.so'].amdsmi_get_clk_freq +amdsmi_get_clk_freq.restype = amdsmi_status_t +amdsmi_get_clk_freq.argtypes = [amdsmi_processor_handle, amdsmi_clk_type_t, ctypes.POINTER(struct_c__SA_amdsmi_frequencies_t)] amdsmi_dev_reset_gpu = _libraries['libamd_smi.so'].amdsmi_dev_reset_gpu amdsmi_dev_reset_gpu.restype = amdsmi_status_t amdsmi_dev_reset_gpu.argtypes = [amdsmi_processor_handle] @@ -1856,7 +1856,7 @@ __all__ = \ 'amdsmi_dev_get_ecc_enabled', 'amdsmi_dev_get_ecc_status', 'amdsmi_get_energy_count', 'amdsmi_get_gpu_fan_rpms', 'amdsmi_get_gpu_fan_speed', 'amdsmi_get_gpu_fan_speed_max', - 'amdsmi_dev_get_gpu_clk_freq', 'amdsmi_dev_get_gpu_metrics_info', + 'amdsmi_get_clk_freq', 'amdsmi_dev_get_gpu_metrics_info', 'amdsmi_get_gpu_id', 'amdsmi_get_gpu_memory_busy_percent', 'amdsmi_get_gpu_memory_reserved_pages', 'amdsmi_get_gpu_memory_total', 'amdsmi_get_gpu_memory_usage', diff --git a/py-interface/rocm_smi_tool.py b/py-interface/rocm_smi_tool.py index a8a41d66b1..4681501516 100644 --- a/py-interface/rocm_smi_tool.py +++ b/py-interface/rocm_smi_tool.py @@ -314,7 +314,7 @@ class Formatter: | """ + self.style.text("25 Get device perf level. Api: amdsmi_get_gpu_perf_level ") + """ | | """ + self.style.text("26 Set perf determinism mode. Api: amdsmi_set_gpu_perf_determinism_mode ") + """ | | """ + self.style.text("27 Get device overdrive level. Api: amdsmi_dev_get_overdrive_level ") + """ | - | """ + self.style.text("28 Get device gpu clk freq. Api: amdsmi_dev_get_gpu_clk_freq ") + """ | + | """ + self.style.text("28 Get device gpu clk freq. Api: amdsmi_get_clk_freq ") + """ | | """ + self.style.text("29 Get device od volt. Api: amdsmi_dev_get_od_volt_info ") + """ | | """ + self.style.text("30 Get device gpu metrics. Api: amdsmi_dev_get_gpu_metrics_info ") + """ | | """ + self.style.text("31 Get device od volt curve regions. Api: amdsmi_dev_get_od_volt_curve_regions ") + """ | @@ -493,7 +493,7 @@ def amdsmi_tool_dev_gpu_clk_freq_get(dev): result = {} for clock_type in smi_api.AmdSmiClkType: try: - value = smi_api. amdsmi_dev_get_gpu_clk_freq(dev, clock_type) + value = smi_api. amdsmi_get_clk_freq(dev, clock_type) result.update({clock_type.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(clock_type.name, e)) diff --git a/src/amd_smi/amd_smi.cc b/src/amd_smi/amd_smi.cc index f8ec8b18c2..ec3c88f36c 100644 --- a/src/amd_smi/amd_smi.cc +++ b/src/amd_smi/amd_smi.cc @@ -933,7 +933,7 @@ amdsmi_get_func_iter_value(amdsmi_func_id_iter_handle_t handle, {"rsmi_dev_gpu_reset", "amdsmi_dev_reset_gpu"}, {"rsmi_dev_memory_total_get", "amdsmi_get_gpu_memory_total"}, {"rsmi_dev_memory_usage_get", "amdsmi_get_gpu_memory_usage"}, - {"rsmi_dev_gpu_clk_freq_get", " amdsmi_dev_get_gpu_clk_freq"}, + {"rsmi_dev_gpu_clk_freq_get", " amdsmi_get_clk_freq"}, {"rsmi_dev_gpu_clk_freq_set", " amdsmi_dev_set_clk_freq"}, {"rsmi_dev_firmware_version_get", "amdsmi_get_fw_info"}, {"rsmi_dev_ecc_count_get", " amdsmi_dev_get_ecc_count"}, @@ -1202,7 +1202,7 @@ amdsmi_status_t amdsmi_get_gpu_pci_bandwidth(amdsmi_processor_handle processor_h } // TODO(bliu): other frequencies in amdsmi_clk_type_t -amdsmi_status_t amdsmi_dev_get_gpu_clk_freq(amdsmi_processor_handle processor_handle, +amdsmi_status_t amdsmi_get_clk_freq(amdsmi_processor_handle processor_handle, amdsmi_clk_type_t clk_type, amdsmi_frequencies_t *f) { AMDSMI_CHECK_INIT(); diff --git a/tests/amd_smi_test/functional/frequencies_read.cc b/tests/amd_smi_test/functional/frequencies_read.cc index c93bcd89b5..0cb51149e5 100755 --- a/tests/amd_smi_test/functional/frequencies_read.cc +++ b/tests/amd_smi_test/functional/frequencies_read.cc @@ -116,12 +116,12 @@ void TestFrequenciesRead::Run(void) { for (uint32_t x = 0; x < num_iterations(); ++x) { for (uint32_t i = 0; i < num_monitor_devs(); ++i) { auto freq_output = [&](amdsmi_clk_type_t t, const char *name) { - err = amdsmi_dev_get_gpu_clk_freq(processor_handles_[i], t, &f); + err = amdsmi_get_clk_freq(processor_handles_[i], t, &f); if (err == AMDSMI_STATUS_NOT_SUPPORTED) { std::cout << "\t**Get " << name << ": Not supported on this machine" << std::endl; // Verify api support checking functionality is working - err = amdsmi_dev_get_gpu_clk_freq(processor_handles_[i], t, nullptr); + err = amdsmi_get_clk_freq(processor_handles_[i], t, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } else if (err == AMDSMI_STATUS_NOT_YET_IMPLEMENTED) { std::cout << "\t**Get " << name << @@ -133,7 +133,7 @@ void TestFrequenciesRead::Run(void) { std::cout << f.num_supported << std::endl; print_frequencies(&f); // Verify api support checking functionality is working - err = amdsmi_dev_get_gpu_clk_freq(processor_handles_[i], t, nullptr); + err = amdsmi_get_clk_freq(processor_handles_[i], t, nullptr); ASSERT_EQ(err, AMDSMI_STATUS_INVAL); } } diff --git a/tests/amd_smi_test/functional/frequencies_read_write.cc b/tests/amd_smi_test/functional/frequencies_read_write.cc index af7b3cb36b..6c76163a56 100755 --- a/tests/amd_smi_test/functional/frequencies_read_write.cc +++ b/tests/amd_smi_test/functional/frequencies_read_write.cc @@ -113,7 +113,7 @@ void TestFrequenciesReadWrite::Run(void) { std::cout << amdsmi_clk << std::endl; if (amdsmi_clk == CLK_TYPE_PCIE) return false; - ret = amdsmi_dev_get_gpu_clk_freq(processor_handles_[dv_ind], amdsmi_clk, &f); + ret = amdsmi_get_clk_freq(processor_handles_[dv_ind], amdsmi_clk, &f); std::cout << ret << std::endl; if (ret == AMDSMI_STATUS_NOT_SUPPORTED || @@ -166,7 +166,7 @@ void TestFrequenciesReadWrite::Run(void) { return; } CHK_ERR_ASRT(ret) - ret = amdsmi_dev_get_gpu_clk_freq(processor_handles_[dv_ind], amdsmi_clk, &f); + ret = amdsmi_get_clk_freq(processor_handles_[dv_ind], amdsmi_clk, &f); if (ret != AMDSMI_STATUS_SUCCESS) { return; } @@ -194,7 +194,7 @@ void TestFrequenciesReadWrite::Run(void) { freq_write(); CHK_ERR_ASRT(ret) #if 0 - ret = amdsmi_dev_get_gpu_clk_freq(dv_ind, amdsmi_clk, &f); + ret = amdsmi_get_clk_freq(dv_ind, amdsmi_clk, &f); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { @@ -218,7 +218,7 @@ void TestFrequenciesReadWrite::Run(void) { ret = amdsmi_dev_set_clk_freq(dv_ind, amdsmi_clk, freq_bitmask); CHK_ERR_ASRT(ret) - ret = amdsmi_dev_get_gpu_clk_freq(dv_ind, amdsmi_clk, &f); + ret = amdsmi_get_clk_freq(dv_ind, amdsmi_clk, &f); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { diff --git a/tests/amd_smi_test/functional/mutual_exclusion.cc b/tests/amd_smi_test/functional/mutual_exclusion.cc index 790359641a..496d279d83 100755 --- a/tests/amd_smi_test/functional/mutual_exclusion.cc +++ b/tests/amd_smi_test/functional/mutual_exclusion.cc @@ -239,7 +239,7 @@ void TestMutualExclusion::Run(void) { CHECK_RET(ret, AMDSMI_STATUS_BUSY); ret = amdsmi_dev_get_overdrive_level(processor_handles_[0], &dmy_ui32); CHECK_RET(ret, AMDSMI_STATUS_BUSY); - ret = amdsmi_dev_get_gpu_clk_freq(processor_handles_[0], CLK_TYPE_SYS, &dmy_freqs); + ret = amdsmi_get_clk_freq(processor_handles_[0], CLK_TYPE_SYS, &dmy_freqs); CHECK_RET(ret, AMDSMI_STATUS_BUSY); ret = amdsmi_dev_get_od_volt_info(processor_handles_[0], &dmy_od_volt); CHECK_RET(ret, AMDSMI_STATUS_BUSY);