From ca4b919b165766d7a34ff404e19077a2cbc200c8 Mon Sep 17 00:00:00 2001 From: Deepak Mewar Date: Mon, 27 Feb 2023 02:03:20 -0500 Subject: [PATCH] Renamed API amdsmi_dev_destroy_counter to amdsmi_gpu_destroy_counter grep -rli 'amdsmi_dev_destroy_counter' * | xargs -i@ sed -i 's/amdsmi_dev_destroy_counter/amdsmi_gpu_destroy_counter/g' @ Change-Id: I328f65f5a2a86108ee5b217f95ed0f4f03745286 [ROCm/amdsmi commit: e6dd8d49bac481dba3d3f7f06ab4a79bc7b1f961] --- 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/src/amd_smi/amd_smi.cc | 2 +- .../tests/amd_smi_test/functional/perf_cntr_read_write.cc | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/projects/amdsmi/include/amd_smi/amdsmi.h b/projects/amdsmi/include/amd_smi/amdsmi.h index 200342b262..90b7627e72 100644 --- a/projects/amdsmi/include/amd_smi/amdsmi.h +++ b/projects/amdsmi/include/amd_smi/amdsmi.h @@ -2786,7 +2786,7 @@ amdsmi_status_string(amdsmi_status_t status, const char **status_string); * ::amdsmi_read_counter() reads an event counter. * * Once the counter is no longer needed, the resources it uses should be freed - * by calling ::amdsmi_dev_destroy_counter(). + * by calling ::amdsmi_gpu_destroy_counter(). * * * Important Notes about Counter Values @@ -2848,7 +2848,7 @@ amdsmi_status_string(amdsmi_status_t status, const char **status_string); * * // Release all resources (e.g., counter and memory resources) associated * with evnt_handle. - * ret = amdsmi_dev_destroy_counter(evnt_handle); + * ret = amdsmi_gpu_destroy_counter(evnt_handle); * @endcode * @{ */ @@ -2877,7 +2877,7 @@ amdsmi_gpu_counter_group_supported(amdsmi_processor_handle processor_handle, amd * with a processor handle of @p processor_handle, and write a handle to the object to the * memory location pointed to by @p evnt_handle. @p evnt_handle can be used * with other performance event operations. The handle should be deallocated - * with ::amdsmi_dev_destroy_counter() when no longer needed. + * with ::amdsmi_gpu_destroy_counter() when no longer needed. * * @note This function requires root access * @@ -2911,7 +2911,7 @@ amdsmi_gpu_create_counter(amdsmi_processor_handle processor_handle, amdsmi_event * @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail */ amdsmi_status_t -amdsmi_dev_destroy_counter(amdsmi_event_handle_t evnt_handle); +amdsmi_gpu_destroy_counter(amdsmi_event_handle_t evnt_handle); /** * @brief Issue performance counter control commands diff --git a/projects/amdsmi/py-interface/README.md b/projects/amdsmi/py-interface/README.md index 8aa40c5399..0d4250eb2b 100644 --- a/projects/amdsmi/py-interface/README.md +++ b/projects/amdsmi/py-interface/README.md @@ -2289,7 +2289,7 @@ try: except AmdSmiException as e: print(e) ``` -## amdsmi_dev_destroy_counter +## amdsmi_gpu_destroy_counter Description: Destroys a performance counter object Input parameters: @@ -2298,7 +2298,7 @@ Input parameters: Output: None -Exceptions that can be thrown by `amdsmi_dev_destroy_counter` function: +Exceptions that can be thrown by `amdsmi_gpu_destroy_counter` function: * `AmdSmiLibraryException` * `AmdSmiRetryException` * `AmdSmiParameterException` @@ -2312,7 +2312,7 @@ try: else: for device in devices: event_handle = amdsmi_gpu_create_counter(device, AmdSmiEventGroup.XGMI) - amdsmi_dev_destroy_counter(event_handle) + amdsmi_gpu_destroy_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 569dc9053d..b10bc77f99 100644 --- a/projects/amdsmi/py-interface/__init__.py +++ b/projects/amdsmi/py-interface/__init__.py @@ -118,7 +118,7 @@ from .amdsmi_interface import amdsmi_get_gpu_power_profile_presets # # Performance Counters from .amdsmi_interface import amdsmi_gpu_counter_group_supported from .amdsmi_interface import amdsmi_gpu_create_counter -from .amdsmi_interface import amdsmi_dev_destroy_counter +from .amdsmi_interface import amdsmi_gpu_destroy_counter from .amdsmi_interface import amdsmi_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 57ce6f944e..6026bf8cbe 100644 --- a/projects/amdsmi/py-interface/amdsmi_interface.py +++ b/projects/amdsmi/py-interface/amdsmi_interface.py @@ -1382,12 +1382,12 @@ def amdsmi_gpu_create_counter( return event_handle -def amdsmi_dev_destroy_counter(event_handle: amdsmi_wrapper.amdsmi_event_handle_t): +def amdsmi_gpu_destroy_counter(event_handle: amdsmi_wrapper.amdsmi_event_handle_t): if not isinstance(event_handle, amdsmi_wrapper.amdsmi_event_handle_t): raise AmdSmiParameterException( event_handle, amdsmi_wrapper.amdsmi_event_handle_t ) - _check_res(amdsmi_wrapper.amdsmi_dev_destroy_counter(event_handle)) + _check_res(amdsmi_wrapper.amdsmi_gpu_destroy_counter(event_handle)) def amdsmi_control_counter( diff --git a/projects/amdsmi/py-interface/amdsmi_wrapper.py b/projects/amdsmi/py-interface/amdsmi_wrapper.py index 192ca8a569..5065aa5627 100644 --- a/projects/amdsmi/py-interface/amdsmi_wrapper.py +++ b/projects/amdsmi/py-interface/amdsmi_wrapper.py @@ -1595,9 +1595,9 @@ amdsmi_gpu_counter_group_supported.argtypes = [amdsmi_processor_handle, amdsmi_e amdsmi_gpu_create_counter = _libraries['libamd_smi.so'].amdsmi_gpu_create_counter amdsmi_gpu_create_counter.restype = amdsmi_status_t amdsmi_gpu_create_counter.argtypes = [amdsmi_processor_handle, amdsmi_event_type_t, ctypes.POINTER(ctypes.c_uint64)] -amdsmi_dev_destroy_counter = _libraries['libamd_smi.so'].amdsmi_dev_destroy_counter -amdsmi_dev_destroy_counter.restype = amdsmi_status_t -amdsmi_dev_destroy_counter.argtypes = [amdsmi_event_handle_t] +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)] @@ -1851,7 +1851,7 @@ __all__ = \ 'amdsmi_counter_get_available_counters', 'amdsmi_counter_value_t', 'amdsmi_dev_close_supported_func_iterator', 'amdsmi_gpu_counter_group_supported', 'amdsmi_gpu_create_counter', - 'amdsmi_dev_destroy_counter', 'amdsmi_get_busy_percent', + 'amdsmi_gpu_destroy_counter', 'amdsmi_get_busy_percent', 'amdsmi_get_gpu_drm_render_minor', 'amdsmi_dev_get_gpu_ecc_count', 'amdsmi_dev_get_gpu_ecc_enabled', 'amdsmi_dev_get_gpu_ecc_status', 'amdsmi_get_energy_count', 'amdsmi_get_gpu_fan_rpms', diff --git a/projects/amdsmi/src/amd_smi/amd_smi.cc b/projects/amdsmi/src/amd_smi/amd_smi.cc index 8ba0962b8b..48e1c62168 100644 --- a/projects/amdsmi/src/amd_smi/amd_smi.cc +++ b/projects/amdsmi/src/amd_smi/amd_smi.cc @@ -703,7 +703,7 @@ amdsmi_status_t amdsmi_gpu_create_counter(amdsmi_processor_handle processor_hand static_cast(evnt_handle)); } -amdsmi_status_t amdsmi_dev_destroy_counter(amdsmi_event_handle_t evnt_handle) { +amdsmi_status_t amdsmi_gpu_destroy_counter(amdsmi_event_handle_t evnt_handle) { rsmi_status_t r = rsmi_dev_counter_destroy( static_cast(evnt_handle)); return amd::smi::rsmi_to_amdsmi_status(r); 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 a9b454718b..4a1f13468d 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 @@ -146,7 +146,7 @@ void TestPerfCntrReadWrite::CountEvents(amdsmi_processor_handle dv_ind, std::cout << "\t\t\tEvents/Second Running: " << val->value/static_cast(val->time_running) << std::endl; } - ret = amdsmi_dev_destroy_counter(evt_handle); + ret = amdsmi_gpu_destroy_counter(evt_handle); CHK_ERR_ASRT(ret) } @@ -337,7 +337,7 @@ TestPerfCntrReadWrite::testEventsSimultaneously(amdsmi_processor_handle dv_ind) } } for (j = 0; j < num_created; ++j) { - ret = amdsmi_dev_destroy_counter(evt_handle.get()[j]); + ret = amdsmi_gpu_destroy_counter(evt_handle.get()[j]); CHK_ERR_ASRT(ret) } }