Merge amd-staging into amd-master 20231012
Signed-off-by: guanyu12 <guanyu12@amd.com> Change-Id: I02018dfe5cd2aafe3fb754111242a168fe1b9a60
Этот коммит содержится в:
@@ -697,6 +697,15 @@ typedef enum {
|
||||
RSMI_UTILIZATION_COUNTER_LAST = RSMI_COARSE_GRAIN_MEM_ACTIVITY
|
||||
} RSMI_UTILIZATION_COUNTER_TYPE;
|
||||
|
||||
/**
|
||||
* @brief Power types
|
||||
*/
|
||||
typedef enum {
|
||||
RSMI_AVERAGE_POWER = 0, //!< Average Power
|
||||
RSMI_CURRENT_POWER, //!< Current / Instant Power
|
||||
RSMI_INVALID_POWER = 0xFFFFFFFF //!< Invalid / Undetected Power
|
||||
} RSMI_POWER_TYPE;
|
||||
|
||||
/**
|
||||
* @brief The utilization counter data
|
||||
*/
|
||||
@@ -1729,6 +1738,40 @@ rsmi_dev_power_ave_get(uint32_t dv_ind, uint32_t sensor_ind, uint64_t *power);
|
||||
rsmi_status_t
|
||||
rsmi_dev_current_socket_power_get(uint32_t dv_ind, uint64_t *socket_power);
|
||||
|
||||
/**
|
||||
* @brief A generic get which attempts to retieve current socket power
|
||||
* (also known as instant power) of the device index provided, if not
|
||||
* supported tries to get average power consumed by device. Current
|
||||
* socket power is typically supported by newer devices, whereas average
|
||||
* power is generally reported on older devices. This function
|
||||
* aims to provide backwards compatability depending on device support.
|
||||
*
|
||||
* @details Given a device index @p dv_ind, a pointer to a uint64_t
|
||||
* @p power, and @p type this function will write the current socket or
|
||||
* average power (in microwatts) to the uint64_t pointed to by @p power and
|
||||
* a pointer to its @p type RSMI_POWER_TYPE read.
|
||||
*
|
||||
* @param[in] dv_ind a device index
|
||||
*
|
||||
* @param[inout] power a pointer to uint64_t to which the current or average
|
||||
* power will be written to. If this parameter is nullptr,
|
||||
* this function will return ::RSMI_STATUS_INVALID_ARGS if the function is
|
||||
* supported with the provided, arguments and ::RSMI_STATUS_NOT_SUPPORTED
|
||||
* if it is not supported with the provided arguments.
|
||||
*
|
||||
* @param[inout] type a pointer to RSMI_POWER_TYPE object. Returns the type
|
||||
* of power retrieved from the device. Current power is ::RSMI_CURRENT_POWER
|
||||
* and average power is ::RSMI_AVERAGE_POWER. If an error occurs,
|
||||
* returns an invalid power type ::RSMI_INVALID_POWER.
|
||||
*
|
||||
* @retval ::RSMI_STATUS_SUCCESS call was successful
|
||||
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
|
||||
* support this function with the given arguments
|
||||
* @retval ::RSMI_STATUS_INVALID_ARGS the provided arguments are not valid
|
||||
*/
|
||||
rsmi_status_t rsmi_dev_power_get(uint32_t dv_ind, uint64_t *power,
|
||||
RSMI_POWER_TYPE *type);
|
||||
|
||||
/**
|
||||
* @brief Get the energy accumulator counter of the device with provided
|
||||
* device index.
|
||||
|
||||
@@ -110,6 +110,8 @@ bool isSystemBigEndian();
|
||||
std::string getBuildType();
|
||||
std::string getMyLibPath();
|
||||
int subDirectoryCountInPath(const std::string path);
|
||||
std::string monitor_type_string(amd::smi::MonitorTypes type);
|
||||
std::string power_type_string(RSMI_POWER_TYPE type);
|
||||
template <typename T>
|
||||
std::string print_int_as_hex(T i, bool showHexNotation=true) {
|
||||
std::stringstream ss;
|
||||
|
||||
@@ -53,14 +53,13 @@
|
||||
#include <map>
|
||||
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "rocm_smi/rocm_smi_utils.h"
|
||||
|
||||
#define PRINT_RSMI_ERR(RET) { \
|
||||
if (RET != RSMI_STATUS_SUCCESS) { \
|
||||
const char *err_str; \
|
||||
std::cout << "[ERROR] RSMI call returned " << (RET) \
|
||||
<< " at line " << __LINE__ << "\n"; \
|
||||
rsmi_status_string((RET), &err_str); \
|
||||
std::cout << err_str << "\n"; \
|
||||
<< " at line " << __LINE__ << std::endl; \
|
||||
std::cout << amd::smi::getRSMIStatusString(RET) << std::endl; \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -696,6 +695,10 @@ static rsmi_status_t test_set_memory_partition(uint32_t dv_ind) {
|
||||
return RSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
template<typename T> constexpr float convert_mw_to_w(T mw) {
|
||||
return static_cast<float>(mw / 1000.0);
|
||||
}
|
||||
|
||||
int main() {
|
||||
rsmi_status_t ret;
|
||||
|
||||
@@ -711,9 +714,11 @@ int main() {
|
||||
rsmi_frequencies_t f;
|
||||
uint32_t num_monitor_devs = 0;
|
||||
rsmi_gpu_metrics_t p;
|
||||
RSMI_POWER_TYPE power_type = RSMI_INVALID_POWER;
|
||||
|
||||
rsmi_num_monitor_devices(&num_monitor_devs);
|
||||
for (uint32_t i = 0; i < num_monitor_devs; ++i) {
|
||||
std::cout << "\t**Device #: " << std::dec << i << std::endl;
|
||||
ret = rsmi_dev_id_get(i, &val_ui16);
|
||||
CHK_RSMI_RET_I(ret)
|
||||
std::cout << "\t**Device ID: 0x" << std::hex << val_ui16 << "\n";
|
||||
@@ -816,7 +821,7 @@ int main() {
|
||||
ret = rsmi_dev_temp_metric_get(i, RSMI_TEMP_TYPE_JUNCTION,
|
||||
rsmi_temperature_metric_t::RSMI_TEMP_CURRENT, &val_i64);
|
||||
if (ret == RSMI_STATUS_SUCCESS) {
|
||||
std::cout << val_i64/1000 << "C" << "\n";
|
||||
std::cout << (val_i64 / 1000) << "C" << std::endl;
|
||||
}
|
||||
CHK_RSMI_NOT_SUPPORTED_RET(ret)
|
||||
|
||||
@@ -864,7 +869,22 @@ int main() {
|
||||
std::cout << "\t**Average Power Usage: ";
|
||||
ret = rsmi_dev_power_ave_get(i, 0, &val_ui64);
|
||||
if (ret == RSMI_STATUS_SUCCESS) {
|
||||
std::cout << static_cast<float>(val_ui64)/1000 << " W" << "\n";
|
||||
std::cout << convert_mw_to_w(val_ui64) << " W" << std::endl;
|
||||
}
|
||||
CHK_RSMI_NOT_SUPPORTED_RET(ret)
|
||||
|
||||
std::cout << "\t**Current Socket Power Usage: ";
|
||||
ret = rsmi_dev_current_socket_power_get(i, &val_ui64);
|
||||
if (ret == RSMI_STATUS_SUCCESS) {
|
||||
std::cout << convert_mw_to_w(val_ui64) << " W" << std::endl;
|
||||
}
|
||||
CHK_RSMI_NOT_SUPPORTED_RET(ret)
|
||||
|
||||
std::cout << "\t**Generic Power Usage: ";
|
||||
ret = rsmi_dev_power_get(i, &val_ui64, &power_type);
|
||||
if (ret == RSMI_STATUS_SUCCESS) {
|
||||
std::cout << "[" << amd::smi::power_type_string(power_type) << "] "
|
||||
<< convert_mw_to_w(val_ui64) << " W" << std::endl;
|
||||
}
|
||||
CHK_RSMI_NOT_SUPPORTED_RET(ret)
|
||||
std::cout << "\t=======" << "\n";
|
||||
|
||||
+98
-43
@@ -61,7 +61,6 @@
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <tuple>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
@@ -77,7 +76,11 @@
|
||||
#include "rocm_smi/rocm_smi64Config.h"
|
||||
#include "rocm_smi/rocm_smi_logger.h"
|
||||
|
||||
using namespace amd::smi;
|
||||
using amd::smi::monitorTypesToString;
|
||||
using amd::smi::getRSMIStatusString;
|
||||
using amd::smi::AMDGpuMetricsUnitType_t;
|
||||
using amd::smi::AMDGpuMetricTypeId_t;
|
||||
auto &devInfoTypesStrings = amd::smi::RocmSMI::devInfoTypesStrings;
|
||||
|
||||
static const uint32_t kMaxOverdriveLevel = 20;
|
||||
static const float kEnergyCounterResolution = 15.3F;
|
||||
@@ -2838,7 +2841,7 @@ rsmi_dev_current_socket_power_get(uint32_t dv_ind, uint64_t *socket_power) {
|
||||
rsmi_status_t rsmiReturn = RSMI_STATUS_NOT_SUPPORTED;
|
||||
std::string val_str;
|
||||
uint32_t sensor_ind = 1; // socket_power sysfs files have 1-based indices
|
||||
MonitorTypes mon_type = amd::smi::kMonPowerInput;
|
||||
amd::smi::MonitorTypes mon_type = amd::smi::kMonPowerInput;
|
||||
ss << __PRETTY_FUNCTION__ << " | ======= start =======, dv_ind="
|
||||
<< std::to_string(dv_ind);
|
||||
LOG_TRACE(ss);
|
||||
@@ -2905,6 +2908,58 @@ rsmi_dev_current_socket_power_get(uint32_t dv_ind, uint64_t *socket_power) {
|
||||
CATCH
|
||||
}
|
||||
|
||||
rsmi_status_t rsmi_dev_power_get(uint32_t dv_ind, uint64_t *power,
|
||||
RSMI_POWER_TYPE *type) {
|
||||
TRY
|
||||
std::ostringstream ss;
|
||||
ss << __PRETTY_FUNCTION__ << " | ======= start =======, dv_ind="
|
||||
<< std::to_string(dv_ind);
|
||||
LOG_TRACE(ss);
|
||||
rsmi_status_t ret = RSMI_STATUS_NOT_SUPPORTED;
|
||||
RSMI_POWER_TYPE temp_power_type = RSMI_INVALID_POWER;
|
||||
uint64_t temp_power = 0;
|
||||
|
||||
if (type == nullptr || power == nullptr) {
|
||||
ret = RSMI_STATUS_INVALID_ARGS;
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: " << amd::smi::power_type_string(temp_power_type)
|
||||
<< " | Cause: power or monitor type was a null ptr reference"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(ret) << " |";
|
||||
LOG_ERROR(ss);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// only change return value on success, invalid otherwise
|
||||
rsmi_status_t temp_ret = rsmi_dev_current_socket_power_get(dv_ind, &temp_power);
|
||||
if (temp_ret == RSMI_STATUS_SUCCESS) {
|
||||
temp_power_type = RSMI_CURRENT_POWER;
|
||||
ret = temp_ret;
|
||||
} else {
|
||||
temp_ret = rsmi_dev_power_ave_get(dv_ind, 0, &temp_power);
|
||||
if (temp_ret == RSMI_STATUS_SUCCESS) {
|
||||
temp_power_type = RSMI_AVERAGE_POWER;
|
||||
ret = temp_ret;
|
||||
}
|
||||
}
|
||||
*power = temp_power;
|
||||
*type = temp_power_type;
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
<< " | Success "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: " << amd::smi::power_type_string(temp_power_type)
|
||||
<< " | Data: " << *power
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(ret) << " |";
|
||||
LOG_TRACE(ss);
|
||||
return ret;
|
||||
CATCH
|
||||
}
|
||||
|
||||
rsmi_status_t
|
||||
rsmi_dev_energy_count_get(uint32_t dv_ind, uint64_t *power,
|
||||
float *counter_resolution, uint64_t *timestamp) {
|
||||
@@ -3106,7 +3161,7 @@ rsmi_dev_memory_total_get(uint32_t dv_ind, rsmi_memory_type_t mem_type,
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | inside success fallback... "
|
||||
<< " | Device #: " << std::to_string(dv_ind)
|
||||
<< " | Type = " << RocmSMI::devInfoTypesStrings.at(mem_type_file)
|
||||
<< " | Type = " << devInfoTypesStrings.at(mem_type_file)
|
||||
<< " | Data: total = " << std::to_string(*total)
|
||||
<< " | ret = " << getRSMIStatusString(RSMI_STATUS_SUCCESS);
|
||||
LOG_DEBUG(ss);
|
||||
@@ -3117,7 +3172,7 @@ rsmi_dev_memory_total_get(uint32_t dv_ind, rsmi_memory_type_t mem_type,
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | after fallback... "
|
||||
<< " | Device #: " << std::to_string(dv_ind)
|
||||
<< " | Type = " << RocmSMI::devInfoTypesStrings.at(mem_type_file)
|
||||
<< " | Type = " << devInfoTypesStrings.at(mem_type_file)
|
||||
<< " | Data: total = " << std::to_string(*total)
|
||||
<< " | ret = " << getRSMIStatusString(ret);
|
||||
LOG_DEBUG(ss);
|
||||
@@ -3166,7 +3221,7 @@ rsmi_dev_memory_usage_get(uint32_t dv_ind, rsmi_memory_type_t mem_type,
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " no fallback needed! - "
|
||||
<< " | Device #: " << std::to_string(dv_ind)
|
||||
<< " | Type = " << RocmSMI::devInfoTypesStrings.at(mem_type_file)
|
||||
<< " | Type = " << devInfoTypesStrings.at(mem_type_file)
|
||||
<< " | Data: Used = " << std::to_string(*used)
|
||||
<< " | Data: total = " << std::to_string(total)
|
||||
<< " | ret = " << getRSMIStatusString(ret);
|
||||
@@ -3177,7 +3232,7 @@ rsmi_dev_memory_usage_get(uint32_t dv_ind, rsmi_memory_type_t mem_type,
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | in fallback == success ..."
|
||||
<< " | Device #: " << std::to_string(dv_ind)
|
||||
<< " | Type = " << RocmSMI::devInfoTypesStrings.at(mem_type_file)
|
||||
<< " | Type = " << devInfoTypesStrings.at(mem_type_file)
|
||||
<< " | Data: Used = " << std::to_string(*used)
|
||||
<< " | Data: total = " << std::to_string(total)
|
||||
<< " | ret = " << getRSMIStatusString(RSMI_STATUS_SUCCESS);
|
||||
@@ -3188,7 +3243,7 @@ rsmi_dev_memory_usage_get(uint32_t dv_ind, rsmi_memory_type_t mem_type,
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | at end!!!! after fallback ..."
|
||||
<< " | Device #: " << std::to_string(dv_ind)
|
||||
<< " | Type = " << RocmSMI::devInfoTypesStrings.at(mem_type_file)
|
||||
<< " | Type = " << devInfoTypesStrings.at(mem_type_file)
|
||||
<< " | Data: Used = " << std::to_string(*used)
|
||||
<< " | ret = " << getRSMIStatusString(ret);
|
||||
LOG_DEBUG(ss);
|
||||
@@ -4444,7 +4499,7 @@ rsmi_dev_compute_partition_get(uint32_t dv_ind, char *compute_partition,
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< " | Cause: len was 0 or compute_partition variable was null"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(RSMI_STATUS_INVALID_ARGS) << " |";
|
||||
@@ -4463,7 +4518,7 @@ rsmi_dev_compute_partition_get(uint32_t dv_ind, char *compute_partition,
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< " | Cause: could not retrieve current compute partition"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(ret) << " |";
|
||||
@@ -4480,7 +4535,7 @@ rsmi_dev_compute_partition_get(uint32_t dv_ind, char *compute_partition,
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< " | Cause: requested size was insufficient"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(RSMI_STATUS_INSUFFICIENT_SIZE) << " |";
|
||||
@@ -4492,7 +4547,7 @@ rsmi_dev_compute_partition_get(uint32_t dv_ind, char *compute_partition,
|
||||
<< " | Success "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< " | Data: " << compute_partition
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(ret) << " |";
|
||||
@@ -4549,7 +4604,7 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< " | Cause: requested setting was invalid"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(RSMI_STATUS_INVALID_ARGS) << " |";
|
||||
@@ -4567,7 +4622,7 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< " | Cause: not an available compute partition setting"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(available_ret) << " |";
|
||||
@@ -4586,7 +4641,7 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< " | Cause: could retrieve current compute partition or retrieved"
|
||||
<< " unexpected data"
|
||||
<< " | Returning = "
|
||||
@@ -4602,7 +4657,7 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
|
||||
<< " | Success - compute partition was already set at requested value"
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< " | Data: " << newComputePartitionStr
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(RSMI_STATUS_SUCCESS) << " |";
|
||||
@@ -4619,7 +4674,7 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
|
||||
<< " | Success "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< " | Data: " << newComputePartitionStr
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(returnResponse) << " |";
|
||||
@@ -4691,7 +4746,7 @@ rsmi_dev_memory_partition_set(uint32_t dv_ind,
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< " | Cause: device board name does not support this action"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(RSMI_STATUS_INVALID_ARGS) << " |";
|
||||
@@ -4716,7 +4771,7 @@ rsmi_dev_memory_partition_set(uint32_t dv_ind,
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< " | Cause: requested setting was invalid"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(RSMI_STATUS_INVALID_ARGS) << " |";
|
||||
@@ -4734,7 +4789,7 @@ rsmi_dev_memory_partition_set(uint32_t dv_ind,
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< " | Cause: could retrieve current memory partition or retrieved"
|
||||
<< " unexpected data"
|
||||
<< " | Returning = "
|
||||
@@ -4751,7 +4806,7 @@ rsmi_dev_memory_partition_set(uint32_t dv_ind,
|
||||
<< " setting"
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< " | Data: " << newMemoryPartition
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(RSMI_STATUS_SUCCESS) << " |";
|
||||
@@ -4770,7 +4825,7 @@ rsmi_dev_memory_partition_set(uint32_t dv_ind,
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< " | Cause: issue writing reqested setting of " + newMemoryPartition
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(err) << " |";
|
||||
@@ -4784,7 +4839,7 @@ rsmi_dev_memory_partition_set(uint32_t dv_ind,
|
||||
<< " | Success - if restart completed successfully"
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< " | Data: " << newMemoryPartition
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(restartRet) << " |";
|
||||
@@ -4806,7 +4861,7 @@ rsmi_dev_memory_partition_get(uint32_t dv_ind, char *memory_partition,
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< " | Cause: user sent invalid arguments, len = 0 or memory partition"
|
||||
<< " was a null ptr"
|
||||
<< " | Returning = "
|
||||
@@ -4826,7 +4881,7 @@ rsmi_dev_memory_partition_get(uint32_t dv_ind, char *memory_partition,
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< " | Cause: could not successfully retrieve current memory partition "
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(ret) << " |";
|
||||
@@ -4844,7 +4899,7 @@ rsmi_dev_memory_partition_get(uint32_t dv_ind, char *memory_partition,
|
||||
<< " | Fail "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< " | Cause: could not successfully retrieve current memory partition "
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(ret) << " |";
|
||||
@@ -4856,7 +4911,7 @@ rsmi_dev_memory_partition_get(uint32_t dv_ind, char *memory_partition,
|
||||
<< " | Success "
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< " | Data: " << memory_partition
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(ret) << " |";
|
||||
@@ -4895,7 +4950,7 @@ rsmi_status_t rsmi_dev_compute_partition_reset(uint32_t dv_ind) {
|
||||
<< " | Success - if original boot state was not unknown or valid setting"
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< " | Data: " << bootState
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(ret) << " |";
|
||||
@@ -4934,7 +4989,7 @@ rsmi_status_t rsmi_dev_memory_partition_reset(uint32_t dv_ind) {
|
||||
<< " | Success - if original boot state was not unknown or valid setting"
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< RocmSMI::devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevMemoryPartition)
|
||||
<< " | Data: " << bootState
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(ret) << " |";
|
||||
@@ -5848,7 +5903,7 @@ rsmi_dev_curr_uclk_get(uint32_t dv_ind, uint16_t* uclk_value)
|
||||
}
|
||||
|
||||
rsmi_status_t
|
||||
rsmi_dev_vcn_activity_get(uint32_t dv_ind, GPUMetricVcnActivityTbl_t* vcn_activity_value)
|
||||
rsmi_dev_vcn_activity_get(uint32_t dv_ind, amd::smi::GPUMetricVcnActivityTbl_t* vcn_activity_value)
|
||||
{
|
||||
TRY
|
||||
std::ostringstream ostrstream;
|
||||
@@ -5856,7 +5911,7 @@ rsmi_dev_vcn_activity_get(uint32_t dv_ind, GPUMetricVcnActivityTbl_t* vcn_activi
|
||||
LOG_TRACE(ostrstream);
|
||||
|
||||
const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricVcnActivity);
|
||||
GPUMetricVcnActivityTbl_t tmp_vcn_activity_value;
|
||||
amd::smi::GPUMetricVcnActivityTbl_t tmp_vcn_activity_value;
|
||||
*vcn_activity_value = tmp_vcn_activity_value;
|
||||
auto status_code(rsmi_status_t::RSMI_STATUS_SUCCESS);
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
@@ -5871,7 +5926,7 @@ rsmi_dev_vcn_activity_get(uint32_t dv_ind, GPUMetricVcnActivityTbl_t* vcn_activi
|
||||
}
|
||||
|
||||
rsmi_status_t
|
||||
rsmi_dev_xgmi_read_data_get(uint32_t dv_ind, GPUMetricXgmiAccTbl_t* xgmi_read_data_acc_value)
|
||||
rsmi_dev_xgmi_read_data_get(uint32_t dv_ind, amd::smi::GPUMetricXgmiAccTbl_t* xgmi_read_data_acc_value)
|
||||
{
|
||||
TRY
|
||||
std::ostringstream ostrstream;
|
||||
@@ -5879,7 +5934,7 @@ rsmi_dev_xgmi_read_data_get(uint32_t dv_ind, GPUMetricXgmiAccTbl_t* xgmi_read_da
|
||||
LOG_TRACE(ostrstream);
|
||||
|
||||
const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricVcnActivity);
|
||||
GPUMetricXgmiAccTbl_t tmp_xgmi_read_data_acc_value;
|
||||
amd::smi::GPUMetricXgmiAccTbl_t tmp_xgmi_read_data_acc_value;
|
||||
*xgmi_read_data_acc_value = tmp_xgmi_read_data_acc_value;
|
||||
auto status_code(rsmi_status_t::RSMI_STATUS_SUCCESS);
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
@@ -5894,7 +5949,7 @@ rsmi_dev_xgmi_read_data_get(uint32_t dv_ind, GPUMetricXgmiAccTbl_t* xgmi_read_da
|
||||
}
|
||||
|
||||
rsmi_status_t
|
||||
rsmi_dev_xgmi_write_data_get(uint32_t dv_ind, GPUMetricXgmiAccTbl_t* xgmi_write_data_acc_value)
|
||||
rsmi_dev_xgmi_write_data_get(uint32_t dv_ind, amd::smi::GPUMetricXgmiAccTbl_t* xgmi_write_data_acc_value)
|
||||
{
|
||||
TRY
|
||||
std::ostringstream ostrstream;
|
||||
@@ -5902,7 +5957,7 @@ rsmi_dev_xgmi_write_data_get(uint32_t dv_ind, GPUMetricXgmiAccTbl_t* xgmi_write_
|
||||
LOG_TRACE(ostrstream);
|
||||
|
||||
const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricVcnActivity);
|
||||
GPUMetricXgmiAccTbl_t tmp_xgmi_write_data_acc_value;
|
||||
amd::smi::GPUMetricXgmiAccTbl_t tmp_xgmi_write_data_acc_value;
|
||||
*xgmi_write_data_acc_value = tmp_xgmi_write_data_acc_value;
|
||||
auto status_code(rsmi_status_t::RSMI_STATUS_SUCCESS);
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
@@ -5917,7 +5972,7 @@ rsmi_dev_xgmi_write_data_get(uint32_t dv_ind, GPUMetricXgmiAccTbl_t* xgmi_write_
|
||||
}
|
||||
|
||||
rsmi_status_t
|
||||
rsmi_dev_curr_gfxclk_get(uint32_t dv_ind, GPUMetricCurrGfxClkTbl_t* current_gfxclk_value)
|
||||
rsmi_dev_curr_gfxclk_get(uint32_t dv_ind, amd::smi::GPUMetricCurrGfxClkTbl_t* current_gfxclk_value)
|
||||
{
|
||||
TRY
|
||||
std::ostringstream ostrstream;
|
||||
@@ -5925,7 +5980,7 @@ rsmi_dev_curr_gfxclk_get(uint32_t dv_ind, GPUMetricCurrGfxClkTbl_t* current_gfxc
|
||||
LOG_TRACE(ostrstream);
|
||||
|
||||
const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricVcnActivity);
|
||||
GPUMetricCurrGfxClkTbl_t tmp_current_gfxclk_value;
|
||||
amd::smi::GPUMetricCurrGfxClkTbl_t tmp_current_gfxclk_value;
|
||||
*current_gfxclk_value = tmp_current_gfxclk_value;
|
||||
auto status_code(rsmi_status_t::RSMI_STATUS_SUCCESS);
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
@@ -5940,7 +5995,7 @@ rsmi_dev_curr_gfxclk_get(uint32_t dv_ind, GPUMetricCurrGfxClkTbl_t* current_gfxc
|
||||
}
|
||||
|
||||
rsmi_status_t
|
||||
rsmi_dev_curr_socclk_get(uint32_t dv_ind, GPUMetricCurrSocClkTbl_t* current_socclk_value)
|
||||
rsmi_dev_curr_socclk_get(uint32_t dv_ind, amd::smi::GPUMetricCurrSocClkTbl_t* current_socclk_value)
|
||||
{
|
||||
TRY
|
||||
std::ostringstream ostrstream;
|
||||
@@ -5948,7 +6003,7 @@ rsmi_dev_curr_socclk_get(uint32_t dv_ind, GPUMetricCurrSocClkTbl_t* current_socc
|
||||
LOG_TRACE(ostrstream);
|
||||
|
||||
const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricVcnActivity);
|
||||
GPUMetricCurrSocClkTbl_t tmp_current_socclk_value;
|
||||
amd::smi::GPUMetricCurrSocClkTbl_t tmp_current_socclk_value;
|
||||
*current_socclk_value = tmp_current_socclk_value;
|
||||
auto status_code(rsmi_status_t::RSMI_STATUS_SUCCESS);
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
@@ -5963,7 +6018,7 @@ rsmi_dev_curr_socclk_get(uint32_t dv_ind, GPUMetricCurrSocClkTbl_t* current_socc
|
||||
}
|
||||
|
||||
rsmi_status_t
|
||||
rsmi_dev_curr_vclk0_get(uint32_t dv_ind, GPUMetricCurrVClkTbl_t* current_vclk_value)
|
||||
rsmi_dev_curr_vclk0_get(uint32_t dv_ind, amd::smi::GPUMetricCurrVClkTbl_t* current_vclk_value)
|
||||
{
|
||||
TRY
|
||||
std::ostringstream ostrstream;
|
||||
@@ -5971,7 +6026,7 @@ rsmi_dev_curr_vclk0_get(uint32_t dv_ind, GPUMetricCurrVClkTbl_t* current_vclk_va
|
||||
LOG_TRACE(ostrstream);
|
||||
|
||||
const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricVcnActivity);
|
||||
GPUMetricCurrVClkTbl_t tmp_current_vclk_value;
|
||||
amd::smi::GPUMetricCurrVClkTbl_t tmp_current_vclk_value;
|
||||
*current_vclk_value = tmp_current_vclk_value;
|
||||
auto status_code(rsmi_status_t::RSMI_STATUS_SUCCESS);
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
@@ -5986,7 +6041,7 @@ rsmi_dev_curr_vclk0_get(uint32_t dv_ind, GPUMetricCurrVClkTbl_t* current_vclk_va
|
||||
}
|
||||
|
||||
rsmi_status_t
|
||||
rsmi_dev_curr_vdlk0_get(uint32_t dv_ind, GPUMetricCurrDClkTbl_t* current_dclk_value)
|
||||
rsmi_dev_curr_vdlk0_get(uint32_t dv_ind, amd::smi::GPUMetricCurrDClkTbl_t* current_dclk_value)
|
||||
{
|
||||
TRY
|
||||
std::ostringstream ostrstream;
|
||||
@@ -5994,7 +6049,7 @@ rsmi_dev_curr_vdlk0_get(uint32_t dv_ind, GPUMetricCurrDClkTbl_t* current_dclk_va
|
||||
LOG_TRACE(ostrstream);
|
||||
|
||||
const auto gpu_metric_unit(AMDGpuMetricsUnitType_t::kMetricVcnActivity);
|
||||
GPUMetricCurrDClkTbl_t tmp_current_dclk_value;
|
||||
amd::smi::GPUMetricCurrDClkTbl_t tmp_current_dclk_value;
|
||||
*current_dclk_value = tmp_current_dclk_value;
|
||||
auto status_code(rsmi_status_t::RSMI_STATUS_SUCCESS);
|
||||
ostrstream << __PRETTY_FUNCTION__
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
#include <unistd.h>
|
||||
#include <dirent.h>
|
||||
#include <glob.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
@@ -63,7 +62,6 @@
|
||||
#include <regex>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
@@ -884,5 +882,97 @@ int subDirectoryCountInPath(const std::string path) {
|
||||
return dir_count;
|
||||
}
|
||||
|
||||
std::string monitor_type_string(MonitorTypes type) {
|
||||
const std::map<MonitorTypes, std::string> monitorTypesToString{
|
||||
{kMonName,
|
||||
"MonitorTypes::kMonName"},
|
||||
{kMonTemp,
|
||||
"MonitorTypes::kMonTemp"},
|
||||
{kMonFanSpeed,
|
||||
"MonitorTypes::kMonFanSpeed"},
|
||||
{kMonMaxFanSpeed,
|
||||
"MonitorTypes::kMonMaxFanSpeed"},
|
||||
{kMonFanRPMs,
|
||||
"MonitorTypes::kMonFanRPMs"},
|
||||
{kMonFanCntrlEnable,
|
||||
"MonitorTypes::kMonFanCntrlEnable"},
|
||||
{kMonPowerCap,
|
||||
"MonitorTypes::kMonPowerCap"},
|
||||
{kMonPowerCapDefault,
|
||||
"MonitorTypes::kMonPowerCapDefault"},
|
||||
{kMonPowerCapMax,
|
||||
"MonitorTypes::kMonPowerCapMax"},
|
||||
{kMonPowerCapMin,
|
||||
"MonitorTypes::kMonPowerCapMin"},
|
||||
{kMonPowerAve,
|
||||
"MonitorTypes::kMonPowerAve"},
|
||||
{kMonPowerInput,
|
||||
"MonitorTypes::kMonPowerInput"},
|
||||
{kMonPowerLabel,
|
||||
"MonitorTypes::kMonPowerLabel"},
|
||||
{kMonTempMax,
|
||||
"MonitorTypes::kMonTempMax"},
|
||||
{kMonTempMin,
|
||||
"MonitorTypes::kMonTempMin"},
|
||||
{kMonTempMaxHyst,
|
||||
"MonitorTypes::kMonTempMaxHyst"},
|
||||
{kMonTempMinHyst,
|
||||
"MonitorTypes::kMonTempMinHyst"},
|
||||
{kMonTempCritical,
|
||||
"MonitorTypes::kMonTempCritical"},
|
||||
{kMonTempCriticalHyst,
|
||||
"MonitorTypes::kMonTempCriticalHyst"},
|
||||
{kMonTempEmergency,
|
||||
"MonitorTypes::kMonTempEmergency"},
|
||||
{kMonTempEmergencyHyst,
|
||||
"MonitorTypes::kMonTempEmergencyHyst"},
|
||||
{kMonTempCritMin,
|
||||
"MonitorTypes::kMonTempCritMin"},
|
||||
{kMonTempCritMinHyst,
|
||||
"MonitorTypes::kMonTempCritMinHyst"},
|
||||
{kMonTempOffset,
|
||||
"MonitorTypes::kMonTempOffset"},
|
||||
{kMonTempLowest,
|
||||
"MonitorTypes::kMonTempLowest"},
|
||||
{kMonTempHighest,
|
||||
"MonitorTypes::kMonTempHighest"},
|
||||
{kMonTempLabel,
|
||||
"MonitorTypes::kMonTempLabel"},
|
||||
{kMonVolt,
|
||||
"MonitorTypes::kMonVolt"},
|
||||
{kMonVoltMax,
|
||||
"MonitorTypes::kMonVoltMax"},
|
||||
{kMonVoltMinCrit,
|
||||
"MonitorTypes::kMonVoltMinCrit"},
|
||||
{kMonVoltMin,
|
||||
"MonitorTypes::kMonVoltMin"},
|
||||
{kMonVoltMaxCrit,
|
||||
"MonitorTypes::kMonVoltMaxCrit"},
|
||||
{kMonVoltAverage,
|
||||
"MonitorTypes::kMonVoltAverage"},
|
||||
{kMonVoltLowest,
|
||||
"MonitorTypes::kMonVoltLowest"},
|
||||
{kMonVoltHighest,
|
||||
"MonitorTypes::kMonVoltHighest"},
|
||||
{kMonVoltLabel,
|
||||
"MonitorTypes::kMonVoltLabel"},
|
||||
{kMonInvalid,
|
||||
"MonitorTypes::kMonInvalid"},
|
||||
};
|
||||
return monitorTypesToString.at(type);
|
||||
}
|
||||
|
||||
std::string power_type_string(RSMI_POWER_TYPE type) {
|
||||
const std::map<RSMI_POWER_TYPE, std::string> powerTypesToString{
|
||||
{RSMI_AVERAGE_POWER,
|
||||
"RSMI_POWER_TYPE::RSMI_AVERAGE_POWER"},
|
||||
{RSMI_CURRENT_POWER,
|
||||
"RSMI_POWER_TYPE::RSMI_CURRENT_POWER"},
|
||||
{RSMI_INVALID_POWER,
|
||||
"RSMI_POWER_TYPE::RSMI_INVALID_POWER"},
|
||||
};
|
||||
return powerTypesToString.at(type);
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* Copyright (c) 2019-2023, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
@@ -89,6 +89,7 @@ void TestPowerRead::Close() {
|
||||
void TestPowerRead::Run(void) {
|
||||
rsmi_status_t err;
|
||||
uint64_t val_ui64, val2_ui64;
|
||||
RSMI_POWER_TYPE type = RSMI_INVALID_POWER;
|
||||
|
||||
TestBase::Run();
|
||||
if (setup_failed_) {
|
||||
@@ -119,44 +120,71 @@ void TestPowerRead::Run(void) {
|
||||
|
||||
/* Average Power */
|
||||
err = rsmi_dev_power_ave_get(i, 0, &val_ui64);
|
||||
|
||||
ASSERT_TRUE(err == RSMI_STATUS_SUCCESS
|
||||
|| err == RSMI_STATUS_NOT_SUPPORTED);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**Average Power Usage: not supported on this device"
|
||||
<< std::endl;
|
||||
} else {
|
||||
CHK_RSMI_PERM_ERR(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Average Power Usage: ";
|
||||
CHK_RSMI_PERM_ERR(err)
|
||||
if (err == RSMI_STATUS_SUCCESS) {
|
||||
std::cout << static_cast<float>(val_ui64) / 1000 << " mW"
|
||||
std::cout << static_cast<float>(val_ui64) / 1000 << " W"
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_power_ave_get(i, 0, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_power_ave_get(i, 0, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
|
||||
/* Current Socket Power */
|
||||
err = rsmi_dev_current_socket_power_get(i, &val_ui64);
|
||||
|
||||
ASSERT_TRUE(err == RSMI_STATUS_SUCCESS
|
||||
|| err == RSMI_STATUS_NOT_SUPPORTED);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**Current Socket Power: not supported"
|
||||
" on this device" << std::endl;
|
||||
} else {
|
||||
CHK_RSMI_PERM_ERR(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Current Socket Power: ";
|
||||
CHK_RSMI_PERM_ERR(err)
|
||||
if (err == RSMI_STATUS_SUCCESS) {
|
||||
std::cout << static_cast<float>(val_ui64) / 1000 << " mW"
|
||||
std::cout << static_cast<float>(val_ui64) / 1000 << " W"
|
||||
<< std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_current_socket_power_get(i, nullptr);
|
||||
// std::cout << "err = " << amd::smi::getRSMIStatusString(err);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_current_socket_power_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
|
||||
/* Generic Power */
|
||||
err = rsmi_dev_power_get(i, &val_ui64, &type);
|
||||
ASSERT_TRUE(err == RSMI_STATUS_SUCCESS
|
||||
|| err == RSMI_STATUS_NOT_SUPPORTED);
|
||||
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout <<
|
||||
"\t**Generic Power: not supported"
|
||||
" on this device" << std::endl;
|
||||
} else {
|
||||
CHK_RSMI_PERM_ERR(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Generic Power: ";
|
||||
if (err == RSMI_STATUS_SUCCESS) {
|
||||
std::cout << "[" << amd::smi::power_type_string(type) << "] "
|
||||
<< static_cast<float>(val_ui64) / 1000 << " W"
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_power_get(i, nullptr, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 2019, Advanced Micro Devices, Inc.
|
||||
* Copyright (c) 2019-2023, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include "rocm_smi_test/test_base.h"
|
||||
#include "rocm_smi_test/test_common.h"
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "rocm_smi/rocm_smi_utils.h"
|
||||
|
||||
static const std::map<rsmi_dev_perf_level_t, const char *>
|
||||
kDevPerfLvlNameMap = {
|
||||
@@ -227,6 +228,10 @@ const char *FreqEnumToStr(rsmi_clk_type rsmi_clk) {
|
||||
}
|
||||
}
|
||||
|
||||
void printRSMIError(rsmi_status_t err) {
|
||||
std::cout << "err = " << amd::smi::getRSMIStatusString(err);
|
||||
}
|
||||
|
||||
#if ENABLE_SMI
|
||||
void DumpMonitorInfo(const TestBase *test) {
|
||||
int ret = 0;
|
||||
|
||||
@@ -98,4 +98,6 @@ void DumpMonitorInfo(const TestBase *test);
|
||||
} \
|
||||
}
|
||||
|
||||
void printRSMIError(rsmi_status_t err);
|
||||
|
||||
#endif // TESTS_ROCM_SMI_TEST_TEST_COMMON_H_
|
||||
|
||||
Ссылка в новой задаче
Block a user