Clean up the APIs
Remove and rename APIs after review.
Change-Id: I5464f200eb605b366673f8abca95183c3837843b
[ROCm/amdsmi commit: 62ce965409]
Этот коммит содержится в:
коммит произвёл
Shuzhou Liu
родитель
ec28030323
Коммит
58962bb075
@@ -59,7 +59,7 @@
|
||||
const char *err_str; \
|
||||
std::cout << "AMDSMI call returned " << RET << " at line " \
|
||||
<< __LINE__ << std::endl; \
|
||||
amdsmi_status_string(RET, &err_str); \
|
||||
amdsmi_status_code_to_string(RET, &err_str); \
|
||||
std::cout << err_str << std::endl; \
|
||||
return RET; \
|
||||
} \
|
||||
@@ -478,9 +478,9 @@ int main() {
|
||||
|
||||
// Get ECC error counts
|
||||
amdsmi_error_count_t err_cnt_info = {};
|
||||
ret = amdsmi_get_gpu_ecc_error_count(processor_handles[j], &err_cnt_info);
|
||||
ret = amdsmi_get_gpu_total_ecc_count(processor_handles[j], &err_cnt_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_gpu_ecc_error_count:\n");
|
||||
printf(" Output of amdsmi_get_gpu_total_ecc_count:\n");
|
||||
printf("\tCorrectable errors: %lu\n", err_cnt_info.correctable_count);
|
||||
printf("\tUncorrectable errors: %lu\n\n",
|
||||
err_cnt_info.uncorrectable_count);
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
const char *err_str; \
|
||||
std::cout << "AMDSMI call returned " << RET << " at line " \
|
||||
<< __LINE__ << std::endl; \
|
||||
amdsmi_status_string(RET, &err_str); \
|
||||
amdsmi_status_code_to_string(RET, &err_str); \
|
||||
std::cout << err_str << std::endl; \
|
||||
return RET; \
|
||||
} \
|
||||
@@ -269,9 +269,9 @@ int main() {
|
||||
|
||||
// Get ECC error counts
|
||||
amdsmi_error_count_t err_cnt_info = {};
|
||||
ret = amdsmi_get_gpu_ecc_error_count(processor_handles[j], &err_cnt_info);
|
||||
ret = amdsmi_get_gpu_total_ecc_count(processor_handles[j], &err_cnt_info);
|
||||
CHK_AMDSMI_RET(ret)
|
||||
printf(" Output of amdsmi_get_gpu_ecc_error_count:\n");
|
||||
printf(" Output of amdsmi_get_gpu_total_ecc_count:\n");
|
||||
printf("\tCorrectable errors: %lu\n", err_cnt_info.correctable_count);
|
||||
printf("\tUncorrectable errors: %lu\n\n",
|
||||
err_cnt_info.uncorrectable_count);
|
||||
|
||||
@@ -433,16 +433,6 @@ typedef enum {
|
||||
* @brief Available clock types.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Software components
|
||||
*/
|
||||
typedef enum {
|
||||
AMDSMI_SW_COMP_FIRST = 0x0,
|
||||
|
||||
AMDSMI_SW_COMP_DRIVER = AMDSMI_SW_COMP_FIRST, //!< Driver
|
||||
|
||||
AMDSMI_SW_COMP_LAST = AMDSMI_SW_COMP_DRIVER
|
||||
} amdsmi_sw_component_t;
|
||||
|
||||
/**
|
||||
* Event counter types
|
||||
@@ -1064,41 +1054,10 @@ typedef struct {
|
||||
uint32_t cu_occupancy; //!< Compute Unit usage in percent
|
||||
} amdsmi_process_info_t;
|
||||
|
||||
/**
|
||||
* @brief Opaque handle to function-support object
|
||||
*/
|
||||
typedef struct amdsmi_func_id_iter_handle * amdsmi_func_id_iter_handle_t;
|
||||
|
||||
//! Place-holder "variant" for functions that have don't have any variants,
|
||||
//! but do have monitors or sensors.
|
||||
#define AMDSMI_DEFAULT_VARIANT 0xFFFFFFFFFFFFFFFF
|
||||
|
||||
/**
|
||||
* @brief This union holds the value of an ::amdsmi_func_id_iter_handle_t. The
|
||||
* value may be a function name, or an ennumerated variant value of types
|
||||
* such as ::amdsmi_memory_type_t, ::amdsmi_temperature_metric_t, etc.
|
||||
*/
|
||||
typedef union {
|
||||
uint64_t id; //!< uint64_t representation of value
|
||||
const char *name; //!< name string (applicable to functions only)
|
||||
union {
|
||||
//!< Used for ::amdsmi_memory_type_t variants
|
||||
amdsmi_memory_type_t memory_type;
|
||||
//!< Used for ::amdsmi_temperature_metric_t variants
|
||||
amdsmi_temperature_metric_t temp_metric;
|
||||
//!< Used for ::amdsmi_event_type_t variants
|
||||
amdsmi_event_type_t evnt_type;
|
||||
//!< Used for ::amdsmi_event_group_t variants
|
||||
amdsmi_event_group_t evnt_group;
|
||||
//!< Used for ::amdsmi_clk_type_t variants
|
||||
amdsmi_clk_type_t clk_type;
|
||||
//!< Used for ::amdsmi_fw_block_t variants
|
||||
amdsmi_fw_block_t fw_block;
|
||||
//!< Used for ::amdsmi_gpu_block_t variants
|
||||
amdsmi_gpu_block_t gpu_block_type;
|
||||
};
|
||||
} amdsmi_func_id_value_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
/** @defgroup InitShutAdmin Initialization and Shutdown
|
||||
* These functions are used for initialization of AMD SMI and clean up when done.
|
||||
@@ -1273,7 +1232,7 @@ amdsmi_status_t amdsmi_get_processor_handle_from_bdf(amdsmi_bdf_t bdf, amdsmi_pr
|
||||
* @p id. This ID is an identification of the type of device, so calling this
|
||||
* function for different devices will give the same value if they are kind
|
||||
* of device. Consequently, this function should not be used to distinguish
|
||||
* one device from another. amdsmi_get_gpu_pci_id() should be used to get a
|
||||
* one device from another. admsmi_get_gpu_bdf_id() should be used to get a
|
||||
* unique identifier.
|
||||
*
|
||||
* @param[in] processor_handle a processor handle
|
||||
@@ -1403,22 +1362,6 @@ amdsmi_status_t amdsmi_get_gpu_subsystem_id(amdsmi_processor_handle processor_ha
|
||||
amdsmi_status_t
|
||||
amdsmi_get_gpu_subsystem_name(amdsmi_processor_handle processor_handle, char *name, size_t len);
|
||||
|
||||
/**
|
||||
* @brief Get the drm minor number associated with this device
|
||||
*
|
||||
* @details Given a processor handle @p processor_handle, find its render device file
|
||||
* /dev/dri/renderDN where N corresponds to its minor number.
|
||||
*
|
||||
* @param[in] processor_handle a processor handle
|
||||
*
|
||||
* @param[in,out] minor a pointer to a uint32_t into which minor number will
|
||||
* be copied
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_get_gpu_drm_render_minor(amdsmi_processor_handle processor_handle, uint32_t *minor);
|
||||
|
||||
/** @} End IDQuer */
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -1478,7 +1421,7 @@ amdsmi_get_gpu_pci_bandwidth(amdsmi_processor_handle processor_handle, amdsmi_pc
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_get_gpu_pci_id(amdsmi_processor_handle processor_handle, uint64_t *bdfid);
|
||||
amdsmi_status_t admsmi_get_gpu_bdf_id(amdsmi_processor_handle processor_handle, uint64_t *bdfid);
|
||||
|
||||
/**
|
||||
* @brief Get the NUMA node associated with a device
|
||||
@@ -1732,12 +1675,13 @@ amdsmi_get_gpu_memory_usage(amdsmi_processor_handle processor_handle, amdsmi_mem
|
||||
uint64_t *used);
|
||||
|
||||
/**
|
||||
* @brief The first call to this API returns the number of bad pages which
|
||||
* should be used to allocate the buffer that should contain the bad page
|
||||
* records.
|
||||
* @brief Get the bad pages of a processor.
|
||||
* @details This call will query the device @p processor_handle for the
|
||||
* number of bad pages (written to @p num_pages address). The results are
|
||||
* written to address held by the @p info pointer.
|
||||
* The first call to this API returns the number of bad pages which
|
||||
* should be used to allocate the buffer that should contain the bad page
|
||||
* records.
|
||||
* @param[in] processor_handle a processor handle
|
||||
* @param[out] num_pages Number of bad page records.
|
||||
* @param[out] info The results will be written to the
|
||||
@@ -1772,27 +1716,6 @@ amdsmi_status_t
|
||||
amdsmi_get_gpu_ras_block_features_enabled(amdsmi_processor_handle processor_handle, amdsmi_gpu_block_t block,
|
||||
amdsmi_ras_err_state_t *state);
|
||||
|
||||
/**
|
||||
* @brief Get percentage of time any device memory is being used
|
||||
*
|
||||
* @details Given a processor handle @p processor_handle, this function returns the
|
||||
* percentage of time that any device memory is being used for the specified
|
||||
* device.
|
||||
*
|
||||
* @param[in] processor_handle a processor handle
|
||||
*
|
||||
* @param[in,out] busy_percent a pointer to the uint32_t to which the busy
|
||||
* percent will be written
|
||||
* If this parameter is nullptr, this function will return
|
||||
* ::AMDSMI_STATUS_INVAL if the function is supported with the provided,
|
||||
* arguments and ::AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the
|
||||
* provided arguments.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_get_gpu_memory_busy_percent(amdsmi_processor_handle processor_handle, uint32_t *busy_percent);
|
||||
|
||||
/**
|
||||
* @brief Get information about reserved ("retired") memory pages
|
||||
*
|
||||
@@ -2024,28 +1947,6 @@ amdsmi_status_t amdsmi_set_gpu_fan_speed(amdsmi_processor_handle processor_handl
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get percentage of time device is busy doing any processing
|
||||
*
|
||||
* @details Given a processor handle @p processor_handle, this function returns the
|
||||
* percentage of time that the specified device is busy. The device is
|
||||
* considered busy if any one or more of its sub-blocks are working, and idle
|
||||
* if none of the sub-blocks are working.
|
||||
*
|
||||
* @param[in] processor_handle a processor handle
|
||||
*
|
||||
* @param[in,out] busy_percent a pointer to the uint32_t to which the busy
|
||||
* percent will be written
|
||||
* If this parameter is nullptr, this function will return
|
||||
* ::AMDSMI_STATUS_INVAL if the function is supported with the provided,
|
||||
* arguments and ::AMDSMI_STATUS_NOT_SUPPORTED if it is not supported with the
|
||||
* provided arguments.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_get_busy_percent(amdsmi_processor_handle processor_handle, uint32_t *busy_percent);
|
||||
|
||||
/**
|
||||
* @brief Get coarse grain utilization counter of the specified device
|
||||
*
|
||||
@@ -2393,9 +2294,6 @@ amdsmi_status_t
|
||||
* @brief Set the PowerPlay performance level associated with the device with
|
||||
* provided processor handle with the provided value.
|
||||
*
|
||||
* @deprecated :: amdsmi_set_gpu_perf_level_v1() is preferred, with an
|
||||
* interface that more closely matches the rest of the amd_smi API.
|
||||
*
|
||||
* @details Given a processor handle @p processor_handle and an ::amdsmi_dev_perf_level_t @p
|
||||
* perf_level, this function will set the PowerPlay performance level for the
|
||||
* device to the value @p perf_lvl.
|
||||
@@ -2411,32 +2309,10 @@ amdsmi_status_t
|
||||
amdsmi_status_t
|
||||
amdsmi_set_gpu_perf_level(amdsmi_processor_handle processor_handle, amdsmi_dev_perf_level_t perf_lvl);
|
||||
|
||||
/**
|
||||
* @brief Set the PowerPlay performance level associated with the device with
|
||||
* provided processor handle with the provided value.
|
||||
*
|
||||
* @details Given a processor handle @p processor_handle and an ::amdsmi_dev_perf_level_t @p
|
||||
* perf_level, this function will set the PowerPlay performance level for the
|
||||
* device to the value @p perf_lvl.
|
||||
*
|
||||
* @note This function requires root access
|
||||
*
|
||||
* @param[in] processor_handle a processor handle
|
||||
*
|
||||
* @param[in] perf_lvl the value to which the performance level should be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_set_gpu_perf_level_v1(amdsmi_processor_handle processor_handle, amdsmi_dev_perf_level_t perf_lvl);
|
||||
|
||||
/**
|
||||
* @brief Set the overdrive percent associated with the device with provided
|
||||
* processor handle with the provided value. See details for WARNING.
|
||||
*
|
||||
* @deprecated This function is deprecated. :: amdsmi_set_gpu_overdrive_level_v1
|
||||
* has the same functionaltiy, with an interface that more closely
|
||||
* matches the rest of the amd_smi API.
|
||||
*
|
||||
* @details Given a processor handle @p processor_handle and an overdrive level @p od,
|
||||
* this function will set the overdrive level for the device to the value
|
||||
@@ -2471,45 +2347,6 @@ amdsmi_status_t
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_gpu_overdrive_level(amdsmi_processor_handle processor_handle, uint32_t od);
|
||||
|
||||
/**
|
||||
* @brief Set the overdrive percent associated with the device with provided
|
||||
* processor handle with the provided value. See details for WARNING.
|
||||
*
|
||||
* @details Given a processor handle @p processor_handle and an overdrive level @p od,
|
||||
* this function will set the overdrive level for the device to the value
|
||||
* @p od. The overdrive level is an integer value between 0 and 20, inclusive,
|
||||
* which represents the overdrive percentage; e.g., a value of 5 specifies
|
||||
* an overclocking of 5%.
|
||||
*
|
||||
* The overdrive level is specific to the gpu system clock.
|
||||
*
|
||||
* The overdrive level is the percentage above the maximum Performance Level
|
||||
* to which overclocking will be limited. The overclocking percentage does
|
||||
* not apply to clock speeds other than the maximum. This percentage is
|
||||
* limited to 20%.
|
||||
*
|
||||
* ******WARNING******
|
||||
* Operating your AMD GPU outside of official AMD specifications or outside of
|
||||
* factory settings, including but not limited to the conducting of
|
||||
* overclocking (including use of this overclocking software, even if such
|
||||
* software has been directly or indirectly provided by AMD or otherwise
|
||||
* affiliated in any way with AMD), may cause damage to your AMD GPU, system
|
||||
* components and/or result in system failure, as well as cause other problems.
|
||||
* DAMAGES CAUSED BY USE OF YOUR AMD GPU OUTSIDE OF OFFICIAL AMD SPECIFICATIONS
|
||||
* OR OUTSIDE OF FACTORY SETTINGS ARE NOT COVERED UNDER ANY AMD PRODUCT
|
||||
* WARRANTY AND MAY NOT BE COVERED BY YOUR BOARD OR SYSTEM MANUFACTURER'S
|
||||
* WARRANTY. Please use this utility with caution.
|
||||
*
|
||||
* @note This function requires root access
|
||||
*
|
||||
* @param[in] processor_handle a processor handle
|
||||
*
|
||||
* @param[in] od the value to which the overdrive level should be set
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t amdsmi_set_gpu_overdrive_level_v1(amdsmi_processor_handle processor_handle, uint32_t od);
|
||||
|
||||
/**
|
||||
* @brief Control the set of allowed frequencies that can be used for the
|
||||
* specified clock.
|
||||
@@ -2566,34 +2403,7 @@ amdsmi_status_t amdsmi_set_clk_freq(amdsmi_processor_handle processor_handle,
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_get_version(amdsmi_version_t *version);
|
||||
|
||||
/**
|
||||
* @brief Get the driver version string for the current system.
|
||||
*
|
||||
* @details Given a software component @p component, a pointer to a char
|
||||
* buffer, @p ver_str, this function will write the driver version string
|
||||
* (up to @p len characters) for the current system to @p ver_str. The caller
|
||||
* must ensure that it is safe to write at least @p len characters to @p
|
||||
* ver_str.
|
||||
*
|
||||
* @param[in] component The component for which the version string is being
|
||||
* requested
|
||||
*
|
||||
* @param[in,out] ver_str A pointer to a buffer of char's to which the version
|
||||
* of @p component will be written
|
||||
*
|
||||
* @param[in] len the length of the caller provided buffer @p name.
|
||||
*
|
||||
* @note ::AMDSMI_STATUS_INSUFFICIENT_SIZE is returned if @p len bytes is not
|
||||
* large enough to hold the entire name. In this case, only @p len bytes will
|
||||
* be written.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_get_version_str(amdsmi_sw_component_t component, char *ver_str,
|
||||
uint32_t len);
|
||||
amdsmi_get_lib_version(amdsmi_version_t *version);
|
||||
|
||||
/** @} End VersQuer */
|
||||
|
||||
@@ -2693,7 +2503,7 @@ amdsmi_status_t amdsmi_get_gpu_ecc_status(amdsmi_processor_handle processor_han
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_status_string(amdsmi_status_t status, const char **status_string);
|
||||
amdsmi_status_code_to_string(amdsmi_status_t status, const char **status_string);
|
||||
|
||||
/** @} End ErrQuer */
|
||||
|
||||
@@ -3125,7 +2935,7 @@ amdsmi_topo_get_link_weight(amdsmi_processor_handle processor_handle_src, amdsmi
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_get_minmax_bandwidth(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst,
|
||||
admsmi_get_minmax_bandwith_between_processors(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst,
|
||||
uint64_t *min_bandwidth, uint64_t *max_bandwidth);
|
||||
|
||||
/**
|
||||
@@ -3179,223 +2989,6 @@ amdsmi_is_P2P_accessible(amdsmi_processor_handle processor_handle_src, amdsmi_pr
|
||||
|
||||
/** @} End HWTopo */
|
||||
|
||||
/*****************************************************************************/
|
||||
/** @defgroup APISupport Supported Functions
|
||||
* API function support varies by both GPU type and the version of the
|
||||
* installed ROCm stack. The functions described in this section can be used
|
||||
* to determine, up front, which functions are supported for a given device
|
||||
* on a system. If such "up front" knowledge of support for a function is not
|
||||
* needed, alternatively, one can call a device related function and check the
|
||||
* return code.
|
||||
*
|
||||
* Some functions have several variations ("variants") where some variants are
|
||||
* supported and others are not. For example, on a given device,
|
||||
* :: amdsmi_get_temp_metric may support some types of temperature metrics
|
||||
* (e.g., ::AMDSMI_TEMP_CRITICAL_HYST), but not others
|
||||
* (e.g., ::AMDSMI_TEMP_EMERGENCY).
|
||||
*
|
||||
* In addition to a top level of variant support for a function, a function
|
||||
* may have varying support for monitors/sensors. These are considered
|
||||
* "sub-variants" in functions described in this section. Continuing the
|
||||
* :: amdsmi_get_temp_metric example, if variant
|
||||
* ::AMDSMI_TEMP_CRITICAL_HYST is supported, perhaps
|
||||
* only the sub-variant sensors ::AMDSMI_TEMP_TYPE_EDGE
|
||||
* and ::AMDSMI_TEMP_TYPE_EDGE are supported, but not
|
||||
* ::AMDSMI_TEMP_TYPE_MEMORY.
|
||||
*
|
||||
* In cases where a function takes in a sensor id parameter but does not have
|
||||
* any "top level" variants, the functions in this section will indicate a
|
||||
* default "variant", ::AMDSMI_DEFAULT_VARIANT, for the top level variant, and
|
||||
* the various monitor support will be sub-variants of this.
|
||||
*
|
||||
* The functions in this section use the "iterator" concept to list which
|
||||
* functions are supported; to list which variants of the supported functions
|
||||
* are supported; and finally which monitors/sensors are supported for a
|
||||
* variant.
|
||||
*
|
||||
* Here is example code that prints out all supported functions, their
|
||||
* supported variants and sub-variants. Please see the related descriptions
|
||||
* functions and AMDSMI types.
|
||||
* @latexonly
|
||||
* \pagebreak
|
||||
* @endlatexonly
|
||||
* @code{.cpp}
|
||||
* amdsmi_func_id_iter_handle_t iter_handle, var_iter, sub_var_iter;
|
||||
* amdsmi_func_id_value_t value;
|
||||
* amdsmi_status_t err;
|
||||
* amdsmi_processor_handle device;
|
||||
*
|
||||
* // Get the processor handle via amdsmi_get_processor_handles()
|
||||
* // ... ...
|
||||
*
|
||||
* std::cout << "Supported AMDSMI Functions:" << std::endl; *
|
||||
* err = amdsmi_open_supported_func_iterator(device, &iter_handle);
|
||||
*
|
||||
* while (1) {
|
||||
* err = amdsmi_get_func_iter_value(iter_handle, &value);
|
||||
* std::cout << "Function Name: " << value.name << std::endl;
|
||||
*
|
||||
* err = amdsmi_open_supported_variant_iterator(iter_handle, &var_iter);
|
||||
* if (err != AMDSMI_STATUS_NO_DATA) {
|
||||
* std::cout << "\tVariants/Monitors: ";
|
||||
* while (1) {
|
||||
* err = amdsmi_get_func_iter_value(var_iter, &value);
|
||||
* if (value.id == AMDSMI_DEFAULT_VARIANT) {
|
||||
* std::cout << "Default Variant ";
|
||||
* } else {
|
||||
* std::cout << value.id;
|
||||
* }
|
||||
* std::cout << " (";
|
||||
*
|
||||
* err =
|
||||
* amdsmi_open_supported_variant_iterator(var_iter, &sub_var_iter);
|
||||
* if (err != AMDSMI_STATUS_NO_DATA) {
|
||||
*
|
||||
* while (1) {
|
||||
* err = amdsmi_get_func_iter_value(sub_var_iter, &value);
|
||||
* std::cout << value.id << ", ";
|
||||
*
|
||||
* err = amdsmi_next_func_iter(sub_var_iter);
|
||||
*
|
||||
* if (err == AMDSMI_STATUS_NO_DATA) {
|
||||
* break;
|
||||
* }
|
||||
* }
|
||||
* err = amdsmi_close_supported_func_iterator(&sub_var_iter);
|
||||
* }
|
||||
*
|
||||
* std::cout << "), ";
|
||||
*
|
||||
* err = amdsmi_next_func_iter(var_iter);
|
||||
*
|
||||
* if (err == AMDSMI_STATUS_NO_DATA) {
|
||||
* break;
|
||||
* }
|
||||
* }
|
||||
* std::cout << std::endl;
|
||||
*
|
||||
* err = amdsmi_close_supported_func_iterator(&var_iter);
|
||||
* }
|
||||
*
|
||||
* err = amdsmi_next_func_iter(iter_handle);
|
||||
*
|
||||
* if (err == AMDSMI_STATUS_NO_DATA) {
|
||||
* break;
|
||||
* }
|
||||
* }
|
||||
* err = amdsmi_close_supported_func_iterator(&iter_handle);
|
||||
* }
|
||||
* @endcode
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Get a function name iterator of supported AMDSMI functions for a device
|
||||
*
|
||||
* @details Given a processor handle @p processor_handle, this function will write a function
|
||||
* iterator handle to the caller-provided memory pointed to by @p handle. This
|
||||
* handle can be used to iterate through all the supported functions.
|
||||
*
|
||||
* Note that although this function takes in @p processor_handle as an argument,
|
||||
* ::amdsmi_open_supported_func_iterator itself will not be among the
|
||||
* functions listed as supported. This is because
|
||||
* ::amdsmi_open_supported_func_iterator does not depend on hardware or
|
||||
* driver support and should always be supported.
|
||||
*
|
||||
* @param[in] processor_handle a processor handle of device for which support information is
|
||||
* requested
|
||||
*
|
||||
* @param[in,out] handle A pointer to caller-provided memory to which the
|
||||
* function iterator will be written.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_open_supported_func_iterator(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_func_id_iter_handle_t *handle);
|
||||
|
||||
/**
|
||||
* @brief Get a variant iterator for a given handle
|
||||
*
|
||||
* @details Given a ::amdsmi_func_id_iter_handle_t @p obj_h, this function will
|
||||
* write a function iterator handle to the caller-provided memory pointed to
|
||||
* by @p var_iter. This handle can be used to iterate through all the supported
|
||||
* variants of the provided handle. @p obj_h may be a handle to a function
|
||||
* object, as provided by a call to ::amdsmi_open_supported_func_iterator, or
|
||||
* it may be a variant itself (from a call to
|
||||
* ::amdsmi_open_supported_variant_iterator), it which case @p var_iter will
|
||||
* be an iterator of the sub-variants of @p obj_h (e.g., monitors).
|
||||
*
|
||||
* This call allocates a small amount of memory to @p var_iter. To free this memory
|
||||
* ::amdsmi_close_supported_func_iterator should be called on the returned
|
||||
* iterator handle @p var_iter when it is no longer needed.
|
||||
*
|
||||
* @param[in] obj_h an iterator handle for which the variants are being requested
|
||||
*
|
||||
* @param[in,out] var_iter A pointer to caller-provided memory to which the
|
||||
* sub-variant iterator will be written.
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_open_supported_variant_iterator(amdsmi_func_id_iter_handle_t obj_h,
|
||||
amdsmi_func_id_iter_handle_t *var_iter);
|
||||
|
||||
/**
|
||||
* @brief Advance a function identifer iterator
|
||||
*
|
||||
* @details Given a function id iterator handle (::amdsmi_func_id_iter_handle_t)
|
||||
* @p handle, this function will increment the iterator to point to the next
|
||||
* identifier. After a successful call to this function, obtaining the value
|
||||
* of the iterator @p handle will provide the value of the next item in the
|
||||
* list of functions/variants.
|
||||
*
|
||||
* If there are no more items in the list, ::AMDSMI_STATUS_NO_DATA is returned.
|
||||
*
|
||||
* @param[in] handle A pointer to an iterator handle to be incremented
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_next_func_iter(amdsmi_func_id_iter_handle_t handle);
|
||||
|
||||
/**
|
||||
* @brief Close a variant iterator handle
|
||||
*
|
||||
* @details Given a pointer to an ::amdsmi_func_id_iter_handle_t @p handle, this
|
||||
* function will free the resources being used by the handle
|
||||
*
|
||||
* @param[in] handle A pointer to an iterator handle to be closed
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_close_supported_func_iterator(amdsmi_func_id_iter_handle_t *handle);
|
||||
|
||||
/**
|
||||
* @brief Get the value associated with a function/variant iterator
|
||||
*
|
||||
* @details Given an ::amdsmi_func_id_iter_handle_t @p handle, this function
|
||||
* will write the identifier of the function/variant to the user provided
|
||||
* memory pointed to by @p value.
|
||||
*
|
||||
* @p value may point to a function name, a variant id, or a monitor/sensor
|
||||
* index, depending on what kind of iterator @p handle is
|
||||
*
|
||||
* @param[in] handle An iterator for which the value is being requested
|
||||
*
|
||||
* @param[in,out] value A pointer to an ::amdsmi_func_id_value_t provided by the
|
||||
* caller to which this function will write the value assocaited with @p handle
|
||||
*
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_get_func_iter_value(amdsmi_func_id_iter_handle_t handle,
|
||||
amdsmi_func_id_value_t *value);
|
||||
|
||||
/** @} End APISupport */
|
||||
|
||||
/*****************************************************************************/
|
||||
/** @defgroup EvntNotif Event Notification Functions
|
||||
* These functions are used to configure for and get asynchronous event
|
||||
@@ -3799,7 +3392,7 @@ amdsmi_get_gpu_process_info(amdsmi_processor_handle processor_handle, amdsmi_pro
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Returns the number of ECC errors (correctable and
|
||||
* @brief Returns the total number of ECC errors (correctable and
|
||||
* uncorrectable) in the given GPU.
|
||||
*
|
||||
* @param[in] processor_handle Device which to query
|
||||
@@ -3810,7 +3403,7 @@ amdsmi_get_gpu_process_info(amdsmi_processor_handle processor_handle, amdsmi_pro
|
||||
* @return ::amdsmi_status_t | ::AMDSMI_STATUS_SUCCESS on success, non-zero on fail
|
||||
*/
|
||||
amdsmi_status_t
|
||||
amdsmi_get_gpu_ecc_error_count(amdsmi_processor_handle processor_handle, amdsmi_error_count_t *ec);
|
||||
amdsmi_get_gpu_total_ecc_count(amdsmi_processor_handle processor_handle, amdsmi_error_count_t *ec);
|
||||
|
||||
/** @} End eccinfo */
|
||||
|
||||
|
||||
@@ -129,8 +129,8 @@ typedef struct {
|
||||
|
||||
/* Voltage (mV) */
|
||||
uint16_t voltage_soc;
|
||||
uint16_t voltage_gfx;
|
||||
uint16_t voltage_mem;
|
||||
uint16_t gfx_voltage;
|
||||
uint16_t mem_voltage;
|
||||
|
||||
uint16_t padding1;
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ amdsmi_shut_down() {
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_status_string(amdsmi_status_t status, const char **status_string) {
|
||||
amdsmi_status_code_to_string(amdsmi_status_t status, const char **status_string) {
|
||||
switch (status) {
|
||||
case AMDSMI_STATUS_FAIL_LOAD_MODULE:
|
||||
*status_string = "FAIL_LOAD_MODULE: Fail to load module.";
|
||||
@@ -667,7 +667,7 @@ amdsmi_topo_get_link_weight(amdsmi_processor_handle processor_handle_src, amdsmi
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_get_minmax_bandwidth(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst,
|
||||
admsmi_get_minmax_bandwith_between_processors(amdsmi_processor_handle processor_handle_src, amdsmi_processor_handle processor_handle_dst,
|
||||
uint64_t *min_bandwidth, uint64_t *max_bandwidth) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
@@ -743,145 +743,6 @@ amdsmi_reset_gpu_xgmi_error(amdsmi_processor_handle processor_handle) {
|
||||
return rsmi_wrapper(rsmi_dev_xgmi_error_reset, processor_handle);
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_open_supported_func_iterator(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_func_id_iter_handle_t *handle) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (handle == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_supported_func_iterator_open, processor_handle,
|
||||
reinterpret_cast<rsmi_func_id_iter_handle_t*>(handle));
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_open_supported_variant_iterator(amdsmi_func_id_iter_handle_t obj_h,
|
||||
amdsmi_func_id_iter_handle_t *var_iter) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (var_iter == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
auto r = rsmi_dev_supported_variant_iterator_open(
|
||||
reinterpret_cast<rsmi_func_id_iter_handle_t>(obj_h),
|
||||
reinterpret_cast<rsmi_func_id_iter_handle_t*>(var_iter));
|
||||
return amd::smi::rsmi_to_amdsmi_status(r);
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_next_func_iter(amdsmi_func_id_iter_handle_t handle) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
auto r = rsmi_func_iter_next(
|
||||
reinterpret_cast<rsmi_func_id_iter_handle_t>(handle));
|
||||
return amd::smi::rsmi_to_amdsmi_status(r);
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_close_supported_func_iterator(amdsmi_func_id_iter_handle_t *handle) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (handle == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
auto r = rsmi_dev_supported_func_iterator_close(
|
||||
reinterpret_cast<rsmi_func_id_iter_handle_t*>(handle));
|
||||
return amd::smi::rsmi_to_amdsmi_status(r);
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_get_func_iter_value(amdsmi_func_id_iter_handle_t handle,
|
||||
amdsmi_func_id_value_t *value) {
|
||||
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (value == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
|
||||
static const std::map<std::string, const char*> rsmi_2_amdsmi = {
|
||||
{"rsmi_dev_vram_vendor_get", "amdsmi_get_gpu_vram_vendor"},
|
||||
{"rsmi_dev_id_get", "amdsmi_get_gpu_id"},
|
||||
{"rsmi_dev_vendor_id_get", "amdsmi_get_gpu_asic_info"},
|
||||
{"rsmi_dev_name_get", "amdsmi_get_gpu_board_info"},
|
||||
{"rsmi_dev_sku_get", "amdsmi_get_gpu_board_info"},
|
||||
{"rsmi_dev_brand_get", "amdsmi_get_gpu_asic_info"},
|
||||
{"rsmi_dev_vendor_name_get", "amdsmi_get_gpu_vendor_name"},
|
||||
{"rsmi_dev_serial_number_get", "amdsmi_get_gpu_asic_info"},
|
||||
{"rsmi_dev_subsystem_id_get", "amdsmi_get_gpu_subsystem_id"},
|
||||
{"rsmi_dev_subsystem_name_get", "amdsmi_get_gpu_subsystem_name"},
|
||||
{"rsmi_dev_drm_render_minor_get", "amdsmi_get_gpu_drm_render_minor"},
|
||||
{"rsmi_dev_subsystem_vendor_id_get", "amdsmi_get_gpu_asic_info"},
|
||||
{"rsmi_dev_unique_id_get", "amdsmi_get_gpu_board_info"},
|
||||
{"rsmi_dev_pci_bandwidth_get", "amdsmi_get_gpu_pci_bandwidth"},
|
||||
{"rsmi_dev_pci_id_get", "amdsmi_get_gpu_pci_id"},
|
||||
{"rsmi_dev_pci_throughput_get", "amdsmi_get_gpu_pci_throughput"},
|
||||
{"rsmi_dev_pci_replay_counter_get", " amdsmi_get_gpu_pci_replay_counter"},
|
||||
{"rsmi_dev_pci_bandwidth_set", " amdsmi_set_gpu_pci_bandwidth"},
|
||||
{"rsmi_dev_power_profile_set", " amdsmi_set_gpu_power_profile"},
|
||||
{"rsmi_dev_memory_busy_percent_get", "amdsmi_get_gpu_memory_busy_percent"},
|
||||
{"rsmi_dev_busy_percent_get", "amdsmi_get_busy_percent"},
|
||||
{"rsmi_dev_memory_reserved_pages_get", "amdsmi_get_gpu_memory_reserved_pages"},
|
||||
{"rsmi_dev_overdrive_level_get", "amdsmi_get_gpu_overdrive_level"},
|
||||
{"rsmi_dev_power_profile_presets_get", " amdsmi_get_gpu_power_profile_presets"},
|
||||
{"rsmi_dev_perf_level_set", " amdsmi_set_gpu_perf_level"},
|
||||
{"rsmi_dev_perf_level_set_v1", " amdsmi_set_gpu_perf_level_v1"},
|
||||
{"rsmi_dev_perf_level_get", "amdsmi_get_gpu_perf_level"},
|
||||
{"rsmi_perf_determinism_mode_set", "amdsmi_set_gpu_perf_determinism_mode"},
|
||||
{"rsmi_dev_overdrive_level_set", " amdsmi_set_gpu_overdrive_level"},
|
||||
{"rsmi_dev_vbios_version_get", "amdsmi_get_gpu_vbios_info"},
|
||||
{"rsmi_dev_od_volt_info_get", " amdsmi_get_gpu_od_volt_info"},
|
||||
{"rsmi_dev_od_volt_info_set", " amdsmi_set_gpu_od_volt_info"},
|
||||
{"rsmi_dev_od_volt_curve_regions_get", " amdsmi_get_gpu_od_volt_curve_regions"},
|
||||
{"rsmi_dev_ecc_enabled_get", " amdsmi_get_gpu_ecc_enabled"},
|
||||
{"rsmi_dev_ecc_status_get", " amdsmi_get_gpu_ecc_status"},
|
||||
{"rsmi_dev_counter_group_supported", "amdsmi_gpu_counter_group_supported"},
|
||||
{"rsmi_dev_counter_create", "amdsmi_gpu_create_counter"},
|
||||
{"rsmi_dev_xgmi_error_status", "amdsmi_gpu_xgmi_error_status"},
|
||||
{"rsmi_dev_xgmi_error_reset", "amdsmi_reset_gpu_xgmi_error"},
|
||||
{"rsmi_dev_memory_reserved_pages_get", "amdsmi_get_gpu_memory_reserved_pages"},
|
||||
{"rsmi_topo_numa_affinity_get", "amdsmi_get_gpu_topo_numa_affinity"},
|
||||
{"rsmi_dev_gpu_metrics_info_get", " amdsmi_get_gpu_metrics_info"},
|
||||
{"rsmi_dev_gpu_reset", "amdsmi_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_get_clk_freq"},
|
||||
{"rsmi_dev_gpu_clk_freq_set", " amdsmi_set_clk_freq"},
|
||||
{"rsmi_dev_firmware_version_get", "amdsmi_get_fw_info"},
|
||||
{"rsmi_dev_ecc_count_get", " amdsmi_get_gpu_ecc_count"},
|
||||
{"rsmi_counter_available_counters_get", " amdsmi_get_gpu_available_counters"},
|
||||
{"rsmi_dev_power_cap_get", "amdsmi_get_power_cap_info"},
|
||||
{"rsmi_dev_power_cap_default_get", "amdsmi_get_power_cap_info"},
|
||||
{"rsmi_dev_power_cap_range_get", "amdsmi_get_power_cap_info"},
|
||||
{"rsmi_dev_power_cap_set", " amdsmi_set_power_cap"},
|
||||
{"rsmi_dev_fan_rpms_get", "amdsmi_get_gpu_fan_rpms"},
|
||||
{"rsmi_dev_fan_speed_get", "amdsmi_get_gpu_fan_speed"},
|
||||
{"rsmi_dev_fan_speed_max_get", "amdsmi_get_gpu_fan_speed_max"},
|
||||
{"rsmi_dev_temp_metric_get", " amdsmi_get_temp_metric"},
|
||||
{"rsmi_dev_fan_reset", "amdsmi_reset_gpu_fan"},
|
||||
{"rsmi_dev_fan_speed_set", "amdsmi_set_gpu_fan_speed"},
|
||||
{"rsmi_dev_volt_metric_get", " amdsmi_get_gpu_volt_metric"}
|
||||
};
|
||||
|
||||
auto rocm_func_handle =
|
||||
reinterpret_cast<rsmi_func_id_iter_handle_t>(handle);
|
||||
|
||||
auto r = rsmi_func_iter_value_get(
|
||||
rocm_func_handle,
|
||||
reinterpret_cast<rsmi_func_id_value_t*>(value));
|
||||
|
||||
if ( r != RSMI_STATUS_SUCCESS )
|
||||
return amd::smi::rsmi_to_amdsmi_status(r);
|
||||
|
||||
// Only change the function name, FUNC_ITER == 0
|
||||
if (rocm_func_handle->id_type != 0)
|
||||
return amd::smi::rsmi_to_amdsmi_status(r);
|
||||
|
||||
auto iter = rsmi_2_amdsmi.find(value->name);
|
||||
if (iter != rsmi_2_amdsmi.end()) {
|
||||
value->name = (*iter).second;
|
||||
}
|
||||
|
||||
return amd::smi::rsmi_to_amdsmi_status(r);
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_get_gpu_compute_process_info(amdsmi_process_info_t *procs, uint32_t *num_items) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
@@ -947,16 +808,6 @@ amdsmi_status_t amdsmi_get_gpu_ecc_status(amdsmi_processor_handle processor_han
|
||||
reinterpret_cast<rsmi_ras_err_state_t*>(state));
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_get_busy_percent(amdsmi_processor_handle processor_handle,
|
||||
uint32_t *busy_percent) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (busy_percent == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
return rsmi_wrapper(rsmi_dev_busy_percent_get, processor_handle,
|
||||
busy_percent);
|
||||
}
|
||||
amdsmi_status_t amdsmi_get_gpu_metrics_info(
|
||||
amdsmi_processor_handle processor_handle,
|
||||
amdsmi_gpu_metrics_t *pgpu_metrics) {
|
||||
@@ -1076,13 +927,6 @@ amdsmi_status_t amdsmi_get_gpu_perf_level(amdsmi_processor_handle processor_hand
|
||||
amdsmi_status_t
|
||||
amdsmi_set_gpu_perf_level(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_dev_perf_level_t perf_lvl) {
|
||||
return rsmi_wrapper(rsmi_dev_perf_level_set, processor_handle,
|
||||
static_cast<rsmi_dev_perf_level_t>(perf_lvl));
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_set_gpu_perf_level_v1(amdsmi_processor_handle processor_handle,
|
||||
amdsmi_dev_perf_level_t perf_lvl) {
|
||||
return rsmi_wrapper(rsmi_dev_perf_level_set_v1, processor_handle,
|
||||
static_cast<rsmi_dev_perf_level_t>(perf_lvl));
|
||||
}
|
||||
@@ -1186,7 +1030,7 @@ amdsmi_status_t amdsmi_get_gpu_overdrive_level(
|
||||
|
||||
amdsmi_status_t amdsmi_set_gpu_overdrive_level(
|
||||
amdsmi_processor_handle processor_handle, uint32_t od) {
|
||||
return rsmi_wrapper(rsmi_dev_overdrive_level_set, processor_handle, od);
|
||||
return rsmi_wrapper(rsmi_dev_overdrive_level_set_v1, processor_handle, od);
|
||||
}
|
||||
amdsmi_status_t amdsmi_get_gpu_pci_replay_counter(
|
||||
amdsmi_processor_handle processor_handle, uint64_t *counter) {
|
||||
@@ -1245,13 +1089,6 @@ amdsmi_status_t amdsmi_set_gpu_clk_range(amdsmi_processor_handle processor_handl
|
||||
static_cast<rsmi_clk_type_t>(clkType));
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_set_gpu_overdrive_level_v1(
|
||||
amdsmi_processor_handle processor_handle,
|
||||
uint32_t od) {
|
||||
return rsmi_wrapper(rsmi_dev_overdrive_level_set_v1, processor_handle,
|
||||
od);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_reset_gpu(amdsmi_processor_handle processor_handle) {
|
||||
return rsmi_wrapper(rsmi_dev_gpu_reset, processor_handle);
|
||||
}
|
||||
@@ -1264,12 +1101,6 @@ amdsmi_status_t amdsmi_get_utilization_count(amdsmi_processor_handle processor_h
|
||||
reinterpret_cast<rsmi_utilization_counter_t*>(utilization_counters),
|
||||
count, timestamp);
|
||||
}
|
||||
amdsmi_status_t amdsmi_get_gpu_memory_busy_percent(
|
||||
amdsmi_processor_handle processor_handle,
|
||||
uint32_t *busy_percent) {
|
||||
return rsmi_wrapper(rsmi_dev_memory_busy_percent_get, processor_handle,
|
||||
busy_percent);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_energy_count(amdsmi_processor_handle processor_handle,
|
||||
uint64_t *power, float *counter_resolution, uint64_t *timestamp) {
|
||||
@@ -1277,13 +1108,7 @@ amdsmi_status_t amdsmi_get_energy_count(amdsmi_processor_handle processor_handle
|
||||
power, counter_resolution, timestamp);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_gpu_drm_render_minor(
|
||||
amdsmi_processor_handle processor_handle, uint32_t *minor) {
|
||||
return rsmi_wrapper(rsmi_dev_drm_render_minor_get, processor_handle,
|
||||
minor);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_gpu_pci_id(
|
||||
amdsmi_status_t admsmi_get_gpu_bdf_id(
|
||||
amdsmi_processor_handle processor_handle, uint64_t *bdfid) {
|
||||
return rsmi_wrapper(rsmi_dev_pci_id_get, processor_handle,
|
||||
bdfid);
|
||||
@@ -1295,7 +1120,7 @@ amdsmi_status_t amdsmi_get_gpu_topo_numa_affinity(
|
||||
numa_node);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_version(amdsmi_version_t *version) {
|
||||
amdsmi_status_t amdsmi_get_lib_version(amdsmi_version_t *version) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (version == nullptr)
|
||||
@@ -1306,19 +1131,6 @@ amdsmi_status_t amdsmi_get_version(amdsmi_version_t *version) {
|
||||
return amd::smi::rsmi_to_amdsmi_status(rstatus);
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_version_str(amdsmi_sw_component_t component,
|
||||
char *ver_str,
|
||||
uint32_t len) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (ver_str == nullptr)
|
||||
return AMDSMI_STATUS_INVAL;
|
||||
|
||||
auto status = rsmi_version_str_get(
|
||||
static_cast<rsmi_sw_component_t>(component), ver_str, len);
|
||||
return amd::smi::rsmi_to_amdsmi_status(status);
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_get_gpu_vbios_info(amdsmi_processor_handle processor_handle, amdsmi_vbios_info_t *info) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
@@ -1491,7 +1303,7 @@ amdsmi_get_gpu_bad_page_info(amdsmi_processor_handle processor_handle, uint32_t
|
||||
}
|
||||
|
||||
amdsmi_status_t
|
||||
amdsmi_get_gpu_ecc_error_count(amdsmi_processor_handle processor_handle, amdsmi_error_count_t *ec) {
|
||||
amdsmi_get_gpu_total_ecc_count(amdsmi_processor_handle processor_handle, amdsmi_error_count_t *ec) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
|
||||
if (ec == nullptr) {
|
||||
|
||||
@@ -96,93 +96,4 @@ void TestAPISupportRead::Run(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
amdsmi_func_id_iter_handle_t iter_handle, var_iter, sub_var_iter;
|
||||
amdsmi_func_id_value_t value;
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
IF_VERB(STANDARD) {
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
std::cout << "Supported AMDSMI Functions:" << std::endl;
|
||||
std::cout << "\tVariants (Monitors)" << std::endl;
|
||||
}
|
||||
err = amdsmi_open_supported_func_iterator(processor_handles_[i], &iter_handle);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
while (1) {
|
||||
err = amdsmi_get_func_iter_value(iter_handle, &value);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "Function Name: " << value.name << std::endl;
|
||||
}
|
||||
err = amdsmi_open_supported_variant_iterator(iter_handle, &var_iter);
|
||||
if (err != AMDSMI_STATUS_NO_DATA) {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\tVariants/Monitors: ";
|
||||
}
|
||||
while (1) {
|
||||
err = amdsmi_get_func_iter_value(var_iter, &value);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
if (value.id == AMDSMI_DEFAULT_VARIANT) {
|
||||
std::cout << "Default Variant ";
|
||||
} else {
|
||||
std::cout << value.id;
|
||||
}
|
||||
std::cout << " (";
|
||||
}
|
||||
err =
|
||||
amdsmi_open_supported_variant_iterator(var_iter, &sub_var_iter);
|
||||
if (err != AMDSMI_STATUS_NO_DATA) {
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
while (1) {
|
||||
err = amdsmi_get_func_iter_value(sub_var_iter, &value);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << value.id << ", ";
|
||||
}
|
||||
err = amdsmi_next_func_iter(sub_var_iter);
|
||||
|
||||
if (err == AMDSMI_STATUS_NO_DATA) {
|
||||
break;
|
||||
}
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
err = amdsmi_close_supported_func_iterator(&sub_var_iter);
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "), ";
|
||||
}
|
||||
err = amdsmi_next_func_iter(var_iter);
|
||||
|
||||
if (err == AMDSMI_STATUS_NO_DATA) {
|
||||
break;
|
||||
}
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << std::endl;
|
||||
}
|
||||
err = amdsmi_close_supported_func_iterator(&var_iter);
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
|
||||
err = amdsmi_next_func_iter(iter_handle);
|
||||
|
||||
if (err == AMDSMI_STATUS_NO_DATA) {
|
||||
break;
|
||||
}
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
// err = amdsmi_open_supported_variant_iterator(iter_handle, &var_iter);
|
||||
//
|
||||
}
|
||||
err = amdsmi_close_supported_func_iterator(&iter_handle);
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,27 +94,4 @@ void TestGPUBusyRead::Run(void) {
|
||||
std::cout << "** SetUp Failed for this test. Skipping.**" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t x = 0; x < num_iterations(); ++x) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
err = amdsmi_get_busy_percent(processor_handles_[i], &val_ui32);
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
if (err == AMDSMI_STATUS_FILE_ERROR) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU Busy Percent: Not supported on this machine"
|
||||
<< std::endl;
|
||||
}
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
}
|
||||
} else {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**GPU Busy Percent (Percent Idle):" << std::dec <<
|
||||
val_ui32 << " (" << 100 - val_ui32 << ")" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,20 +145,6 @@ void TestIdInfoRead::Run(void) {
|
||||
}
|
||||
}
|
||||
|
||||
err = amdsmi_get_gpu_drm_render_minor(processor_handles_[i], &drm_render_minor);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_gpu_drm_render_minor(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**DRM Render Minor: " << drm_render_minor << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_gpu_drm_render_minor(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
err = amdsmi_get_gpu_vendor_name(processor_handles_[i], buffer, kBufferLen);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Device Vendor name string not found on this system." <<
|
||||
@@ -231,7 +217,7 @@ void TestIdInfoRead::Run(void) {
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
|
||||
err = amdsmi_get_gpu_pci_id(processor_handles_[i], &val_ui64);
|
||||
err = admsmi_get_gpu_bdf_id(processor_handles_[i], &val_ui64);
|
||||
// Don't check for AMDSMI_STATUS_NOT_SUPPORTED since this should always be
|
||||
// supported. It is not based on a sysfs file.
|
||||
CHK_ERR_ASRT(err)
|
||||
@@ -240,7 +226,7 @@ void TestIdInfoRead::Run(void) {
|
||||
std::cout << " (" << std::dec << val_ui64 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_gpu_pci_id(processor_handles_[i], nullptr);
|
||||
err = admsmi_get_gpu_bdf_id(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,17 +118,6 @@ void TestMemUtilRead::Run(void) {
|
||||
for (uint32_t i = 0; i < num_monitor_devs(); ++i) {
|
||||
PrintDeviceHeader(processor_handles_[i]);
|
||||
|
||||
#if 0
|
||||
err = amdsmi_get_gpu_memory_busy_percent(i, &mem_busy_percent);
|
||||
err_chk("amdsmi_get_gpu_memory_busy_percent()");
|
||||
if (err != AMDSMI_STATUS_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << "GPU Memory Busy %: " << mem_busy_percent <<
|
||||
std::endl;
|
||||
}
|
||||
#endif
|
||||
for (uint32_t mem_type = AMDSMI_MEM_TYPE_FIRST;
|
||||
mem_type <= AMDSMI_MEM_TYPE_LAST; ++mem_type) {
|
||||
err = amdsmi_get_gpu_memory_total(processor_handles_[i],
|
||||
|
||||
@@ -215,7 +215,7 @@ void TestMutualExclusion::Run(void) {
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_get_gpu_subsystem_id(processor_handles_[0], &dmy_ui16);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_get_gpu_pci_id(processor_handles_[0], &dmy_ui64);
|
||||
ret = admsmi_get_gpu_bdf_id(processor_handles_[0], &dmy_ui64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_get_gpu_pci_throughput(processor_handles_[0], &dmy_ui64, &dmy_ui64, &dmy_ui64);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
@@ -245,8 +245,6 @@ void TestMutualExclusion::Run(void) {
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_get_gpu_od_volt_curve_regions(processor_handles_[0], &dmy_ui32, &dmy_vlt_reg);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_set_gpu_overdrive_level_v1(processor_handles_[0], dmy_i32);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_set_clk_freq(processor_handles_[0], CLK_TYPE_SYS, 0);
|
||||
CHECK_RET(ret, AMDSMI_STATUS_BUSY);
|
||||
ret = amdsmi_get_gpu_ecc_count(processor_handles_[0], AMDSMI_GPU_BLOCK_UMC, &dmy_err_cnt);
|
||||
@@ -258,7 +256,6 @@ void TestMutualExclusion::Run(void) {
|
||||
|
||||
/* Other functions holding device mutexes. Listed for reference.
|
||||
amdsmi_dev_sku_get
|
||||
amdsmi_set_gpu_perf_level_v1
|
||||
amdsmi_set_gpu_od_clk_info
|
||||
amdsmi_set_gpu_od_volt_info
|
||||
amdsmi_dev_firmware_version_get
|
||||
@@ -267,7 +264,6 @@ void TestMutualExclusion::Run(void) {
|
||||
amdsmi_dev_brand_get
|
||||
amdsmi_get_gpu_vram_vendor
|
||||
amdsmi_get_gpu_subsystem_name
|
||||
amdsmi_get_gpu_drm_render_minor
|
||||
amdsmi_get_gpu_vendor_name
|
||||
amdsmi_get_gpu_pci_bandwidth
|
||||
amdsmi_set_gpu_pci_bandwidth
|
||||
@@ -283,6 +279,7 @@ void TestMutualExclusion::Run(void) {
|
||||
amdsmi_get_gpu_metrics_info
|
||||
amdsmi_get_gpu_od_volt_curve_regions
|
||||
amdsmi_dev_power_max_get
|
||||
amdsmi_get_power_ave
|
||||
amdsmi_dev_power_cap_get
|
||||
amdsmi_dev_power_cap_range_get
|
||||
amdsmi_set_power_cap
|
||||
@@ -290,8 +287,6 @@ void TestMutualExclusion::Run(void) {
|
||||
amdsmi_set_gpu_power_profile
|
||||
amdsmi_get_gpu_memory_total
|
||||
amdsmi_get_gpu_memory_usage
|
||||
amdsmi_get_gpu_memory_busy_percent
|
||||
amdsmi_get_busy_percent
|
||||
amdsmi_dev_vbios_version_get
|
||||
amdsmi_dev_serial_number_get
|
||||
amdsmi_get_gpu_pci_replay_counter
|
||||
|
||||
@@ -128,14 +128,14 @@ void TestSysInfoRead::Run(void) {
|
||||
}
|
||||
}
|
||||
|
||||
err = amdsmi_get_gpu_pci_id(processor_handles_[i], &val_ui64);
|
||||
err = admsmi_get_gpu_bdf_id(processor_handles_[i], &val_ui64);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**PCI ID (BDFID): 0x" << std::hex << val_ui64;
|
||||
std::cout << " (" << std::dec << val_ui64 << ")" << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = amdsmi_get_gpu_pci_id(processor_handles_[i], nullptr);
|
||||
err = admsmi_get_gpu_bdf_id(processor_handles_[i], nullptr);
|
||||
ASSERT_EQ(err, AMDSMI_STATUS_INVAL);
|
||||
|
||||
err = amdsmi_get_gpu_topo_numa_affinity(processor_handles_[i], &val_ui32);
|
||||
@@ -177,7 +177,7 @@ void TestSysInfoRead::Run(void) {
|
||||
}
|
||||
}
|
||||
|
||||
err = amdsmi_get_version(&ver);
|
||||
err = amdsmi_get_lib_version(&ver);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
ASSERT_TRUE(ver.major != 0xFFFFFFFF && ver.minor != 0xFFFFFFFF &&
|
||||
|
||||
@@ -86,11 +86,6 @@ void TestVersionRead::Close() {
|
||||
|
||||
static const uint32_t kVerMaxStrLen = 80;
|
||||
|
||||
static const std::map<uint32_t, const char *>
|
||||
kComponentNameMap = {
|
||||
{AMDSMI_SW_COMP_DRIVER, "Driver Version"},
|
||||
};
|
||||
|
||||
void TestVersionRead::Run(void) {
|
||||
amdsmi_status_t err;
|
||||
amdsmi_version_t ver = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, nullptr};
|
||||
@@ -101,7 +96,7 @@ void TestVersionRead::Run(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
err = amdsmi_get_version(&ver);
|
||||
err = amdsmi_get_lib_version(&ver);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
ASSERT_TRUE(ver.major != 0xFFFFFFFF && ver.minor != 0xFFFFFFFF &&
|
||||
@@ -110,17 +105,4 @@ void TestVersionRead::Run(void) {
|
||||
std::cout << "\t**AMD SMI Library version: " << ver.major << "." <<
|
||||
ver.minor << "." << ver.patch << " (" << ver.build << ")" << std::endl;
|
||||
}
|
||||
|
||||
char ver_str[kVerMaxStrLen];
|
||||
|
||||
for (uint32_t cmp = AMDSMI_SW_COMP_FIRST; cmp <= AMDSMI_SW_COMP_LAST; ++cmp) {
|
||||
err = amdsmi_get_version_str(static_cast<amdsmi_sw_component_t>(cmp),
|
||||
ver_str, kVerMaxStrLen);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**" << kComponentNameMap.at(cmp) << ": " <<
|
||||
ver_str << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void DumpMonitorInfo(const TestBase *test);
|
||||
if (RET != AMDSMI_STATUS_SUCCESS) { \
|
||||
const char *err_str; \
|
||||
std::cout << "\t===> ERROR: AMDSMI call returned " << (RET) << std::endl; \
|
||||
amdsmi_status_string((RET), &err_str); \
|
||||
amdsmi_status_code_to_string((RET), &err_str); \
|
||||
std::cout << "\t===> (" << err_str << ")" << std::endl; \
|
||||
std::cout << "\t===> at " << __FILE__ << ":" << std::dec << __LINE__ << \
|
||||
std::endl; \
|
||||
|
||||
Ссылка в новой задаче
Block a user