From c70ff3cbed3240d50d85ad74af3f7df0ce7e6f9b Mon Sep 17 00:00:00 2001 From: Deepak Mewar Date: Mon, 27 Feb 2023 02:04:54 -0500 Subject: [PATCH] Renamed API amdsmi_control_counter to amdsmi_gpu_control_counter grep -rli 'amdsmi_control_counter' * | xargs -i@ sed -i 's/amdsmi_control_counter/amdsmi_gpu_control_counter/g' @ Change-Id: Ibdcd32327ebd2646375fb5c3b913cb528ac8aa97 [ROCm/amdsmi commit: 6e1a72d2c10cdb51cc3dd806302d0401f510f82d] --- projects/amdsmi/include/amd_smi/amdsmi.h | 8 ++++---- projects/amdsmi/py-interface/README.md | 6 +++--- projects/amdsmi/py-interface/__init__.py | 2 +- projects/amdsmi/py-interface/amdsmi_interface.py | 4 ++-- projects/amdsmi/py-interface/amdsmi_wrapper.py | 8 ++++---- projects/amdsmi/py-interface/rocm_smi_tool.py | 4 ++-- projects/amdsmi/src/amd_smi/amd_smi.cc | 2 +- .../tests/amd_smi_test/functional/perf_cntr_read_write.cc | 6 +++--- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/projects/amdsmi/include/amd_smi/amdsmi.h b/projects/amdsmi/include/amd_smi/amdsmi.h index 90b7627e72..dbc58fba85 100644 --- a/projects/amdsmi/include/amd_smi/amdsmi.h +++ b/projects/amdsmi/include/amd_smi/amdsmi.h @@ -2780,7 +2780,7 @@ amdsmi_status_string(amdsmi_status_t status, const char **status_string); * structure. * * Once an event counter handle is obtained, the event counter can be - * controlled (i.e., started, stopped,...) with ::amdsmi_control_counter() by + * controlled (i.e., started, stopped,...) with ::amdsmi_gpu_control_counter() by * passing ::amdsmi_counter_command_t commands. ::AMDSMI_CNTR_CMD_START starts an * event counter and ::AMDSMI_CNTR_CMD_STOP stops a counter. * ::amdsmi_read_counter() reads an event counter. @@ -2831,7 +2831,7 @@ amdsmi_status_string(amdsmi_status_t status, const char **status_string); * // A program that generates the events of interest can be started * // immediately before or after starting the counters. * // Start counting: - * ret = amdsmi_control_counter(evnt_handle, AMDSMI_CNTR_CMD_START, NULL); + * ret = amdsmi_gpu_control_counter(evnt_handle, AMDSMI_CNTR_CMD_START, NULL); * * // Wait... * @@ -2844,7 +2844,7 @@ amdsmi_status_string(amdsmi_status_t status, const char **status_string); * ret = amdsmi_read_counter(amdsmi_event_handle_t evt_handle, &value) * * // Stop counting. - * ret = amdsmi_control_counter(evnt_handle, AMDSMI_CNTR_CMD_STOP, NULL); + * ret = amdsmi_gpu_control_counter(evnt_handle, AMDSMI_CNTR_CMD_STOP, NULL); * * // Release all resources (e.g., counter and memory resources) associated * with evnt_handle. @@ -2930,7 +2930,7 @@ amdsmi_gpu_destroy_counter(amdsmi_event_handle_t evnt_handle); * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_control_counter(amdsmi_event_handle_t evt_handle, +amdsmi_gpu_control_counter(amdsmi_event_handle_t evt_handle, amdsmi_counter_command_t cmd, void *cmd_args); /** diff --git a/projects/amdsmi/py-interface/README.md b/projects/amdsmi/py-interface/README.md index 0d4250eb2b..934d06c21e 100644 --- a/projects/amdsmi/py-interface/README.md +++ b/projects/amdsmi/py-interface/README.md @@ -2316,7 +2316,7 @@ try: except AmdSmiException as e: print(e) ``` -## amdsmi_control_counter +## amdsmi_gpu_control_counter Description: Issue performance counter control commands Input parameters: @@ -2326,7 +2326,7 @@ Input parameters: Output: None -Exceptions that can be thrown by `amdsmi_control_counter` function: +Exceptions that can be thrown by `amdsmi_gpu_control_counter` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2340,7 +2340,7 @@ try: else: for device in devices: event_handle = amdsmi_gpu_create_counter(device, AmdSmiEventType.XGMI_1_REQUEST_TX) - amdsmi_control_counter(event_handle, AmdSmiCounterCommand.CMD_START) + amdsmi_gpu_control_counter(event_handle, AmdSmiCounterCommand.CMD_START) except AmdSmiException as e: print(e) ``` diff --git a/projects/amdsmi/py-interface/__init__.py b/projects/amdsmi/py-interface/__init__.py index b10bc77f99..fbd8519285 100644 --- a/projects/amdsmi/py-interface/__init__.py +++ b/projects/amdsmi/py-interface/__init__.py @@ -119,7 +119,7 @@ from .amdsmi_interface import amdsmi_get_gpu_power_profile_presets from .amdsmi_interface import amdsmi_gpu_counter_group_supported from .amdsmi_interface import amdsmi_gpu_create_counter from .amdsmi_interface import amdsmi_gpu_destroy_counter -from .amdsmi_interface import amdsmi_control_counter +from .amdsmi_interface import amdsmi_gpu_control_counter from .amdsmi_interface import amdsmi_read_counter from .amdsmi_interface import amdsmi_counter_get_available_counters diff --git a/projects/amdsmi/py-interface/amdsmi_interface.py b/projects/amdsmi/py-interface/amdsmi_interface.py index 6026bf8cbe..e28e45d14a 100644 --- a/projects/amdsmi/py-interface/amdsmi_interface.py +++ b/projects/amdsmi/py-interface/amdsmi_interface.py @@ -1390,7 +1390,7 @@ def amdsmi_gpu_destroy_counter(event_handle: amdsmi_wrapper.amdsmi_event_handle_ _check_res(amdsmi_wrapper.amdsmi_gpu_destroy_counter(event_handle)) -def amdsmi_control_counter( +def amdsmi_gpu_control_counter( event_handle: amdsmi_wrapper.amdsmi_event_handle_t, counter_command: AmdSmiCounterCommand, ): @@ -1403,7 +1403,7 @@ def amdsmi_control_counter( command_args = ctypes.c_void_p() _check_res( - amdsmi_wrapper.amdsmi_control_counter( + amdsmi_wrapper.amdsmi_gpu_control_counter( event_handle, counter_command, command_args ) ) diff --git a/projects/amdsmi/py-interface/amdsmi_wrapper.py b/projects/amdsmi/py-interface/amdsmi_wrapper.py index 5065aa5627..0c40857a48 100644 --- a/projects/amdsmi/py-interface/amdsmi_wrapper.py +++ b/projects/amdsmi/py-interface/amdsmi_wrapper.py @@ -1598,9 +1598,9 @@ amdsmi_gpu_create_counter.argtypes = [amdsmi_processor_handle, amdsmi_event_type amdsmi_gpu_destroy_counter = _libraries['libamd_smi.so'].amdsmi_gpu_destroy_counter amdsmi_gpu_destroy_counter.restype = amdsmi_status_t amdsmi_gpu_destroy_counter.argtypes = [amdsmi_event_handle_t] -amdsmi_control_counter = _libraries['libamd_smi.so'].amdsmi_control_counter -amdsmi_control_counter.restype = amdsmi_status_t -amdsmi_control_counter.argtypes = [amdsmi_event_handle_t, amdsmi_counter_command_t, ctypes.POINTER(None)] +amdsmi_gpu_control_counter = _libraries['libamd_smi.so'].amdsmi_gpu_control_counter +amdsmi_gpu_control_counter.restype = amdsmi_status_t +amdsmi_gpu_control_counter.argtypes = [amdsmi_event_handle_t, amdsmi_counter_command_t, ctypes.POINTER(None)] amdsmi_read_counter = _libraries['libamd_smi.so'].amdsmi_read_counter amdsmi_read_counter.restype = amdsmi_status_t amdsmi_read_counter.argtypes = [amdsmi_event_handle_t, ctypes.POINTER(struct_c__SA_amdsmi_counter_value_t)] @@ -1845,7 +1845,7 @@ __all__ = \ 'amdsmi_bdf_t', 'amdsmi_bit_field_t', 'amdsmi_board_info_t', 'amdsmi_clk_measure_t', 'amdsmi_clk_type_t', 'amdsmi_clk_type_t__enumvalues', 'amdsmi_container_types_t', - 'amdsmi_container_types_t__enumvalues', 'amdsmi_control_counter', + 'amdsmi_container_types_t__enumvalues', 'amdsmi_gpu_control_counter', 'amdsmi_counter_command_t', 'amdsmi_counter_command_t__enumvalues', 'amdsmi_counter_get_available_counters', 'amdsmi_counter_value_t', diff --git a/projects/amdsmi/py-interface/rocm_smi_tool.py b/projects/amdsmi/py-interface/rocm_smi_tool.py index ae828089f4..6c071dccb3 100644 --- a/projects/amdsmi/py-interface/rocm_smi_tool.py +++ b/projects/amdsmi/py-interface/rocm_smi_tool.py @@ -346,7 +346,7 @@ class Formatter: | """ + self.style.text("57 Get fw info. Api: amdsmi_get_fw_info ") + """ | | """ + self.style.text("58 Get vbios info. Api: amdsmi_get_gpu_vbios_info ") + """ | | """ + self.style.text("59 Get counter available counters. Api: amdsmi_counter_get_available_counters ") + """ | - | """ + self.style.text("60 Get counter control. Api: amdsmi_control_counter ") + """ | + | """ + self.style.text("60 Get counter control. Api: amdsmi_gpu_control_counter ") + """ | | """ + self.style.text("61 Get counter read. Api: amdsmi_read_counter ") + """ | | """ + self.style.text("62 Set dev clk range. Api: amdsmi_set_gpu_clk_range ") + """ | | """ + self.style.text("63 Get dev counter group supported. Api: amdsmi_gpu_counter_group_supported ") + """ | @@ -595,7 +595,7 @@ def amdsmi_tool_counter_control(dev): for counter_command in smi_api.AmdSmiCounterCommand: try: event_handle = smi_api.amdsmi_gpu_create_counter(dev, event_type) - value = smi_api.amdsmi_control_counter(event_handle, counter_command) + value = smi_api.amdsmi_gpu_control_counter(event_handle, counter_command) result.update({event_type.name: value}) except smi_api.AmdSmiException as e: print("{}:\t{}".format(event_type.name, e)) diff --git a/projects/amdsmi/src/amd_smi/amd_smi.cc b/projects/amdsmi/src/amd_smi/amd_smi.cc index 48e1c62168..3e4c76c4a7 100644 --- a/projects/amdsmi/src/amd_smi/amd_smi.cc +++ b/projects/amdsmi/src/amd_smi/amd_smi.cc @@ -709,7 +709,7 @@ amdsmi_status_t amdsmi_gpu_destroy_counter(amdsmi_event_handle_t evnt_handle) { return amd::smi::rsmi_to_amdsmi_status(r); } -amdsmi_status_t amdsmi_control_counter(amdsmi_event_handle_t evt_handle, +amdsmi_status_t amdsmi_gpu_control_counter(amdsmi_event_handle_t evt_handle, amdsmi_counter_command_t cmd, void *cmd_args) { rsmi_status_t r = rsmi_counter_control( static_cast(evt_handle), diff --git a/projects/amdsmi/tests/amd_smi_test/functional/perf_cntr_read_write.cc b/projects/amdsmi/tests/amd_smi_test/functional/perf_cntr_read_write.cc index 4a1f13468d..fc03238151 100755 --- a/projects/amdsmi/tests/amd_smi_test/functional/perf_cntr_read_write.cc +++ b/projects/amdsmi/tests/amd_smi_test/functional/perf_cntr_read_write.cc @@ -126,9 +126,9 @@ void TestPerfCntrReadWrite::CountEvents(amdsmi_processor_handle dv_ind, static_cast(evnt), nullptr); ASSERT_EQ(ret, AMDSMI_STATUS_INVAL); - ret = amdsmi_control_counter(evt_handle, AMDSMI_CNTR_CMD_START, nullptr); + ret = amdsmi_gpu_control_counter(evt_handle, AMDSMI_CNTR_CMD_START, nullptr); if (ret == AMDSMI_STATUS_NOT_SUPPORTED) { - std::cout << "amdsmi_control_counter() returned " + std::cout << "amdsmi_gpu_control_counter() returned " "AMDSMI_STATUS_NOT_SUPPORTED" << std::endl; throw AMDSMI_STATUS_NOT_SUPPORTED; } else { @@ -307,7 +307,7 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_processor_handle dv_ind) for (j = 0; j < num_created; ++j) { tmp = static_cast(evnt + j); - ret = amdsmi_control_counter(evt_handle.get()[j], AMDSMI_CNTR_CMD_START, + ret = amdsmi_gpu_control_counter(evt_handle.get()[j], AMDSMI_CNTR_CMD_START, nullptr); CHK_ERR_ASRT(ret)