diff --git a/projects/amdsmi/include/amd_smi/amdsmi.h b/projects/amdsmi/include/amd_smi/amdsmi.h index dbc58fba85..0bd44732fd 100644 --- a/projects/amdsmi/include/amd_smi/amdsmi.h +++ b/projects/amdsmi/include/amd_smi/amdsmi.h @@ -2783,7 +2783,7 @@ amdsmi_status_string(amdsmi_status_t status, const char **status_string); * 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. + * ::amdsmi_gpu_read_counter() reads an event counter. * * Once the counter is no longer needed, the resources it uses should be freed * by calling ::amdsmi_gpu_destroy_counter(). @@ -2794,12 +2794,12 @@ amdsmi_status_string(amdsmi_status_t status, const char **status_string); * - A running "absolute" counter is kept internally. For the discussion that * follows, we will call the internal counter value at time @a t @a * valt - * - Issuing ::AMDSMI_CNTR_CMD_START or calling ::amdsmi_read_counter(), causes + * - Issuing ::AMDSMI_CNTR_CMD_START or calling ::amdsmi_gpu_read_counter(), causes * AMDSMI (in kernel) to internally record the current absolute counter value - * - ::amdsmi_read_counter() returns the number of events that have occurred + * - ::amdsmi_gpu_read_counter() returns the number of events that have occurred * since the previously recorded value (ie, a relative value, * @a valt - valt-1) from the issuing of - * ::AMDSMI_CNTR_CMD_START or calling ::amdsmi_read_counter() + * ::AMDSMI_CNTR_CMD_START or calling ::amdsmi_gpu_read_counter() * * Example of event counting sequence: * @@ -2836,12 +2836,12 @@ amdsmi_status_string(amdsmi_status_t status, const char **status_string); * // Wait... * * // Get the number of events since AMDSMI_CNTR_CMD_START was issued: - * ret = amdsmi_read_counter(amdsmi_event_handle_t evt_handle, &value) + * ret = amdsmi_gpu_read_counter(amdsmi_event_handle_t evt_handle, &value) * * // Wait... * - * // Get the number of events since amdsmi_read_counter() was last called: - * ret = amdsmi_read_counter(amdsmi_event_handle_t evt_handle, &value) + * // Get the number of events since amdsmi_gpu_read_counter() was last called: + * ret = amdsmi_gpu_read_counter(amdsmi_event_handle_t evt_handle, &value) * * // Stop counting. * ret = amdsmi_gpu_control_counter(evnt_handle, AMDSMI_CNTR_CMD_STOP, NULL); @@ -2950,7 +2950,7 @@ amdsmi_gpu_control_counter(amdsmi_event_handle_t evt_handle, * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_read_counter(amdsmi_event_handle_t evt_handle, +amdsmi_gpu_read_counter(amdsmi_event_handle_t evt_handle, amdsmi_counter_value_t *value); /** diff --git a/projects/amdsmi/py-interface/README.md b/projects/amdsmi/py-interface/README.md index 934d06c21e..d5a8b2f4f2 100644 --- a/projects/amdsmi/py-interface/README.md +++ b/projects/amdsmi/py-interface/README.md @@ -2344,7 +2344,7 @@ try: except AmdSmiException as e: print(e) ``` -## amdsmi_read_counter +## amdsmi_gpu_read_counter Description: Read the current value of a performance counter Input parameters: @@ -2359,7 +2359,7 @@ Field | Description `time_enabled`| Time that the counter was enabled in nanoseconds `time_running`| Time that the counter was running in nanoseconds -Exceptions that can be thrown by `amdsmi_read_counter` function: +Exceptions that can be thrown by `amdsmi_gpu_read_counter` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2373,7 +2373,7 @@ try: else: for device in devices: event_handle = amdsmi_gpu_create_counter(device, AmdSmiEventType.XGMI_1_REQUEST_TX) - amdsmi_read_counter(event_handle) + amdsmi_gpu_read_counter(event_handle) except AmdSmiException as e: print(e) ``` diff --git a/projects/amdsmi/py-interface/__init__.py b/projects/amdsmi/py-interface/__init__.py index fbd8519285..a0dd3bf969 100644 --- a/projects/amdsmi/py-interface/__init__.py +++ b/projects/amdsmi/py-interface/__init__.py @@ -120,7 +120,7 @@ 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_gpu_control_counter -from .amdsmi_interface import amdsmi_read_counter +from .amdsmi_interface import amdsmi_gpu_read_counter from .amdsmi_interface import amdsmi_counter_get_available_counters # # Error Query diff --git a/projects/amdsmi/py-interface/amdsmi_interface.py b/projects/amdsmi/py-interface/amdsmi_interface.py index e28e45d14a..5e19b47266 100644 --- a/projects/amdsmi/py-interface/amdsmi_interface.py +++ b/projects/amdsmi/py-interface/amdsmi_interface.py @@ -1409,7 +1409,7 @@ def amdsmi_gpu_control_counter( ) -def amdsmi_read_counter( +def amdsmi_gpu_read_counter( event_handle: amdsmi_wrapper.amdsmi_event_handle_t, ) -> Dict[str, Any]: if not isinstance(event_handle, amdsmi_wrapper.amdsmi_event_handle_t): @@ -1420,7 +1420,7 @@ def amdsmi_read_counter( counter_value = amdsmi_wrapper.amdsmi_counter_value_t() _check_res( - amdsmi_wrapper.amdsmi_read_counter( + amdsmi_wrapper.amdsmi_gpu_read_counter( event_handle, ctypes.byref(counter_value)) ) diff --git a/projects/amdsmi/py-interface/amdsmi_wrapper.py b/projects/amdsmi/py-interface/amdsmi_wrapper.py index 0c40857a48..226e9da9b4 100644 --- a/projects/amdsmi/py-interface/amdsmi_wrapper.py +++ b/projects/amdsmi/py-interface/amdsmi_wrapper.py @@ -1601,9 +1601,9 @@ amdsmi_gpu_destroy_counter.argtypes = [amdsmi_event_handle_t] 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)] +amdsmi_gpu_read_counter = _libraries['libamd_smi.so'].amdsmi_gpu_read_counter +amdsmi_gpu_read_counter.restype = amdsmi_status_t +amdsmi_gpu_read_counter.argtypes = [amdsmi_event_handle_t, ctypes.POINTER(struct_c__SA_amdsmi_counter_value_t)] amdsmi_counter_get_available_counters = _libraries['libamd_smi.so'].amdsmi_counter_get_available_counters amdsmi_counter_get_available_counters.restype = amdsmi_status_t amdsmi_counter_get_available_counters.argtypes = [amdsmi_processor_handle, amdsmi_event_group_t, ctypes.POINTER(ctypes.c_uint32)] @@ -1930,7 +1930,7 @@ __all__ = \ 'amdsmi_power_profile_status_t', 'amdsmi_proc_info_t', 'amdsmi_process_handle', 'amdsmi_process_info_t', 'amdsmi_range_t', 'amdsmi_ras_err_state_t', - 'amdsmi_ras_err_state_t__enumvalues', 'amdsmi_read_counter', + 'amdsmi_ras_err_state_t__enumvalues', 'amdsmi_gpu_read_counter', 'amdsmi_retired_page_record_t', 'amdsmi_set_gpu_event_notification_mask', 'amdsmi_set_gpu_perf_determinism_mode', 'amdsmi_shut_down', diff --git a/projects/amdsmi/py-interface/rocm_smi_tool.py b/projects/amdsmi/py-interface/rocm_smi_tool.py index 6c071dccb3..e18f7dbcf8 100644 --- a/projects/amdsmi/py-interface/rocm_smi_tool.py +++ b/projects/amdsmi/py-interface/rocm_smi_tool.py @@ -347,7 +347,7 @@ class Formatter: | """ + 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_gpu_control_counter ") + """ | - | """ + self.style.text("61 Get counter read. Api: amdsmi_read_counter ") + """ | + | """ + self.style.text("61 Get counter read. Api: amdsmi_gpu_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 ") + """ | | """ + self.style.text("64 Reset dev fan. Api: amdsmi_reset_gpu_fan ") + """ | @@ -607,7 +607,7 @@ def amdsmi_tool_counter_read(dev): for event_type in smi_api.AmdSmiEventType: try: event_handle = smi_api.amdsmi_gpu_create_counter(dev, event_type) - value = smi_api.amdsmi_read_counter(event_handle) + value = smi_api.amdsmi_gpu_read_counter(event_handle) 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 3e4c76c4a7..a0cfb46d93 100644 --- a/projects/amdsmi/src/amd_smi/amd_smi.cc +++ b/projects/amdsmi/src/amd_smi/amd_smi.cc @@ -718,7 +718,7 @@ amdsmi_status_t amdsmi_gpu_control_counter(amdsmi_event_handle_t evt_handle, } amdsmi_status_t -amdsmi_read_counter(amdsmi_event_handle_t evt_handle, +amdsmi_gpu_read_counter(amdsmi_event_handle_t evt_handle, amdsmi_counter_value_t *value) { rsmi_status_t r = rsmi_counter_read( 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 fc03238151..0f6a5a1b23 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 @@ -136,7 +136,7 @@ void TestPerfCntrReadWrite::CountEvents(amdsmi_processor_handle dv_ind, } sleep(sleep_sec); - ret = amdsmi_read_counter(evt_handle, val); + ret = amdsmi_gpu_read_counter(evt_handle, val); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) { @@ -325,7 +325,7 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_processor_handle dv_ind) for (j = 0; j < num_created; ++j) { tmp = static_cast(evnt + j); - ret = amdsmi_read_counter(evt_handle.get()[j], &val); + ret = amdsmi_gpu_read_counter(evt_handle.get()[j], &val); CHK_ERR_ASRT(ret) IF_VERB(STANDARD) {