Merge rocmsmi/amd-staging into amd-dev 20231103
Change-Id: Ie70ab54a63b25649b6b9d30620c5546dc66cd766 Signed-off-by: Galantsev, Dmitrii <dmitrii.galantsev@amd.com>
Этот коммит содержится в:
@@ -94,7 +94,11 @@ set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
|
||||
generic_package()
|
||||
|
||||
## Compiler flags
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fno-rtti -m64 -msse -msse2")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fno-rtti")
|
||||
if (${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64")
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} -m64 -msse -msse2")
|
||||
endif()
|
||||
# Security options
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion -Wcast-align")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat=2 -fno-common -Wstrict-overflow")
|
||||
|
||||
@@ -57,7 +57,7 @@ function(generic_package)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFORTIFY_SOURCE=2 -fstack-protector-all -Wcast-align" PARENT_SCOPE)
|
||||
## More security breach mitigation flags
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,noexecstack -Wl,-znoexecheap -Wl,-z,relro" PARENT_SCOPE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wtrampolines -Wl,-z,now -fPIE" PARENT_SCOPE)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wtrampolines -Wl,-z,now" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
# Clang does not set the build-id
|
||||
|
||||
+532
-275
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@@ -32,7 +32,7 @@ message("Package version: ${PKG_VERSION_STR}")
|
||||
|
||||
# Debian package specific variables
|
||||
# Set a default value for the package version
|
||||
get_version_from_tag("5.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT)
|
||||
get_version_from_tag("1.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT)
|
||||
|
||||
# VERSION_* variables should be set by get_version_from_tag
|
||||
if(${ROCM_PATCH_VERSION})
|
||||
|
||||
@@ -156,6 +156,15 @@
|
||||
} \
|
||||
}
|
||||
|
||||
void print_function_header_with_rsmi_ret(
|
||||
rsmi_status_t myReturn, std::string header = "") {
|
||||
std::cout << "\t** ";
|
||||
if (!header.empty()) {
|
||||
std::cout << header << ": ";
|
||||
}
|
||||
std::cout << amd::smi::getRSMIStatusString(myReturn, false) << "\n";
|
||||
}
|
||||
|
||||
static void print_test_header(const char *str, uint32_t dv_ind) {
|
||||
std::cout << "********************************" << "\n";
|
||||
std::cout << "*** " << str << "\n";
|
||||
@@ -254,14 +263,24 @@ perf_level_string(rsmi_dev_perf_level_t perf_lvl) {
|
||||
}
|
||||
}
|
||||
|
||||
static bool isUserRunningAsSudo() {
|
||||
bool isRunningWithSudo = false;
|
||||
auto myUID = getuid();
|
||||
auto myPrivledges = geteuid();
|
||||
if ((myUID == myPrivledges) && (myPrivledges == 0)) {
|
||||
isRunningWithSudo = true;
|
||||
static const std::string
|
||||
clock_type_string(rsmi_clk_type_t clk) {
|
||||
switch (clk) {
|
||||
case RSMI_CLK_TYPE_SYS:
|
||||
return "RSMI_CLK_TYPE_SYS";
|
||||
case RSMI_CLK_TYPE_DF:
|
||||
return "RSMI_CLK_TYPE_DF";
|
||||
case RSMI_CLK_TYPE_DCEF:
|
||||
return "RSMI_CLK_TYPE_DCEF";
|
||||
case RSMI_CLK_TYPE_SOC:
|
||||
return "RSMI_CLK_TYPE_SOC";
|
||||
case RSMI_CLK_TYPE_MEM:
|
||||
return "RSMI_CLK_TYPE_MEM";
|
||||
case RSMI_CLK_TYPE_PCIE:
|
||||
return "RSMI_CLK_TYPE_PCIE";
|
||||
default:
|
||||
return "RSMI_CLK_INVALID";
|
||||
}
|
||||
return isRunningWithSudo;
|
||||
}
|
||||
|
||||
static bool isFileWritable(rsmi_status_t response) {
|
||||
@@ -271,7 +290,7 @@ static bool isFileWritable(rsmi_status_t response) {
|
||||
// isFileWritable(ret) - intends to capture this
|
||||
// response situation.
|
||||
bool fileWritable = true;
|
||||
if (isUserRunningAsSudo() && (response == RSMI_STATUS_PERMISSION)) {
|
||||
if (amd::smi::is_sudo_user() && (response == RSMI_STATUS_PERMISSION)) {
|
||||
std::cout << "[WARN] User is running with sudo "
|
||||
<< "permissions, file is not writable." << "\n";
|
||||
fileWritable = false;
|
||||
@@ -574,9 +593,19 @@ static rsmi_status_t test_set_freq(uint32_t dv_ind) {
|
||||
}
|
||||
|
||||
static void print_frequencies(rsmi_frequencies_t *f) {
|
||||
assert(f != nullptr);
|
||||
bool hasDeepSleep = false;
|
||||
if (f == nullptr) {
|
||||
std::cout << "Freq was nullptr\n";
|
||||
return;
|
||||
}
|
||||
for (uint32_t j = 0; j < f->num_supported; ++j) {
|
||||
std::cout << "\t** " << j << ": " << std::to_string(f->frequency[j]);
|
||||
if (f->has_deep_sleep && j == 0) {
|
||||
std::cout << "\t** S: " << std::to_string(f->frequency[j]);
|
||||
hasDeepSleep = true;
|
||||
} else {
|
||||
std::cout << "\t** " << (hasDeepSleep ? j-1 : j)
|
||||
<< ": " << std::to_string(f->frequency[j]);
|
||||
}
|
||||
if (j == f->current) {
|
||||
std::cout << " *";
|
||||
}
|
||||
@@ -714,6 +743,7 @@ int main() {
|
||||
rsmi_frequencies_t f;
|
||||
uint32_t num_monitor_devs = 0;
|
||||
rsmi_gpu_metrics_t p;
|
||||
std::string val_str;
|
||||
RSMI_POWER_TYPE power_type = RSMI_INVALID_POWER;
|
||||
|
||||
rsmi_num_monitor_devices(&num_monitor_devs);
|
||||
@@ -725,6 +755,8 @@ int main() {
|
||||
ret = rsmi_dev_revision_get(i, &val_ui16);
|
||||
CHK_RSMI_RET_I(ret)
|
||||
std::cout << "\t**Dev.Rev.ID: 0x" << std::hex << val_ui16 << "\n";
|
||||
ret = amd::smi::rsmi_get_gfx_target_version(i , &val_str);
|
||||
std::cout << "\t**Target Graphics Version: " << val_str << "\n";
|
||||
|
||||
char pcie_vendor_name[256];
|
||||
ret = rsmi_dev_pcie_vendor_name_get(i, pcie_vendor_name, 256);
|
||||
@@ -741,7 +773,7 @@ int main() {
|
||||
? "UNKNOWN" : current_compute_partition);
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
std::cout << ", RSMI_STATUS = ";
|
||||
} else {
|
||||
} else {
|
||||
std::cout << "\n";
|
||||
}
|
||||
CHK_RSMI_NOT_SUPPORTED_OR_UNEXPECTED_DATA_RET(ret)
|
||||
@@ -778,8 +810,42 @@ int main() {
|
||||
}
|
||||
|
||||
ret = rsmi_dev_gpu_metrics_info_get(i, &p);
|
||||
CHK_AND_PRINT_RSMI_ERR_RET(ret)
|
||||
std::cout << "\t**GPU METRICS" << "\n";
|
||||
print_test_header("GPU METRICS", i);
|
||||
print_function_header_with_rsmi_ret(ret,
|
||||
"rsmi_dev_gpu_metrics_info_get(" + std::to_string(i) + ", &p)");
|
||||
std::cout << "\t**p.common_header.content_revision: " << std::dec
|
||||
<< p.common_header.content_revision << "\n";
|
||||
std::cout << "\t**p.common_header.format_revision: " << std::dec
|
||||
<< p.common_header.format_revision << "\n";
|
||||
std::cout << "\t**p.average_gfxclk_frequency: " << std::dec
|
||||
<< p.average_gfxclk_frequency << "\n";
|
||||
std::cout << "\t**p.average_socclk_frequency: " << std::dec
|
||||
<< p.average_socclk_frequency << "\n";
|
||||
std::cout << "\t**p.average_uclk_frequency: " << std::dec
|
||||
<< p.average_uclk_frequency << "\n";
|
||||
std::cout << "\t**p.average_vclk0_frequency: " << std::dec
|
||||
<< p.average_vclk0_frequency << "\n";
|
||||
std::cout << "\t**p.average_dclk0_frequency: " << std::dec
|
||||
<< p.average_dclk0_frequency << "\n";
|
||||
std::cout << "\t**p.average_vclk1_frequency: " << std::dec
|
||||
<< p.average_vclk1_frequency << "\n";
|
||||
std::cout << "\t**p.average_dclk1_frequency: " << std::dec
|
||||
<< p.average_dclk1_frequency << "\n";
|
||||
|
||||
std::cout << "\t**p.current_gfxclk: " << std::dec
|
||||
<< p.current_gfxclk << "\n";
|
||||
std::cout << "\t**p.current_socclk: " << std::dec
|
||||
<< p.current_socclk << "\n";
|
||||
std::cout << "\t**p.current_uclk: " << std::dec
|
||||
<< p.current_uclk << "\n";
|
||||
std::cout << "\t**p.current_vclk0: " << std::dec
|
||||
<< p.current_vclk0 << "\n";
|
||||
std::cout << "\t**p.current_dclk0: " << std::dec
|
||||
<< p.current_dclk0 << "\n";
|
||||
std::cout << "\t**p.current_vclk1: " << std::dec
|
||||
<< p.current_vclk1 << "\n";
|
||||
std::cout << "\t**p.current_dclk1: " << std::dec
|
||||
<< p.current_dclk1 << "\n";
|
||||
|
||||
ret = rsmi_dev_perf_level_get(i, &pfl);
|
||||
CHK_AND_PRINT_RSMI_ERR_RET(ret)
|
||||
@@ -789,25 +855,25 @@ int main() {
|
||||
CHK_AND_PRINT_RSMI_ERR_RET(ret)
|
||||
std::cout << "\t**OverDrive Level:" << val_ui32 << "\n";
|
||||
|
||||
ret = rsmi_dev_gpu_clk_freq_get(i, RSMI_CLK_TYPE_MEM, &f);
|
||||
CHK_AND_PRINT_RSMI_ERR_RET(ret)
|
||||
std::cout << "\t**Supported GPU Memory clock frequencies: ";
|
||||
std::cout << f.num_supported << "\n";
|
||||
print_frequencies(&f);
|
||||
|
||||
ret = rsmi_dev_gpu_clk_freq_get(i, RSMI_CLK_TYPE_SYS, &f);
|
||||
CHK_AND_PRINT_RSMI_ERR_RET(ret)
|
||||
std::cout << "\t**Supported GPU clock frequencies: ";
|
||||
std::cout << f.num_supported << "\n";
|
||||
print_frequencies(&f);
|
||||
|
||||
ret = rsmi_dev_gpu_clk_freq_get(i, RSMI_CLK_TYPE_SOC, &f);
|
||||
CHK_RSMI_NOT_SUPPORTED_OR_UNEXPECTED_DATA_RET(ret)
|
||||
std::cout << "\t**Supported GPU clock frequencies (SOC clk): ";
|
||||
std::cout << f.num_supported << "\n";
|
||||
std::cout << "\t**Current value (SOC clk): ";
|
||||
std::cout << f.current << "\n";
|
||||
print_frequencies(&f);
|
||||
print_test_header("GPU Clocks", i);
|
||||
for (int clkType = static_cast<int>(RSMI_CLK_TYPE_SYS);
|
||||
clkType <= static_cast<int>(RSMI_CLK_TYPE_PCIE);
|
||||
clkType++) {
|
||||
rsmi_clk_type_t type = static_cast<rsmi_clk_type_t>(clkType);
|
||||
ret = rsmi_dev_gpu_clk_freq_get(i, type, &f);
|
||||
print_function_header_with_rsmi_ret(ret,
|
||||
"rsmi_dev_gpu_clk_freq_get(" + std::to_string(i) +
|
||||
", " + clock_type_string(type) + ", &f)");
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
continue;
|
||||
}
|
||||
std::cout << "\t** " << clock_type_string(type)
|
||||
<< " - Supported # of freqs: ";
|
||||
std::cout << f.num_supported << "\n";
|
||||
std::cout << "\t** " << clock_type_string(type) << " f.current: "
|
||||
<< f.current << "\n";
|
||||
print_frequencies(&f);
|
||||
}
|
||||
|
||||
std::cout << "\t**Monitor name: ";
|
||||
char name[128];
|
||||
@@ -897,7 +963,7 @@ int main() {
|
||||
}
|
||||
|
||||
std::cout << "***** Testing write api's" << "\n";
|
||||
if (isUserRunningAsSudo() == false) {
|
||||
if (amd::smi::is_sudo_user() == false) {
|
||||
std::cout << "Write APIs require users to execute with sudo. "
|
||||
<< "Cannot proceed." << "\n";
|
||||
return 0;
|
||||
|
||||
@@ -377,16 +377,16 @@ typedef rsmi_clk_type_t rsmi_clk_type;
|
||||
*/
|
||||
typedef enum {
|
||||
RSMI_COMPUTE_PARTITION_INVALID = 0,
|
||||
RSMI_COMPUTE_PARTITION_CPX, //!< Core mode (CPX)- Per-chip XCC with
|
||||
//!< shared memory
|
||||
RSMI_COMPUTE_PARTITION_SPX, //!< Single GPU mode (SPX)- All XCCs work
|
||||
//!< together with shared memory
|
||||
RSMI_COMPUTE_PARTITION_DPX, //!< Dual GPU mode (DPX)- Half XCCs work
|
||||
//!< together with shared memory
|
||||
RSMI_COMPUTE_PARTITION_TPX, //!< Triple GPU mode (TPX)- One-third XCCs
|
||||
//!< work together with shared memory
|
||||
RSMI_COMPUTE_PARTITION_QPX //!< Quad GPU mode (QPX)- Quarter XCCs
|
||||
//!< work together with shared memory
|
||||
RSMI_COMPUTE_PARTITION_CPX = 1, //!< Core mode (CPX)- Per-chip XCC with
|
||||
//!< shared memory
|
||||
RSMI_COMPUTE_PARTITION_SPX = 2, //!< Single GPU mode (SPX)- All XCCs work
|
||||
//!< together with shared memory
|
||||
RSMI_COMPUTE_PARTITION_DPX = 3, //!< Dual GPU mode (DPX)- Half XCCs work
|
||||
//!< together with shared memory
|
||||
RSMI_COMPUTE_PARTITION_TPX = 4, //!< Triple GPU mode (TPX)- One-third XCCs
|
||||
//!< work together with shared memory
|
||||
RSMI_COMPUTE_PARTITION_QPX = 5, //!< Quad GPU mode (QPX)- Quarter XCCs
|
||||
//!< work together with shared memory
|
||||
} rsmi_compute_partition_type_t;
|
||||
/// \cond Ignore in docs.
|
||||
typedef rsmi_compute_partition_type_t rsmi_compute_partition_type;
|
||||
@@ -713,6 +713,10 @@ typedef enum _RSMI_IO_LINK_TYPE {
|
||||
RSMI_IOLINK_TYPE_SIZE = 0xFFFFFFFF //!< Max of IO Link types
|
||||
} RSMI_IO_LINK_TYPE;
|
||||
|
||||
//! The CPU node index which will be used in rsmi_topo_get_link_type
|
||||
//! to query the link type between GPU and CPU
|
||||
#define CPU_NODE_INDEX 0xFFFFFFFF
|
||||
|
||||
/**
|
||||
* @brief The utilization counter type
|
||||
*/
|
||||
@@ -3856,7 +3860,7 @@ rsmi_minmax_bandwidth_get(uint32_t dv_ind_src, uint32_t dv_ind_dst,
|
||||
uint64_t *min_bandwidth, uint64_t *max_bandwidth);
|
||||
|
||||
/**
|
||||
* @brief Retrieve the hops and the connection type between 2 GPUs
|
||||
* @brief Retrieve the hops and the connection type between GPU to GPU/CPU
|
||||
*
|
||||
* @details Given a source device index @p dv_ind_src and
|
||||
* a destination device index @p dv_ind_dst, and a pointer to an
|
||||
@@ -3865,6 +3869,14 @@ rsmi_minmax_bandwidth_get(uint32_t dv_ind_src, uint32_t dv_ind_dst,
|
||||
* between the device @p dv_ind_src and @p dv_ind_dst to the memory
|
||||
* pointed to by @p hops and @p type.
|
||||
*
|
||||
* To query the link type between GPU and CPU, given a source GPU index
|
||||
* @p dev_ind_srcc and a destination device index @p dv_ind_dst
|
||||
* CPU_NODE_INDEX(0xFFFFFFFF), a pointer to an
|
||||
* uint64_t @p hops and a pointer to an RSMI_IO_LINK_TYPE @p type,
|
||||
* this function will write the number of hops and the connection type
|
||||
* between the device @p dv_ind_src and CPU to the memory
|
||||
* pointed to by @p hops and @p type.
|
||||
*
|
||||
* @param[in] dv_ind_src the source device index
|
||||
*
|
||||
* @param[in] dv_ind_dst the destination device index
|
||||
@@ -3968,6 +3980,8 @@ rsmi_dev_compute_partition_get(uint32_t dv_ind, char *compute_partition,
|
||||
* unavailable for current device
|
||||
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
|
||||
* support this function
|
||||
* @retval ::RSMI_STATUS_BUSY A resource or mutex could not be acquired
|
||||
* because it is already being used - device is busy
|
||||
*
|
||||
*/
|
||||
rsmi_status_t
|
||||
@@ -3987,6 +4001,8 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
|
||||
* @retval ::RSMI_STATUS_PERMISSION function requires root access
|
||||
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
|
||||
* support this function
|
||||
* @retval ::RSMI_STATUS_BUSY A resource or mutex could not be acquired
|
||||
* because it is already being used - device is busy
|
||||
*
|
||||
*/
|
||||
rsmi_status_t rsmi_dev_compute_partition_reset(uint32_t dv_ind);
|
||||
@@ -4051,6 +4067,8 @@ rsmi_dev_memory_partition_get(uint32_t dv_ind, char *memory_partition,
|
||||
* support this function
|
||||
* @retval ::RSMI_STATUS_AMDGPU_RESTART_ERR could not successfully restart
|
||||
* the amdgpu driver
|
||||
* @retval ::RSMI_STATUS_BUSY A resource or mutex could not be acquired
|
||||
* because it is already being used - device is busy
|
||||
*
|
||||
*/
|
||||
rsmi_status_t
|
||||
@@ -4072,6 +4090,8 @@ rsmi_dev_memory_partition_set(uint32_t dv_ind,
|
||||
* support this function
|
||||
* @retval ::RSMI_STATUS_AMDGPU_RESTART_ERR could not successfully restart
|
||||
* the amdgpu driver
|
||||
* @retval ::RSMI_STATUS_BUSY A resource or mutex could not be acquired
|
||||
* because it is already being used - device is busy
|
||||
*
|
||||
*/
|
||||
rsmi_status_t rsmi_dev_memory_partition_reset(uint32_t dv_ind);
|
||||
|
||||
@@ -272,7 +272,8 @@ class Device {
|
||||
std::vector<std::string> *retVec);
|
||||
int readDevInfoBinary(DevInfoTypes type, std::size_t b_size,
|
||||
void *p_binary_data);
|
||||
int writeDevInfoStr(DevInfoTypes type, std::string valStr);
|
||||
int writeDevInfoStr(DevInfoTypes type, std::string valStr,
|
||||
bool returnWriteErr = false);
|
||||
rsmi_status_t run_amdgpu_property_reinforcement_query(const AMDGpuPropertyQuery_t& amdgpu_property_query);
|
||||
|
||||
|
||||
|
||||
@@ -87,6 +87,9 @@ class KFDNode {
|
||||
// Get cache info from kfd
|
||||
int get_cache_info(rsmi_gpu_cache_info_t *info);
|
||||
|
||||
// Get gfx target version from kfd
|
||||
int get_gfx_target_version(uint64_t* gfx_target_version);
|
||||
|
||||
private:
|
||||
uint32_t node_indx_;
|
||||
uint32_t amdgpu_dev_index_;
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <type_traits>
|
||||
#include <tuple>
|
||||
#include <queue>
|
||||
|
||||
#include "rocm_smi/rocm_smi_device.h"
|
||||
|
||||
@@ -97,10 +99,10 @@ rsmi_status_t
|
||||
GetDevBinaryBlob(amd::smi::DevInfoTypes type,
|
||||
uint32_t dv_ind, std::size_t b_size, void* p_binary_data);
|
||||
rsmi_status_t ErrnoToRsmiStatus(int err);
|
||||
std::string getRSMIStatusString(rsmi_status_t ret);
|
||||
std::string getRSMIStatusString(rsmi_status_t ret, bool fullStatus = true);
|
||||
std::tuple<bool, std::string, std::string, std::string, std::string,
|
||||
std::string, std::string, std::string, std::string,
|
||||
std::string, std::string, std::string>
|
||||
std::string, std::string, std::string, std::string, std::string>
|
||||
getSystemDetails(void);
|
||||
void logSystemDetails(void);
|
||||
rsmi_status_t getBDFString(uint64_t bdf_id, std::string& bfd_str);
|
||||
@@ -110,11 +112,20 @@ void logHexDump(const char *desc, const void *addr, const size_t len,
|
||||
bool isSystemBigEndian();
|
||||
std::string getBuildType();
|
||||
std::string getMyLibPath();
|
||||
std::string getFileCreationDate(std::string path);
|
||||
int subDirectoryCountInPath(const std::string path);
|
||||
std::queue<std::string> getAllDeviceGfxVers();
|
||||
std::string monitor_type_string(amd::smi::MonitorTypes type);
|
||||
std::string power_type_string(RSMI_POWER_TYPE type);
|
||||
std::string splitString(std::string str, char delim);
|
||||
std::string print_rsmi_od_volt_freq_data_t(rsmi_od_volt_freq_data_t *odv);
|
||||
std::string print_rsmi_od_volt_freq_regions(uint32_t num_regions,
|
||||
rsmi_freq_volt_region_t *regions);
|
||||
bool is_sudo_user();
|
||||
rsmi_status_t rsmi_get_gfx_target_version(uint32_t dv_ind,
|
||||
std::string *gfx_version);
|
||||
template <typename T>
|
||||
std::string print_int_as_hex(T i, bool showHexNotation=true) {
|
||||
std::string print_int_as_hex(T i, bool showHexNotation = true) {
|
||||
std::stringstream ss;
|
||||
if (showHexNotation) {
|
||||
ss << "0x" << std::setfill('0') << std::setw(sizeof(T) * 2) << std::hex;
|
||||
@@ -133,7 +144,7 @@ std::string print_int_as_hex(T i, bool showHexNotation=true) {
|
||||
}
|
||||
ss << std::dec;
|
||||
return ss.str();
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
std::string print_unsigned_int(T i) {
|
||||
@@ -264,7 +275,7 @@ class ScopedAcquire {
|
||||
LockType* lock_;
|
||||
bool doRelease;
|
||||
/// @brief: Disable copiable and assignable ability.
|
||||
DISALLOW_COPY_AND_ASSIGN(ScopedAcquire);
|
||||
DISALLOW_COPY_AND_ASSIGN(ScopedAcquire)
|
||||
};
|
||||
|
||||
// The best effort way to decide whether it is in VM guest environment:
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
### ROCm System Management Interface
|
||||
## Synopsis
|
||||
|
||||
Radeon Open Compute Platform - System Management Interface - Command Line tool.
|
||||
|
||||
This tool acts as a command line interface for manipulating
|
||||
and monitoring the amdgpu kernel, and is intended to replace
|
||||
@@ -7,172 +9,195 @@ It uses Ctypes to call the rocm_smi_lib API.
|
||||
Recommended: At least one AMD GPU with ROCm driver installed
|
||||
Required: ROCm SMI library installed (librocm_smi64)
|
||||
|
||||
#### Installation
|
||||
## Installation
|
||||
|
||||
Follow installation procedure for rocm_smi_lib.
|
||||
Please refer to [https://github.com/RadeonOpenCompute/rocm_smi_lib](https://github.com/RadeonOpenCompute/rocm_smi_lib) for the installation guide.
|
||||
LD_LIBRARY_PATH should be set to the folder containing librocm_smi64.
|
||||
|
||||
|
||||
### Version
|
||||
## Version
|
||||
|
||||
The SMI will report a "version" which is the version of the kernel installed:
|
||||
|
||||
```shell
|
||||
AMD ROCm System Management Interface v$(uname)
|
||||
```
|
||||
AMD ROCm System Management Interface v$(uname)
|
||||
|
||||
For ROCk installations, this will be the AMDGPU module version (e.g. 5.0.71)
|
||||
For non-ROCk or monolithic ROCk installations, this will be the kernel version,
|
||||
which will be equivalent to the following bash command:
|
||||
|
||||
```shell
|
||||
$(uname -a) | cut -d ' ' -f 3)
|
||||
```
|
||||
$(uname -a) | cut -d ' ' -f 3)
|
||||
|
||||
#### Usage
|
||||
## Usage
|
||||
|
||||
For detailed and up to date usage information, we recommend consulting the help:
|
||||
```shell
|
||||
/opt/rocm/bin/rocm-smi -h
|
||||
```
|
||||
|
||||
/opt/rocm/bin/rocm-smi -h
|
||||
|
||||
For convenience purposes, following is the output from the -h flag:
|
||||
|
||||
```shell
|
||||
usage: rocm-smi [-h] [-V] [-d DEVICE [DEVICE ...]] [--alldevices] [--showhw] [-a] [-i] [-v] [-e [EVENT ...]]
|
||||
[--showdriverversion] [--showtempgraph] [--showfwinfo [BLOCK ...]] [--showmclkrange] [--showmemvendor]
|
||||
[--showsclkrange] [--showproductname] [--showserial] [--showuniqueid] [--showvoltagerange] [--showbus]
|
||||
[--showpagesinfo] [--showpendingpages] [--showretiredpages] [--showunreservablepages] [-f] [-P] [-t]
|
||||
[-u] [--showmemuse] [--showvoltage] [-b] [-c] [-g] [-l] [-M] [-m] [-o] [-p] [-S] [-s]
|
||||
[--showmeminfo TYPE [TYPE ...]] [--showpids [VERBOSE]] [--showpidgpus [SHOWPIDGPUS ...]]
|
||||
[--showreplaycount] [--showrasinfo [SHOWRASINFO ...]] [--showvc] [--showxgmierr] [--showtopo]
|
||||
[--showtopoaccess] [--showtopoweight] [--showtopohops] [--showtopotype] [--showtoponuma]
|
||||
[--showenergycounter] [--shownodesbw] [--showcomputepartition] [--showmemorypartition] [-r]
|
||||
[--resetfans] [--resetprofile] [--resetpoweroverdrive] [--resetxgmierr] [--resetperfdeterminism]
|
||||
[--resetcomputepartition] [--resetmemorypartition] [--setclock TYPE LEVEL] [--setsclk LEVEL [LEVEL ...]]
|
||||
[--setmclk LEVEL [LEVEL ...]] [--setpcie LEVEL [LEVEL ...]] [--setslevel SCLKLEVEL SCLK SVOLT]
|
||||
[--setmlevel MCLKLEVEL MCLK MVOLT] [--setvc POINT SCLK SVOLT] [--setsrange SCLKMIN SCLKMAX]
|
||||
[--setmrange MCLKMIN MCLKMAX] [--setfan LEVEL] [--setperflevel LEVEL] [--setoverdrive %]
|
||||
[--setmemoverdrive %] [--setpoweroverdrive WATTS] [--setprofile SETPROFILE] [--setperfdeterminism SCLK]
|
||||
[--setcomputepartition {CPX,SPX,DPX,TPX,QPX,cpx,spx,dpx,tpx,qpx}]
|
||||
[--setmemorypartition {NPS1,NPS2,NPS4,NPS8,nps1,nps2,nps4,nps8}] [--rasenable BLOCK ERRTYPE]
|
||||
[--rasdisable BLOCK ERRTYPE] [--rasinject BLOCK] [--gpureset] [--load FILE | --save FILE]
|
||||
[--autorespond RESPONSE] [--loglevel LEVEL] [--json] [--csv]
|
||||
|
||||
usage: rocmSmiLib_cli.py [-h] [-d DEVICE [DEVICE ...]] [--alldevices] [--showhw] [-a] [-i] [-v] [--showdriverversion]
|
||||
[--showfwinfo [BLOCK [BLOCK ...]]] [--showmclkrange] [--showmemvendor] [--showsclkrange]
|
||||
[--showproductname] [--showserial] [--showuniqueid] [--showvoltagerange] [--showbus]
|
||||
[--showpagesinfo] [--showpendingpages] [--showretiredpages] [--showunreservablepages] [-f] [-P]
|
||||
[-t] [-u] [--showmemuse] [--showvoltage] [-b] [-c] [-g] [-l] [-M] [-m] [-o] [-p] [-S] [-s]
|
||||
[--showmeminfo TYPE [TYPE ...]] [--showpids] [--showpidgpus [SHOWPIDGPUS [SHOWPIDGPUS ...]]]
|
||||
[--showreplaycount] [--showrasinfo [SHOWRASINFO [SHOWRASINFO ...]]] [--showvc] [--showxgmierr]
|
||||
[--showtopo] [--showtopoweight] [--showtopohops] [--showtopotype] [--showtoponuma] [-r]
|
||||
[--resetfans] [--resetprofile] [--resetpoweroverdrive] [--resetxgmierr]
|
||||
[--setsclk LEVEL [LEVEL ...]] [--setmclk LEVEL [LEVEL ...]] [--setpcie LEVEL [LEVEL ...]]
|
||||
[--setslevel SCLKLEVEL SCLK SVOLT] [--setmlevel MCLKLEVEL MCLK MVOLT]
|
||||
[--setvc POINT SCLK SVOLT] [--setsrange MINMAX SCLK] [--setmrange MINMAX MCLK] [--setfan LEVEL]
|
||||
[--setperflevel LEVEL] [--setoverdrive %] [--setmemoverdrive %] [--setpoweroverdrive WATTS]
|
||||
[--setprofile SETPROFILE] [--rasenable BLOCK ERRTYPE] [--rasdisable BLOCK ERRTYPE]
|
||||
[--rasinject BLOCK] [--gpureset] [--load FILE | --save FILE] [--autorespond RESPONSE]
|
||||
[--loglevel LEVEL] [--json] [--csv]
|
||||
AMD ROCm System Management Interface | ROCM-SMI version: 1.5.0
|
||||
|
||||
AMD ROCm System Management Interface | ROCM-SMI version: 1.4.1 | Kernel version: 5.4.8
|
||||
options:
|
||||
-h, --help show this help message and exit
|
||||
--gpureset Reset specified GPU (One GPU must be specified)
|
||||
--load FILE Load Clock, Fan, Performance and Profile settings
|
||||
from FILE
|
||||
--save FILE Save Clock, Fan, Performance and Profile settings to
|
||||
FILE
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
--gpureset Reset specified GPU (One GPU must be specified)
|
||||
--load FILE Load Clock, Fan, Performance and Profile settings from FILE
|
||||
--save FILE Save Clock, Fan, Performance and Profile settings to FILE
|
||||
-V, --version Show version information
|
||||
|
||||
-d DEVICE [DEVICE ...], --device DEVICE [DEVICE ...] Execute command on specified device
|
||||
-d DEVICE [DEVICE ...], --device DEVICE [DEVICE ...] Execute command on specified device
|
||||
|
||||
Display Options:
|
||||
--alldevices
|
||||
--showhw Show Hardware details
|
||||
-a, --showallinfo Show Temperature, Fan and Clock values
|
||||
Display Options:
|
||||
--alldevices
|
||||
--showhw Show Hardware details
|
||||
-a, --showallinfo Show Temperature, Fan and Clock values
|
||||
|
||||
Topology:
|
||||
-i, --showid Show DEVICE ID
|
||||
-v, --showvbios Show VBIOS version
|
||||
--showdriverversion Show kernel driver version
|
||||
--showfwinfo [BLOCK [BLOCK ...]] Show FW information
|
||||
--showmclkrange Show mclk range
|
||||
--showmemvendor Show GPU memory vendor
|
||||
--showsclkrange Show sclk range
|
||||
--showproductname Show SKU/Vendor name
|
||||
--showserial Show GPU's Serial Number
|
||||
--showuniqueid Show GPU's Unique ID
|
||||
--showvoltagerange Show voltage range
|
||||
--showbus Show PCI bus number
|
||||
Topology:
|
||||
-i, --showid Show DEVICE ID
|
||||
-v, --showvbios Show VBIOS version
|
||||
-e [EVENT ...], --showevents [EVENT ...] Show event list
|
||||
--showdriverversion Show kernel driver version
|
||||
--showtempgraph Show Temperature Graph
|
||||
--showfwinfo [BLOCK ...] Show FW information
|
||||
--showmclkrange Show mclk range
|
||||
--showmemvendor Show GPU memory vendor
|
||||
--showsclkrange Show sclk range
|
||||
--showproductname Show SKU/Vendor name
|
||||
--showserial Show GPU's Serial Number
|
||||
--showuniqueid Show GPU's Unique ID
|
||||
--showvoltagerange Show voltage range
|
||||
--showbus Show PCI bus number
|
||||
|
||||
Pages information:
|
||||
--showpagesinfo Show retired, pending and unreservable pages
|
||||
--showpendingpages Show pending retired pages
|
||||
--showretiredpages Show retired pages
|
||||
--showunreservablepages Show unreservable pages
|
||||
Pages information:
|
||||
--showpagesinfo Show retired, pending and unreservable pages
|
||||
--showpendingpages Show pending retired pages
|
||||
--showretiredpages Show retired pages
|
||||
--showunreservablepages Show unreservable pages
|
||||
|
||||
Hardware-related information:
|
||||
-f, --showfan Show current fan speed
|
||||
-P, --showpower Show current Average Graphics Package Power Consumption
|
||||
-t, --showtemp Show current temperature
|
||||
-u, --showuse Show current GPU use
|
||||
--showmemuse Show current GPU memory used
|
||||
--showvoltage Show current GPU voltage
|
||||
Hardware-related information:
|
||||
-f, --showfan Show current fan speed
|
||||
-P, --showpower Show current Average Graphics Package Power
|
||||
Consumption
|
||||
-t, --showtemp Show current temperature
|
||||
-u, --showuse Show current GPU use
|
||||
--showmemuse Show current GPU memory used
|
||||
--showvoltage Show current GPU voltage
|
||||
|
||||
Software-related/controlled information:
|
||||
-b, --showbw Show estimated PCIe use
|
||||
-c, --showclocks Show current clock frequencies
|
||||
-g, --showgpuclocks Show current GPU clock frequencies
|
||||
-l, --showprofile Show Compute Profile attributes
|
||||
-M, --showmaxpower Show maximum graphics package power this GPU will consume
|
||||
-m, --showmemoverdrive Show current GPU Memory Clock OverDrive level
|
||||
-o, --showoverdrive Show current GPU Clock OverDrive level
|
||||
-p, --showperflevel Show current DPM Performance Level
|
||||
-S, --showclkvolt Show supported GPU and Memory Clocks and Voltages
|
||||
-s, --showclkfrq Show supported GPU and Memory Clock
|
||||
--showmeminfo TYPE [TYPE ...] Show Memory usage information for given block(s) TYPE
|
||||
--showpids Show current running KFD PIDs
|
||||
--showpidgpus [SHOWPIDGPUS [SHOWPIDGPUS ...]] Show GPUs used by specified KFD PIDs (all if no arg given)
|
||||
--showreplaycount Show PCIe Replay Count
|
||||
--showrasinfo [SHOWRASINFO [SHOWRASINFO ...]] Show RAS enablement information and error counts for the
|
||||
specified block(s) (all if no arg given)
|
||||
--showvc Show voltage curve
|
||||
--showxgmierr Show XGMI error information since last read
|
||||
--showtopo Show hardware topology information
|
||||
--showtopoweight Shows the relative weight between GPUs
|
||||
--showtopohops Shows the number of hops between GPUs
|
||||
--showtopotype Shows the link type between GPUs
|
||||
--showtoponuma Shows the numa nodes
|
||||
Software-related/controlled information:
|
||||
-b, --showbw Show estimated PCIe use
|
||||
-c, --showclocks Show current clock frequencies
|
||||
-g, --showgpuclocks Show current GPU clock frequencies
|
||||
-l, --showprofile Show Compute Profile attributes
|
||||
-M, --showmaxpower Show maximum graphics package power this GPU will
|
||||
consume
|
||||
-m, --showmemoverdrive Show current GPU Memory Clock OverDrive level
|
||||
-o, --showoverdrive Show current GPU Clock OverDrive level
|
||||
-p, --showperflevel Show current DPM Performance Level
|
||||
-S, --showclkvolt Show supported GPU and Memory Clocks and Voltages
|
||||
-s, --showclkfrq Show supported GPU and Memory Clock
|
||||
--showmeminfo TYPE [TYPE ...] Show Memory usage information for given block(s) TYPE
|
||||
--showpids [VERBOSE] Show current running KFD PIDs (pass details to
|
||||
VERBOSE for detailed information)
|
||||
--showpidgpus [SHOWPIDGPUS ...] Show GPUs used by specified KFD PIDs (all if no arg
|
||||
given)
|
||||
--showreplaycount Show PCIe Replay Count
|
||||
--showrasinfo [SHOWRASINFO ...] Show RAS enablement information and error counts for
|
||||
the specified block(s) (all if no arg given)
|
||||
--showvc Show voltage curve
|
||||
--showxgmierr Show XGMI error information since last read
|
||||
--showtopo Show hardware topology information
|
||||
--showtopoaccess Shows the link accessibility between GPUs
|
||||
--showtopoweight Shows the relative weight between GPUs
|
||||
--showtopohops Shows the number of hops between GPUs
|
||||
--showtopotype Shows the link type between GPUs
|
||||
--showtoponuma Shows the numa nodes
|
||||
--showenergycounter Energy accumulator that stores amount of energy
|
||||
consumed
|
||||
--shownodesbw Shows the numa nodes
|
||||
--showcomputepartition Shows current compute partitioning
|
||||
--showmemorypartition Shows current memory partition
|
||||
|
||||
Set options:
|
||||
--setsclk LEVEL [LEVEL ...] Set GPU Clock Frequency Level(s) (requires manual Perf level)
|
||||
--setmclk LEVEL [LEVEL ...] Set GPU Memory Clock Frequency Level(s) (requires manual Perf
|
||||
level)
|
||||
--setpcie LEVEL [LEVEL ...] Set PCIE Clock Frequency Level(s) (requires manual Perf level)
|
||||
--setslevel SCLKLEVEL SCLK SVOLT Change GPU Clock frequency (MHz) and Voltage (mV) for a specific
|
||||
Level
|
||||
--setmlevel MCLKLEVEL MCLK MVOLT Change GPU Memory clock frequency (MHz) and Voltage for (mV) a
|
||||
specific Level
|
||||
--setvc POINT SCLK SVOLT Change SCLK Voltage Curve (MHz mV) for a specific point
|
||||
--setsrange MINMAX SCLK Set min(0) or max(1) SCLK speed
|
||||
--setmrange MINMAX MCLK Set min(0) or max(1) MCLK speed
|
||||
--setfan LEVEL Set GPU Fan Speed (Level or %)
|
||||
--setperflevel LEVEL Set Performance Level
|
||||
--setoverdrive % Set GPU OverDrive level (requires manual|high Perf level)
|
||||
--setmemoverdrive % Set GPU Memory Overclock OverDrive level (requires manual|high
|
||||
Perf level)
|
||||
--setpoweroverdrive WATTS Set the maximum GPU power using Power OverDrive in Watts
|
||||
--setprofile SETPROFILE Specify Power Profile level (#) or a quoted string of CUSTOM
|
||||
Profile attributes "# # # #..." (requires manual Perf level)
|
||||
--rasenable BLOCK ERRTYPE Enable RAS for specified block and error type
|
||||
--rasdisable BLOCK ERRTYPE Disable RAS for specified block and error type
|
||||
--rasinject BLOCK Inject RAS poison for specified block (ONLY WORKS ON UNSECURE
|
||||
BOARDS)
|
||||
Set options:
|
||||
--setclock TYPE LEVEL Set Clock Frequency Level(s) for specified clock
|
||||
(requires manual Perf level)
|
||||
--setsclk LEVEL [LEVEL ...] Set GPU Clock Frequency Level(s) (requires manual
|
||||
Perf level)
|
||||
--setmclk LEVEL [LEVEL ...] Set GPU Memory Clock Frequency Level(s) (requires
|
||||
manual Perf level)
|
||||
--setpcie LEVEL [LEVEL ...] Set PCIE Clock Frequency Level(s) (requires manual
|
||||
Perf level)
|
||||
--setslevel SCLKLEVEL SCLK SVOLT Change GPU Clock frequency (MHz) and Voltage (mV) for
|
||||
a specific Level
|
||||
--setmlevel MCLKLEVEL MCLK MVOLT Change GPU Memory clock frequency (MHz) and Voltage
|
||||
for (mV) a specific Level
|
||||
--setvc POINT SCLK SVOLT Change SCLK Voltage Curve (MHz mV) for a specific
|
||||
point
|
||||
--setsrange SCLKMIN SCLKMAX Set min and max SCLK speed
|
||||
--setmrange MCLKMIN MCLKMAX Set min and max MCLK speed
|
||||
--setfan LEVEL Set GPU Fan Speed (Level or %)
|
||||
--setperflevel LEVEL Set Performance Level
|
||||
--setoverdrive % Set GPU OverDrive level (requires manual|high Perf
|
||||
level)
|
||||
--setmemoverdrive % Set GPU Memory Overclock OverDrive level (requires
|
||||
manual|high Perf level)
|
||||
--setpoweroverdrive WATTS Set the maximum GPU power using Power OverDrive in
|
||||
Watts
|
||||
--setprofile SETPROFILE Specify Power Profile level (#) or a quoted string of
|
||||
CUSTOM Profile attributes "# # # #..." (requires
|
||||
manual Perf level)
|
||||
--setperfdeterminism SCLK Set clock frequency limit to get minimal performance
|
||||
variation
|
||||
--setcomputepartition {CPX,SPX,DPX,TPX,QPX,cpx,spx,dpx,tpx,qpx} Set compute partition
|
||||
--setmemorypartition {NPS1,NPS2,NPS4,NPS8,nps1,nps2,nps4,nps8} Set memory partition
|
||||
--rasenable BLOCK ERRTYPE Enable RAS for specified block and error type
|
||||
--rasdisable BLOCK ERRTYPE Disable RAS for specified block and error type
|
||||
--rasinject BLOCK Inject RAS poison for specified block (ONLY WORKS ON
|
||||
UNSECURE BOARDS)
|
||||
|
||||
Reset options:
|
||||
-r, --resetclocks Reset clocks and OverDrive to default
|
||||
--resetfans Reset fans to automatic (driver) control
|
||||
--resetprofile Reset Power Profile back to default
|
||||
--resetpoweroverdrive Set the maximum GPU power back to the device deafult state
|
||||
--resetxgmierr Reset XGMI error count
|
||||
Reset options:
|
||||
-r, --resetclocks Reset clocks and OverDrive to default
|
||||
--resetfans Reset fans to automatic (driver) control
|
||||
--resetprofile Reset Power Profile back to default
|
||||
--resetpoweroverdrive Set the maximum GPU power back to the device deafult
|
||||
state
|
||||
--resetxgmierr Reset XGMI error count
|
||||
--resetperfdeterminism Disable performance determinism
|
||||
--resetcomputepartition Resets to boot compute partition state
|
||||
--resetmemorypartition Resets to boot memory partition state
|
||||
|
||||
Auto-response options:
|
||||
--autorespond RESPONSE Response to automatically provide for all prompts (NOT
|
||||
RECOMMENDED)
|
||||
Auto-response options:
|
||||
--autorespond RESPONSE Response to automatically provide for all prompts
|
||||
(NOT RECOMMENDED)
|
||||
|
||||
Output options:
|
||||
--loglevel LEVEL How much output will be printed for what program is doing, one
|
||||
of debug/info/warning/error/critical
|
||||
--json Print output in JSON format
|
||||
--csv Print output in CSV format
|
||||
Output options:
|
||||
--loglevel LEVEL How much output will be printed for what program is
|
||||
doing, one of debug/info/warning/error/critical
|
||||
--json Print output in JSON format
|
||||
--csv Print output in CSV format
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
#### Detailed Option Descriptions
|
||||
## Detailed Option Descriptions
|
||||
|
||||
--setsclk/--setmclk # [# # ...]:
|
||||
This allows you to set a mask for the levels. For example, if a GPU has 8 clock levels,
|
||||
@@ -240,21 +265,28 @@ Output options:
|
||||
The Compute Profile accepts 1 or n parameters, either the Profile to select (see --showprofile for a list
|
||||
of preset Power Profiles) or a quoted string of values for the CUSTOM profile.
|
||||
NOTE: These values can vary based on the ASIC, and may include:
|
||||
SCLK_PROFILE_ENABLE - Whether or not to apply the 3 following SCLK settings (0=disable,1=enable)
|
||||
NOTE: This is a hidden field. If set to 0, the following 3 values are displayed as '-'
|
||||
SCLK_UP_HYST - Delay before sclk is increased (in milliseconds)
|
||||
SCLK_DOWN_HYST - Delay before sclk is decresed (in milliseconds)
|
||||
SCLK_ACTIVE_LEVEL - Workload required before sclk levels change (in %)
|
||||
MCLK_PROFILE_ENABLE - Whether or not to apply the 3 following MCLK settings (0=disable,1=enable)
|
||||
NOTE: This is a hidden field. If set to 0, the following 3 values are displayed as '-'
|
||||
MCLK_UP_HYST - Delay before mclk is increased (in milliseconds)
|
||||
MCLK_DOWN_HYST - Delay before mclk is decresed (in milliseconds)
|
||||
MCLK_ACTIVE_LEVEL - Workload required before mclk levels change (in %)
|
||||
|
||||
BUSY_SET_POINT - Threshold for raw activity level before levels change
|
||||
FPS - Frames Per Second
|
||||
USE_RLC_BUSY - When set to 1, DPM is switched up as long as RLC busy message is received
|
||||
MIN_ACTIVE_LEVEL - Workload required before levels change (in %)
|
||||
| Setting | Description |
|
||||
|---------------------|----------------------------------------------------|
|
||||
| SCLK_PROFILE_ENABLE | Whether or not to apply the 3 following SCLK settings (0=disable,1=enable) |
|
||||
| | **NOTE: This is a hidden field. If set to 0, the following 3 values are displayed as '-’** |
|
||||
| SCLK_UP_HYST | Delay before sclk is increased (in milliseconds) |
|
||||
| SCLK_DOWN_HYST | Delay before sclk is decresed (in milliseconds) |
|
||||
| SCLK_ACTIVE_LEVEL | Workload required before sclk levels change (in %) |
|
||||
| MCLK_PROFILE_ENABLE | Whether or not to apply the 3 following MCLK settings (0=disable,1=enable) |
|
||||
| | **NOTE: This is a hidden field. If set to 0, the following 3 values are displayed as '-'** |
|
||||
| MCLK_UP_HYST | Delay before mclk is increased (in milliseconds) |
|
||||
| MCLK_DOWN_HYST | Delay before mclk is decresed (in milliseconds) |
|
||||
| MCLK_ACTIVE_LEVEL | Workload required before mclk levels change (in %) |
|
||||
|
||||
Other settings:
|
||||
|
||||
| Setting | Description |
|
||||
|------------------|---------------------------------------------------------------------------|
|
||||
| BUSY_SET_POINT | Threshold for raw activity level before levels change |
|
||||
| FPS | Frames Per Second |
|
||||
| USE_RLC_BUSY | When set to 1, DPM is switched up as long as RLC busy message is received |
|
||||
| MIN_ACTIVE_LEVEL | Workload required before levels change (in %) |
|
||||
|
||||
NOTES:
|
||||
When a compute queue is detected, the COMPUTE Power Profile values will be automatically
|
||||
@@ -306,16 +338,19 @@ This shows the RAS information for a given block. This includes enablement of th
|
||||
ue - Uncorrectable errors
|
||||
ce - Correctable errors
|
||||
|
||||
### Clock Type Descriptions
|
||||
DCEFCLK - DCE (Display)
|
||||
FCLK - Data fabric (VG20 and later) - Data flow from XGMI, Memory, PCIe
|
||||
SCLK - GFXCLK (Graphics core)
|
||||
Note - SOCCLK split from SCLK as of Vega10. Pre-Vega10 they were both controlled by SCLK
|
||||
MCLK - GPU Memory (VRAM)
|
||||
PCLK - PCIe bus
|
||||
Note - This gives 2 speeds, PCIe Gen1 x1 and the highest available based on the hardware
|
||||
SOCCLK - System clock (VG10 and later) - Data Fabric (DF), MM HUB, AT HUB, SYSTEM HUB, OSS, DFD
|
||||
Note - DF split from SOCCLK as of Vega20. Pre-Vega20 they were both controlled by SOCCLK
|
||||
## Clock Type Descriptions
|
||||
|
||||
| Clock type | Description |
|
||||
| ---------- | --- |
|
||||
| DCEFCLK | DCE (Display) |
|
||||
| FCLK | Data fabric (VG20 and later) - Data flow from XGMI, Memory, PCIe |
|
||||
| SCLK | GFXCLK (Graphics core) |
|
||||
| | **Note - SOCCLK split from SCLK as of Vega10. Pre-Vega10 they were both controlled by SCLK** |
|
||||
| MCLK | GPU Memory (VRAM) |
|
||||
| PCLK | PCIe bus |
|
||||
| | **Note - This gives 2 speeds, PCIe Gen1 x1 and the highest available based on the hardware** |
|
||||
| SOCCLK | System clock (VG10 and later) - Data Fabric (DF), MM HUB, AT HUB, SYSTEM HUB, OSS, DFD |
|
||||
| | **Note - DF split from SOCCLK as of Vega20. Pre-Vega20 they were both controlled by SOCCLK** |
|
||||
|
||||
--gpureset:
|
||||
This flag will attempt to reset the GPU for a specified device. This will invoke the GPU reset through
|
||||
@@ -355,7 +390,7 @@ is calculated in a generic sense.
|
||||
as well as the total available for those partitions. The percentage shown there indicates the
|
||||
amount of used memory in terms of current allocations
|
||||
|
||||
### OverDrive settings ####
|
||||
## OverDrive settings
|
||||
|
||||
Enabling OverDrive requires both a card that support OverDrive and a driver parameter that enables its use.
|
||||
Because OverDrive features can damage your card, most workstation and server GPUs cannot use OverDrive.
|
||||
@@ -371,22 +406,21 @@ As an example, if the ppfeaturemask is set to 0xffffbfff (1111111111111111101111
|
||||
then enabling the OverDrive bit would make it 0xffffffff (11111111111111111111111111111111).
|
||||
|
||||
These are the flags that require OverDrive functionality to be enabled for the flag to work:
|
||||
--showclkvolt
|
||||
--showvoltagerange
|
||||
--showvc
|
||||
--showsclkrange
|
||||
--showmclkrange
|
||||
--setslevel
|
||||
--setmlevel
|
||||
--setoverdrive
|
||||
--setpoweroverdrive
|
||||
--resetpoweroverdrive
|
||||
--setvc
|
||||
--setsrange
|
||||
--setmrange
|
||||
--showclkvolt
|
||||
--showvoltagerange
|
||||
--showvc
|
||||
--showsclkrange
|
||||
--showmclkrange
|
||||
--setslevel
|
||||
--setmlevel
|
||||
--setoverdrive
|
||||
--setpoweroverdrive
|
||||
--resetpoweroverdrive
|
||||
--setvc
|
||||
--setsrange
|
||||
--setmrange
|
||||
|
||||
|
||||
#### Disclaimer
|
||||
## Disclaimer
|
||||
|
||||
The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein.
|
||||
|
||||
|
||||
Исполняемый файл
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Build manpages using ronn
|
||||
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if ! command -v ronn > /dev/null; then
|
||||
echo "ERROR: no ronn found!" >&2
|
||||
echo "Please follow installation instructions here:" >&2
|
||||
echo "https://github.com/apjanke/ronn-ng" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -x
|
||||
ronn ./README.md
|
||||
@@ -966,6 +966,9 @@ def resetComputePartition(deviceList):
|
||||
printLog(device, 'Permission denied', None)
|
||||
elif ret == rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED:
|
||||
printLog(device, 'Not supported on the given system', None)
|
||||
elif ret == rsmi_status_t.RSMI_STATUS_BUSY:
|
||||
printLog(device, 'Device is currently busy, try again later',
|
||||
None)
|
||||
else:
|
||||
rsmi_ret_ok(ret, device, 'reset_compute_partition')
|
||||
printErrLog(device, 'Failed to reset the compute partition to boot state')
|
||||
@@ -1002,6 +1005,9 @@ def resetMemoryPartition(deviceList):
|
||||
printLog(device, 'Permission denied', None, addExtraLine)
|
||||
elif ret == rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED:
|
||||
printLog(device, 'Not supported on the given system', None, addExtraLine)
|
||||
elif ret == rsmi_status_t.RSMI_STATUS_BUSY:
|
||||
printLog(device, 'Device is currently busy, try again later',
|
||||
None)
|
||||
else:
|
||||
rsmi_ret_ok(ret, device, 'reset_memory_partition')
|
||||
printErrLog(device, 'Failed to reset memory partition to boot state')
|
||||
@@ -1603,6 +1609,9 @@ def setComputePartition(deviceList, computePartitionType):
|
||||
%computePartitionType, None)
|
||||
elif ret == rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED:
|
||||
printLog(device, 'Not supported on the given system', None)
|
||||
elif ret == rsmi_status_t.RSMI_STATUS_BUSY:
|
||||
printLog(device, 'Device is currently busy, try again later',
|
||||
None)
|
||||
else:
|
||||
rsmi_ret_ok(ret, device, 'set_compute_partition')
|
||||
printErrLog(device, 'Failed to retrieve compute partition, even though device supports it.')
|
||||
@@ -1673,6 +1682,9 @@ def setMemoryPartition(deviceList, memoryPartition):
|
||||
printLog(device, 'Permission denied', None, addExtraLine)
|
||||
elif ret == rsmi_status_t.RSMI_STATUS_NOT_SUPPORTED:
|
||||
printLog(device, 'Not supported on the given system', None, addExtraLine)
|
||||
elif ret == rsmi_status_t.RSMI_STATUS_BUSY:
|
||||
printLog(device, 'Device is currently busy, try again later',
|
||||
None, addExtraLine)
|
||||
else:
|
||||
rsmi_ret_ok(ret, device, 'set_memory_partition')
|
||||
printErrLog(device, 'Failed to retrieve memory partition, even though device supports it.')
|
||||
|
||||
@@ -1062,6 +1062,9 @@ rsmi_status_t
|
||||
rsmi_perf_determinism_mode_set(uint32_t dv_ind, uint64_t clkvalue) {
|
||||
TRY
|
||||
DEVICE_MUTEX
|
||||
std::ostringstream ss;
|
||||
ss << __PRETTY_FUNCTION__ << " | ======= start =======";
|
||||
LOG_TRACE(ss);
|
||||
|
||||
// Set perf. level to performance determinism so that we can then set the power profile
|
||||
rsmi_status_t ret = rsmi_dev_perf_level_set_v1(dv_ind,
|
||||
@@ -1676,6 +1679,9 @@ rsmi_status_t rsmi_dev_od_volt_info_set(uint32_t dv_ind, uint32_t vpoint,
|
||||
|
||||
static void get_vc_region(uint32_t start_ind,
|
||||
std::vector<std::string> *val_vec, rsmi_freq_volt_region_t *p) {
|
||||
std::ostringstream ss;
|
||||
ss << __PRETTY_FUNCTION__ << " | ======= start =======";
|
||||
LOG_TRACE(ss);
|
||||
assert(p != nullptr);
|
||||
assert(val_vec != nullptr);
|
||||
THROW_IF_NULLPTR_DEREF(p)
|
||||
@@ -1686,6 +1692,9 @@ static void get_vc_region(uint32_t start_ind,
|
||||
assert((*val_vec)[kOD_OD_RANGE_label_array_index] == "OD_RANGE:");
|
||||
if ((val_vec->size() < kOD_OD_RANGE_label_array_index + 2) ||
|
||||
((*val_vec)[kOD_OD_RANGE_label_array_index] != "OD_RANGE:") ) {
|
||||
ss << __PRETTY_FUNCTION__ << " | ======= end ======= | returning "
|
||||
<< getRSMIStatusString(RSMI_STATUS_UNEXPECTED_DATA);
|
||||
LOG_TRACE(ss);
|
||||
throw amd::smi::rsmi_exception(RSMI_STATUS_UNEXPECTED_DATA, __FUNCTION__);
|
||||
}
|
||||
od_value_pair_str_to_range((*val_vec)[start_ind], &p->freq_range);
|
||||
@@ -1705,6 +1714,7 @@ static rsmi_status_t get_od_clk_volt_curve_regions(uint32_t dv_ind,
|
||||
TRY
|
||||
std::vector<std::string> val_vec;
|
||||
rsmi_status_t ret;
|
||||
std::ostringstream ss;
|
||||
|
||||
assert(num_regions != nullptr);
|
||||
assert(p != nullptr);
|
||||
@@ -1713,12 +1723,20 @@ static rsmi_status_t get_od_clk_volt_curve_regions(uint32_t dv_ind,
|
||||
|
||||
ret = GetDevValueVec(amd::smi::kDevPowerODVoltage, dv_ind, &val_vec);
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | Issue: could not retreive kDevPowerODVoltage" << "; returning "
|
||||
<< getRSMIStatusString(ret);
|
||||
LOG_ERROR(ss);
|
||||
return ret;
|
||||
}
|
||||
|
||||
// This is a work-around to handle systems where kDevPowerODVoltage is not
|
||||
// fully supported yet.
|
||||
if (val_vec.size() < 2) {
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | Issue: val_vec.size() < 2" << "; returning "
|
||||
<< getRSMIStatusString(RSMI_STATUS_NOT_YET_IMPLEMENTED);
|
||||
LOG_ERROR(ss);
|
||||
return RSMI_STATUS_NOT_YET_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@@ -1726,8 +1744,17 @@ static rsmi_status_t get_od_clk_volt_curve_regions(uint32_t dv_ind,
|
||||
assert((val_vec_size - kOD_VDDC_CURVE_start_index) > 0);
|
||||
assert((val_vec_size - kOD_VDDC_CURVE_start_index)%2 == 0);
|
||||
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | val_vec_size = " << std::dec
|
||||
<< val_vec_size
|
||||
<< " | kOD_VDDC_CURVE_start_index = " << kOD_VDDC_CURVE_start_index;
|
||||
LOG_DEBUG(ss);
|
||||
if (((val_vec_size - kOD_VDDC_CURVE_start_index) <= 0) ||
|
||||
(((val_vec_size - kOD_VDDC_CURVE_start_index)%2 != 0))) {
|
||||
ss << __PRETTY_FUNCTION__ << " | Issue: od vdd curve returned unexpected "
|
||||
<< "data" << "; returning "
|
||||
<< getRSMIStatusString(RSMI_STATUS_UNEXPECTED_SIZE);
|
||||
LOG_ERROR(ss);
|
||||
throw amd::smi::rsmi_exception(RSMI_STATUS_UNEXPECTED_SIZE, __FUNCTION__);
|
||||
}
|
||||
|
||||
@@ -2980,6 +3007,9 @@ rsmi_dev_od_volt_info_get(uint32_t dv_ind, rsmi_od_volt_freq_data_t *odv) {
|
||||
ss << __PRETTY_FUNCTION__ << "| ======= start =======";
|
||||
LOG_TRACE(ss);
|
||||
DEVICE_MUTEX
|
||||
if (odv == nullptr) {
|
||||
return RSMI_STATUS_INVALID_ARGS;
|
||||
}
|
||||
CHK_SUPPORT_NAME_ONLY(odv)
|
||||
rsmi_status_t ret = get_od_clk_volt_info(dv_ind, odv);
|
||||
|
||||
@@ -3010,7 +3040,7 @@ rsmi_status_t rsmi_dev_od_volt_curve_regions_get(uint32_t dv_ind,
|
||||
uint32_t *num_regions, rsmi_freq_volt_region_t *buffer) {
|
||||
TRY
|
||||
std::ostringstream ss;
|
||||
ss << __PRETTY_FUNCTION__ << "| ======= start =======";
|
||||
ss << __PRETTY_FUNCTION__ << " | ======= start =======";
|
||||
LOG_TRACE(ss);
|
||||
|
||||
CHK_SUPPORT_NAME_ONLY((num_regions == nullptr || buffer == nullptr) ?
|
||||
@@ -3022,6 +3052,12 @@ rsmi_status_t rsmi_dev_od_volt_curve_regions_get(uint32_t dv_ind,
|
||||
DEVICE_MUTEX
|
||||
rsmi_status_t ret = get_od_clk_volt_curve_regions(dv_ind, num_regions,
|
||||
buffer);
|
||||
if (*num_regions == 0) {
|
||||
ret = RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
ss << __PRETTY_FUNCTION__ << " | ======= end ======= | returning "
|
||||
<< getRSMIStatusString(ret);
|
||||
LOG_TRACE(ss);
|
||||
return ret;
|
||||
CATCH
|
||||
}
|
||||
@@ -4613,6 +4649,30 @@ rsmi_topo_get_link_type(uint32_t dv_ind_src, uint32_t dv_ind_dst,
|
||||
|
||||
rsmi_status_t status;
|
||||
uint32_t node_ind_dst;
|
||||
|
||||
// handle the link type for CPU
|
||||
if (dv_ind_dst == CPU_NODE_INDEX) {
|
||||
// No CPU connected
|
||||
if (kfd_node->numa_node_weight() == 0) {
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
amd::smi::IO_LINK_TYPE io_link_type =
|
||||
kfd_node->numa_node_type();
|
||||
switch (io_link_type) {
|
||||
case amd::smi::IOLINK_TYPE_XGMI:
|
||||
*type = RSMI_IOLINK_TYPE_XGMI;
|
||||
*hops = 1;
|
||||
return RSMI_STATUS_SUCCESS;
|
||||
case amd::smi::IOLINK_TYPE_PCIEXPRESS:
|
||||
*type = RSMI_IOLINK_TYPE_PCIEXPRESS;
|
||||
// always be the same CPU node
|
||||
*hops = 2;
|
||||
return RSMI_STATUS_SUCCESS;
|
||||
default:
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
int ret = smi.get_node_index(dv_ind_dst, &node_ind_dst);
|
||||
|
||||
if (ret == 0) {
|
||||
@@ -4730,7 +4790,7 @@ get_compute_partition(uint32_t dv_ind, std::string &compute_partition) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
switch (mapStringToRSMIComputePartitionTypes[compute_partition_str]) {
|
||||
switch (mapStringToRSMIComputePartitionTypes.at(compute_partition_str)) {
|
||||
case RSMI_COMPUTE_PARTITION_CPX:
|
||||
case RSMI_COMPUTE_PARTITION_SPX:
|
||||
case RSMI_COMPUTE_PARTITION_DPX:
|
||||
@@ -4847,9 +4907,12 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
|
||||
ss << __PRETTY_FUNCTION__ << "| ======= start =======";
|
||||
LOG_TRACE(ss);
|
||||
REQUIRE_ROOT_ACCESS
|
||||
if (!amd::smi::is_sudo_user()) {
|
||||
return RSMI_STATUS_PERMISSION;
|
||||
}
|
||||
DEVICE_MUTEX
|
||||
std::string newComputePartitionStr
|
||||
= mapRSMIToStringComputePartitionTypes[compute_partition];
|
||||
= mapRSMIToStringComputePartitionTypes.at(compute_partition);
|
||||
std::string currentComputePartition;
|
||||
|
||||
switch (compute_partition) {
|
||||
@@ -4867,6 +4930,7 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< " | Data: " << newComputePartitionStr
|
||||
<< " | Cause: requested setting was invalid"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(RSMI_STATUS_INVALID_ARGS) << " |";
|
||||
@@ -4885,6 +4949,7 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
|
||||
<< " | Device #: " << dv_ind
|
||||
<< " | Type: "
|
||||
<< devInfoTypesStrings.at(amd::smi::kDevComputePartition)
|
||||
<< " | Data: " << newComputePartitionStr
|
||||
<< " | Cause: not an available compute partition setting"
|
||||
<< " | Returning = "
|
||||
<< getRSMIStatusString(available_ret) << " |";
|
||||
@@ -4912,7 +4977,7 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
|
||||
return ret_get;
|
||||
}
|
||||
rsmi_compute_partition_type_t currRSMIComputePartition
|
||||
= mapStringToRSMIComputePartitionTypes[currentComputePartition];
|
||||
= mapStringToRSMIComputePartitionTypes.at(currentComputePartition);
|
||||
if (currRSMIComputePartition == compute_partition) {
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
@@ -4927,6 +4992,15 @@ rsmi_dev_compute_partition_set(uint32_t dv_ind,
|
||||
return RSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
ss << __PRETTY_FUNCTION__ << " | about to try writing |"
|
||||
<< newComputePartitionStr
|
||||
<< "| size of string = " << newComputePartitionStr.size()
|
||||
<< "| size of c-string = "<< std::dec
|
||||
<< sizeof(newComputePartitionStr.c_str())/sizeof(newComputePartitionStr[0])
|
||||
<< "| sizeof string = " << std::dec
|
||||
<< sizeof(newComputePartitionStr);
|
||||
LOG_DEBUG(ss);
|
||||
|
||||
GET_DEV_FROM_INDX
|
||||
int ret = dev->writeDevInfo(amd::smi::kDevComputePartition,
|
||||
newComputePartitionStr);
|
||||
@@ -4961,7 +5035,7 @@ static rsmi_status_t get_memory_partition(uint32_t dv_ind,
|
||||
return ret;
|
||||
}
|
||||
|
||||
switch (mapStringToMemoryPartitionTypes[val_str]) {
|
||||
switch (mapStringToMemoryPartitionTypes.at(val_str)) {
|
||||
case RSMI_MEMORY_PARTITION_NPS1:
|
||||
case RSMI_MEMORY_PARTITION_NPS2:
|
||||
case RSMI_MEMORY_PARTITION_NPS4:
|
||||
@@ -5017,7 +5091,7 @@ rsmi_dev_memory_partition_set(uint32_t dv_ind,
|
||||
}
|
||||
|
||||
std::string newMemoryPartition
|
||||
= mapRSMIToStringMemoryPartitionTypes[memory_partition];
|
||||
= mapRSMIToStringMemoryPartitionTypes.at(memory_partition);
|
||||
std::string currentMemoryPartition;
|
||||
|
||||
switch (memory_partition) {
|
||||
@@ -5060,7 +5134,7 @@ rsmi_dev_memory_partition_set(uint32_t dv_ind,
|
||||
return ret_get;
|
||||
}
|
||||
rsmi_memory_partition_type_t currRSMIMemoryPartition
|
||||
= mapStringToMemoryPartitionTypes[currentMemoryPartition];
|
||||
= mapStringToMemoryPartitionTypes.at(currentMemoryPartition);
|
||||
if (currRSMIMemoryPartition == memory_partition) {
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | ======= end ======= "
|
||||
@@ -5204,7 +5278,7 @@ rsmi_status_t rsmi_dev_compute_partition_reset(uint32_t dv_ind) {
|
||||
// Likely due to device not supporting it
|
||||
if (bootState != "UNKNOWN") {
|
||||
rsmi_compute_partition_type_t compute_partition =
|
||||
mapStringToRSMIComputePartitionTypes[bootState];
|
||||
mapStringToRSMIComputePartitionTypes.at(bootState);
|
||||
ret = rsmi_dev_compute_partition_set(dv_ind, compute_partition);
|
||||
}
|
||||
ss << __PRETTY_FUNCTION__
|
||||
@@ -5243,7 +5317,7 @@ rsmi_status_t rsmi_dev_memory_partition_reset(uint32_t dv_ind) {
|
||||
// Likely due to device not supporting it
|
||||
if (bootState != "UNKNOWN") {
|
||||
rsmi_memory_partition_type_t memory_partition =
|
||||
mapStringToMemoryPartitionTypes[bootState];
|
||||
mapStringToMemoryPartitionTypes.at(bootState);
|
||||
ret = rsmi_dev_memory_partition_set(dv_ind, memory_partition);
|
||||
}
|
||||
ss << __PRETTY_FUNCTION__
|
||||
|
||||
@@ -628,14 +628,17 @@ int Device::openSysfsFileStream(DevInfoTypes type, T *fs, const char *str) {
|
||||
|
||||
int ret = isRegularFile(sysfs_path, ®_file);
|
||||
if (ret != 0) {
|
||||
ss << "File did not exist - SYSFS file (" << sysfs_path
|
||||
ss << __PRETTY_FUNCTION__ << " | Issue: File did not exist - SYSFS file ("
|
||||
<< sysfs_path
|
||||
<< ") for DevInfoInfoType (" << RocmSMI::devInfoTypesStrings.at(type)
|
||||
<< "), returning " << std::to_string(ret);
|
||||
LOG_ERROR(ss);
|
||||
return ret;
|
||||
}
|
||||
if (!reg_file) {
|
||||
ss << "File is not a regular file - SYSFS file (" << sysfs_path << ") for "
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | Issue: File is not a regular file - SYSFS file ("
|
||||
<< sysfs_path << ") for "
|
||||
<< "DevInfoInfoType (" << RocmSMI::devInfoTypesStrings.at(type) << "),"
|
||||
<< " returning ENOENT (" << std::strerror(ENOENT) << ")";
|
||||
LOG_ERROR(ss);
|
||||
@@ -644,8 +647,9 @@ int Device::openSysfsFileStream(DevInfoTypes type, T *fs, const char *str) {
|
||||
|
||||
fs->open(sysfs_path);
|
||||
|
||||
if (!fs) {
|
||||
ss << "Could not open - SYSFS file (" << sysfs_path << ") for "
|
||||
if (!fs->is_open()) {
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | Issue: Could not open - SYSFS file (" << sysfs_path << ") for "
|
||||
<< "DevInfoInfoType (" << RocmSMI::devInfoTypesStrings.at(type) << "), "
|
||||
<< ", returning " << std::to_string(errno) << " ("
|
||||
<< std::strerror(errno) << ")";
|
||||
@@ -653,7 +657,8 @@ int Device::openSysfsFileStream(DevInfoTypes type, T *fs, const char *str) {
|
||||
return errno;
|
||||
}
|
||||
|
||||
ss << "Successfully opened SYSFS file (" << sysfs_path
|
||||
ss << __PRETTY_FUNCTION__ << " | Successfully opened SYSFS file ("
|
||||
<< sysfs_path
|
||||
<< ") for DevInfoInfoType (" << RocmSMI::devInfoTypesStrings.at(type)
|
||||
<< ")";
|
||||
LOG_INFO(ss);
|
||||
@@ -701,32 +706,51 @@ int Device::readDevInfoStr(DevInfoTypes type, std::string *retStr) {
|
||||
ret = openSysfsFileStream(type, &fs);
|
||||
if (ret != 0) {
|
||||
ss << "Could not read device info string for DevInfoType ("
|
||||
<< RocmSMI::devInfoTypesStrings.at(type)<< "), returning "
|
||||
<< RocmSMI::devInfoTypesStrings.at(type) << "), returning "
|
||||
<< std::to_string(ret);
|
||||
LOG_ERROR(ss);
|
||||
return ret;
|
||||
}
|
||||
|
||||
fs >> *retStr;
|
||||
std::string info = "Successfully read device info string for DevInfoType (" +
|
||||
RocmSMI::devInfoTypesStrings.at(type) + "): " +
|
||||
*retStr;
|
||||
LOG_INFO(info);
|
||||
fs.close();
|
||||
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< "Successfully read device info string for DevInfoType (" +
|
||||
RocmSMI::devInfoTypesStrings.at(type) + "): " + *retStr
|
||||
<< " | "
|
||||
<< (fs.is_open() ? " File stream is opened" : " File stream is closed")
|
||||
<< " | " << (fs.bad() ? "[ERROR] Bad read operation" :
|
||||
"[GOOD] No bad bit read, successful read operation")
|
||||
<< " | " << (fs.fail() ? "[ERROR] Failed read - format error" :
|
||||
"[GOOD] No fail - Successful read operation")
|
||||
<< " | " << (fs.eof() ? "[ERROR] Failed read - EOF error" :
|
||||
"[GOOD] No eof error - Successful read operation")
|
||||
<< " | " << (fs.good() ? "[GOOD] read good - Successful read operation" :
|
||||
"[ERROR] Failed read - good error");
|
||||
LOG_INFO(ss);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Device::writeDevInfoStr(DevInfoTypes type, std::string valStr) {
|
||||
auto tempPath = path_;
|
||||
int Device::writeDevInfoStr(DevInfoTypes type, std::string valStr,
|
||||
bool returnWriteErr) {
|
||||
// returnWriteErr = false, backwards compatability (old calls)
|
||||
// returnWriteErr = true, improvement - allows us to detect errors
|
||||
// when writing to file
|
||||
// (such as EBUSY)
|
||||
auto sysfs_path = path_;
|
||||
sysfs_path += "/device/";
|
||||
sysfs_path += kDevAttribNameMap.at(type);
|
||||
std::ofstream fs;
|
||||
int ret;
|
||||
std::ostringstream ss;
|
||||
|
||||
fs.rdbuf()->pubsetbuf(nullptr,0);
|
||||
fs.flush();
|
||||
fs.rdbuf()->pubsetbuf(0, 0);
|
||||
ret = openSysfsFileStream(type, &fs, valStr.c_str());
|
||||
if (ret != 0) {
|
||||
ss << "Could not write device info string (" << valStr
|
||||
fs.close();
|
||||
ss << __PRETTY_FUNCTION__ << " | Issue: Could not open fileStream; "
|
||||
<< "Could not write device info string (" << valStr
|
||||
<< ") for DevInfoType (" << RocmSMI::devInfoTypesStrings.at(type)
|
||||
<< "), returning " << std::to_string(ret);
|
||||
LOG_ERROR(ss);
|
||||
@@ -735,19 +759,39 @@ int Device::writeDevInfoStr(DevInfoTypes type, std::string valStr) {
|
||||
|
||||
// We'll catch any exceptions in rocm_smi.cc code.
|
||||
if (fs << valStr) {
|
||||
fs.flush();
|
||||
fs.close();
|
||||
ss << "Successfully wrote device info string (" << valStr
|
||||
<< ") for DevInfoType (" << RocmSMI::devInfoTypesStrings.at(type)
|
||||
<< "), returning RSMI_STATUS_SUCCESS";
|
||||
LOG_INFO(ss);
|
||||
ret = RSMI_STATUS_SUCCESS;
|
||||
} else {
|
||||
ss << "Could not write device info string (" << valStr
|
||||
if (returnWriteErr) {
|
||||
ret = errno;
|
||||
} else {
|
||||
ret = RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
fs.flush();
|
||||
fs.close();
|
||||
ss << __PRETTY_FUNCTION__ << " | Issue: Could not write to file; "
|
||||
<< "Could not write device info string (" << valStr
|
||||
<< ") for DevInfoType (" << RocmSMI::devInfoTypesStrings.at(type)
|
||||
<< "), returning RSMI_STATUS_NOT_SUPPORTED";
|
||||
<< "), returning " << getRSMIStatusString(ErrnoToRsmiStatus(ret));
|
||||
ss << " | "
|
||||
<< (fs.is_open() ? "[ERROR] File stream open" :
|
||||
"[GOOD] File stream closed")
|
||||
<< " | " << (fs.bad() ? "[ERROR] Bad write operation" :
|
||||
"[GOOD] No bad bit write, successful write operation")
|
||||
<< " | " << (fs.fail() ? "[ERROR] Failed write - format error" :
|
||||
"[GOOD] No fail - Successful write operation")
|
||||
<< " | " << (fs.eof() ? "[ERROR] Failed write - EOF error" :
|
||||
"[GOOD] No eof error - Successful write operation")
|
||||
<< " | " << (fs.good() ?
|
||||
"[GOOD] Write good - Successful write operation" :
|
||||
"[ERROR] Failed write - good error");
|
||||
LOG_ERROR(ss);
|
||||
ret = RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
fs.close();
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -786,6 +830,9 @@ int Device::writeDevInfo(DevInfoTypes type, uint64_t val) {
|
||||
}
|
||||
|
||||
int Device::writeDevInfo(DevInfoTypes type, std::string val) {
|
||||
auto sysfs_path = path_;
|
||||
sysfs_path += "/device/";
|
||||
sysfs_path += kDevAttribNameMap.at(type);
|
||||
switch (type) {
|
||||
case kDevGPUMClk:
|
||||
case kDevDCEFClk:
|
||||
@@ -794,9 +841,10 @@ int Device::writeDevInfo(DevInfoTypes type, std::string val) {
|
||||
case kDevPCIEClk:
|
||||
case kDevPowerODVoltage:
|
||||
case kDevSOCClk:
|
||||
return writeDevInfoStr(type, val);
|
||||
case kDevComputePartition:
|
||||
case kDevMemoryPartition:
|
||||
return writeDevInfoStr(type, val);
|
||||
return writeDevInfoStr(type, val, true);
|
||||
|
||||
default:
|
||||
return EINVAL;
|
||||
@@ -929,6 +977,7 @@ int Device::readDevInfo(DevInfoTypes type, uint64_t *val) {
|
||||
std::string tempStr;
|
||||
int ret;
|
||||
int tmp_val;
|
||||
std::ostringstream ss;
|
||||
|
||||
switch (type) {
|
||||
case kDevDevID:
|
||||
|
||||
@@ -496,6 +496,17 @@ rsmi_dev_gpu_metrics_info_get(uint32_t dv_ind, rsmi_gpu_metrics_t *smu) {
|
||||
// a specific version.
|
||||
*smu = {};
|
||||
|
||||
bool isRevisionExpected = ((dev->gpu_metrics_ver().content_revision == 1) ||
|
||||
(dev->gpu_metrics_ver().content_revision == 2) ||
|
||||
(dev->gpu_metrics_ver().content_revision == 3));
|
||||
if (isRevisionExpected == false) {
|
||||
ss << __PRETTY_FUNCTION__ << " | content revision was = "
|
||||
<< print_unsigned_hex_and_int(dev->gpu_metrics_ver().content_revision)
|
||||
<< ", expected version 1,2, or 3 | returning "
|
||||
<< getRSMIStatusString(RSMI_STATUS_NOT_SUPPORTED);
|
||||
LOG_ERROR(ss);
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
if (dev->gpu_metrics_ver().content_revision ==
|
||||
RSMI_GPU_METRICS_API_CONTENT_VER_1) {
|
||||
ret = GetDevBinaryBlob(amd::smi::kDevGpuMetrics, dv_ind,
|
||||
|
||||
@@ -1042,5 +1042,26 @@ int get_gpu_id(uint32_t node, uint64_t *gpu_id) {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
// /sys/class/kfd/kfd/topology/nodes/*/properties | grep gfx_target_version
|
||||
int KFDNode::get_gfx_target_version(uint64_t *gfx_target_version) {
|
||||
std::ostringstream ss;
|
||||
std::string properties_path = "/sys/class/kfd/kfd/topology/nodes/"
|
||||
+ std::to_string(this->node_indx_) + "/properties";
|
||||
uint64_t gfx_version = 0;
|
||||
int ret = read_node_properties(this->node_indx_, "gfx_target_version",
|
||||
&gfx_version);
|
||||
*gfx_target_version = gfx_version;
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | File: " << properties_path
|
||||
<< " | Successfully read node #" << std::to_string(this->node_indx_)
|
||||
<< " for gfx_target_version"
|
||||
<< " | Data (gfx_target_version) *gfx_target_version = "
|
||||
<< std::to_string(*gfx_target_version)
|
||||
<< " | return = " << std::to_string(ret)
|
||||
<< " | ";
|
||||
LOG_DEBUG(ss);
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
@@ -450,6 +450,12 @@ RocmSMI::Initialize(uint64_t flags) {
|
||||
// store each device boot partition state, if file doesn't exist
|
||||
dev->storeDevicePartitions(dv_ind);
|
||||
}
|
||||
|
||||
// Assists displaying GPU information after device enumeration
|
||||
// Otherwise GPU related info will not be discoverable
|
||||
if (ROCmLogging::Logger::getInstance()->isLoggerEnabled()) {
|
||||
logSystemDetails();
|
||||
}
|
||||
// Leaving below to help debug temp file issues
|
||||
// displayAppTmpFilesContent();
|
||||
std::string amdGPUDeviceList = displayAllDevicePaths(devices_);
|
||||
|
||||
@@ -618,9 +618,19 @@ std::tuple<bool, std::string> readTmpFile(uint32_t dv_ind,
|
||||
}
|
||||
|
||||
// wrapper to return string expression of a rsmi_status_t return
|
||||
std::string getRSMIStatusString(rsmi_status_t ret) {
|
||||
// rsmi_status_t ret - return value of RSMI API function
|
||||
// bool fullStatus - defaults to true, set to false to chop off description
|
||||
// Returns:
|
||||
// string - if fullStatus == true, returns full decription of return value
|
||||
// ex. 'RSMI_STATUS_SUCCESS: The function has been executed successfully.'
|
||||
// string - if fullStatus == false, returns a minimalized return value
|
||||
// ex. 'RSMI_STATUS_SUCCESS'
|
||||
std::string getRSMIStatusString(rsmi_status_t ret, bool fullStatus) {
|
||||
const char *err_str;
|
||||
rsmi_status_string(ret, &err_str);
|
||||
if (!fullStatus) {
|
||||
return splitString(std::string(err_str), ':');
|
||||
}
|
||||
return std::string(err_str);
|
||||
}
|
||||
|
||||
@@ -639,9 +649,13 @@ std::string getRSMIStatusString(rsmi_status_t ret) {
|
||||
// Expressed as big endian or little endian.
|
||||
// Big Endian (BE), multi-bit symbols encoded as big endian (MSB first)
|
||||
// Little Endian (LE), multi-bit symbols encoded as little endian (LSB first)
|
||||
// string rocm_lib_path = Path to library
|
||||
// string rocm_build_type = Release or debug
|
||||
// string rocm_build_date = Creation date of library
|
||||
// string dev_gfx_versions = GPU target graphics version
|
||||
std::tuple<bool, std::string, std::string, std::string, std::string,
|
||||
std::string, std::string, std::string, std::string,
|
||||
std::string, std::string, std::string>
|
||||
std::string, std::string, std::string, std::string, std::string>
|
||||
getSystemDetails(void) {
|
||||
struct utsname buf;
|
||||
bool errorDetected = false;
|
||||
@@ -656,7 +670,9 @@ std::tuple<bool, std::string, std::string, std::string, std::string,
|
||||
std::string endianness = "<undefined>";
|
||||
std::string rocm_lib_path = "<undefined>";
|
||||
std::string rocm_build_type = "<undefined>";
|
||||
std::string rocm_build_date = "<undefined>";
|
||||
std::string rocm_env_variables = "<undefined>";
|
||||
std::string dev_gfx_versions = "<undefined>";
|
||||
|
||||
if (uname(&buf) < 0) {
|
||||
errorDetected = true;
|
||||
@@ -693,11 +709,20 @@ std::tuple<bool, std::string, std::string, std::string, std::string,
|
||||
}
|
||||
rocm_build_type = getBuildType();
|
||||
rocm_lib_path = getMyLibPath();
|
||||
rocm_build_date = getFileCreationDate(rocm_lib_path);
|
||||
rocm_env_variables = RocmSMI::getInstance().getRSMIEnvVarInfo();
|
||||
std::queue<std::string> devGraphicsVersions = getAllDeviceGfxVers();
|
||||
if (devGraphicsVersions.empty() == false) {
|
||||
dev_gfx_versions = "";
|
||||
while (devGraphicsVersions.empty() == false) {
|
||||
dev_gfx_versions += "\n\t" + devGraphicsVersions.front();
|
||||
devGraphicsVersions.pop();
|
||||
}
|
||||
}
|
||||
return std::make_tuple(errorDetected, sysname, nodename, release,
|
||||
version, machine, domainName, os_distribution,
|
||||
endianness, rocm_build_type, rocm_lib_path,
|
||||
rocm_env_variables);
|
||||
rocm_build_date, rocm_env_variables, dev_gfx_versions);
|
||||
}
|
||||
|
||||
// If logging is enabled through RSMI_LOGGING environment variable.
|
||||
@@ -706,10 +731,11 @@ void logSystemDetails(void) {
|
||||
std::ostringstream ss;
|
||||
bool errorDetected;
|
||||
std::string sysname, node, release, version, machine, domain, distName,
|
||||
endianness, rocm_build_type, lib_path, rocm_env_vars;
|
||||
endianness, rocm_build_type, lib_path, build_date, rocm_env_vars,
|
||||
dev_gfx_versions;
|
||||
std::tie(errorDetected, sysname, node, release, version, machine, domain,
|
||||
distName, endianness, rocm_build_type, lib_path,
|
||||
rocm_env_vars) = getSystemDetails();
|
||||
distName, endianness, rocm_build_type, lib_path, build_date,
|
||||
rocm_env_vars, dev_gfx_versions) = getSystemDetails();
|
||||
if (errorDetected == false) {
|
||||
ss << "====== Gathered system details ============\n"
|
||||
<< "SYSTEM NAME: " << sysname << "\n"
|
||||
@@ -722,7 +748,9 @@ void logSystemDetails(void) {
|
||||
<< "ENDIANNESS: " << endianness << "\n"
|
||||
<< "ROCM BUILD TYPE: " << rocm_build_type << "\n"
|
||||
<< "ROCM-SMI-LIB PATH: " << lib_path << "\n"
|
||||
<< "ROCM ENV VARIABLES: " << rocm_env_vars << "\n";
|
||||
<< "ROCM-SMI-LIB BUILD DATE: " << build_date << "\n"
|
||||
<< "ROCM ENV VARIABLES: " << rocm_env_vars
|
||||
<< "AMD GFX VERSIONS: " << dev_gfx_versions << "\n";
|
||||
LOG_INFO(ss);
|
||||
} else {
|
||||
ss << "====== Gathered system details ============\n"
|
||||
@@ -873,6 +901,13 @@ std::string getMyLibPath(void) {
|
||||
return path;
|
||||
}
|
||||
|
||||
std::string getFileCreationDate(std::string path) {
|
||||
struct stat t_stat;
|
||||
stat(path.c_str(), &t_stat);
|
||||
struct tm *timeinfo = localtime(&t_stat.st_ctime); // NOLINT
|
||||
return removeNewLines(std::string(asctime(timeinfo))); // NOLINT
|
||||
}
|
||||
|
||||
rsmi_status_t getBDFString(uint64_t bdf_id, std::string& bfd_str)
|
||||
{
|
||||
auto result = rsmi_status_t::RSMI_STATUS_SUCCESS;
|
||||
@@ -1016,5 +1051,164 @@ std::string power_type_string(RSMI_POWER_TYPE type) {
|
||||
return powerTypesToString.at(type);
|
||||
}
|
||||
|
||||
std::string splitString(std::string str, char delim) {
|
||||
std::vector<std::string> tokens;
|
||||
std::stringstream ss(str);
|
||||
std::string token;
|
||||
|
||||
if (str.empty()) {
|
||||
return "";
|
||||
}
|
||||
|
||||
while (std::getline(ss, token, delim)) {
|
||||
tokens.push_back(token);
|
||||
return token; // return 1st match
|
||||
}
|
||||
}
|
||||
|
||||
static std::string pt_rng_Mhz(std::string title, rsmi_range *r) {
|
||||
std::ostringstream ss;
|
||||
if (r == nullptr) {
|
||||
ss << "pt_rng_Mhz | rsmi_range r = nullptr\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
ss << title;
|
||||
ss << r->lower_bound/1000000 << " to "
|
||||
<< r->upper_bound/1000000 << " MHz" << "\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
static std::string pt_rng_mV(std::string title, rsmi_range *r) {
|
||||
std::ostringstream ss;
|
||||
if (r == nullptr) {
|
||||
ss << "pt_rng_mV | rsmi_range r = nullptr\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
ss << title;
|
||||
ss << r->lower_bound << " to " << r->upper_bound
|
||||
<< " mV" << "\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
static std::string print_pnt(rsmi_od_vddc_point_t *pt) {
|
||||
std::ostringstream ss;
|
||||
ss << "\t\t** Frequency: " << pt->frequency/1000000 << " MHz\n";
|
||||
ss << "\t\t** Voltage: " << pt->voltage << " mV\n";
|
||||
return ss.str();
|
||||
}
|
||||
static std::string pt_vddc_curve(rsmi_od_volt_curve *c) {
|
||||
std::ostringstream ss;
|
||||
if (c == nullptr) {
|
||||
ss << "pt_vddc_curve | rsmi_od_volt_curve c = nullptr\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < RSMI_NUM_VOLTAGE_CURVE_POINTS; ++i) {
|
||||
ss << print_pnt(&c->vc_points[i]);
|
||||
}
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string print_rsmi_od_volt_freq_data_t(rsmi_od_volt_freq_data_t *odv) {
|
||||
std::ostringstream ss;
|
||||
if (odv == nullptr) {
|
||||
ss << "rsmi_od_volt_freq_data_t odv = nullptr\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
ss << pt_rng_Mhz("\t**Current SCLK frequency range: ", &odv->curr_sclk_range);
|
||||
ss << pt_rng_Mhz("\t**Current MCLK frequency range: ", &odv->curr_mclk_range);
|
||||
ss << pt_rng_Mhz("\t**Min/Max Possible SCLK frequency range: ",
|
||||
&odv->sclk_freq_limits);
|
||||
ss << pt_rng_Mhz("\t**Min/Max Possible MCLK frequency range: ",
|
||||
&odv->mclk_freq_limits);
|
||||
|
||||
ss << "\t**Current Freq/Volt. curve: " << "\n";
|
||||
ss << pt_vddc_curve(&odv->curve);
|
||||
|
||||
ss << "\t**Number of Freq./Volt. regions: " << odv->num_regions << "\n\n";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string print_odv_region(rsmi_freq_volt_region_t *region) {
|
||||
std::ostringstream ss;
|
||||
ss << pt_rng_Mhz("\t\tFrequency range: ", ®ion->freq_range);
|
||||
ss << pt_rng_mV("\t\tVoltage range: ", ®ion->volt_range);
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string print_rsmi_od_volt_freq_regions(uint32_t num_regions,
|
||||
rsmi_freq_volt_region_t *regions) {
|
||||
std::ostringstream ss;
|
||||
if (regions == nullptr) {
|
||||
ss << "rsmi_freq_volt_region_t regions = nullptr\n";
|
||||
return ss.str();
|
||||
}
|
||||
for (uint32_t i = 0; i < num_regions; ++i) {
|
||||
ss << "\tRegion " << i << ": " << "\n";
|
||||
ss << print_odv_region(®ions[i]);
|
||||
}
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
bool is_sudo_user() {
|
||||
std::ostringstream ss;
|
||||
bool isRunningWithSudo = false;
|
||||
auto myUID = getuid();
|
||||
auto myPrivledges = geteuid();
|
||||
if ((myUID == myPrivledges) && (myPrivledges == 0)) {
|
||||
isRunningWithSudo = true;
|
||||
}
|
||||
ss << __PRETTY_FUNCTION__ << (isRunningWithSudo ? " | running as sudoer" :
|
||||
" | NOT running as sudoer");
|
||||
LOG_DEBUG(ss);
|
||||
return isRunningWithSudo;
|
||||
}
|
||||
|
||||
rsmi_status_t rsmi_get_gfx_target_version(uint32_t dv_ind,
|
||||
std::string *gfx_version) {
|
||||
std::ostringstream ss;
|
||||
uint64_t kfd_gfx_version = 0;
|
||||
GET_DEV_AND_KFDNODE_FROM_INDX
|
||||
|
||||
int ret = kfd_node->get_gfx_target_version(&kfd_gfx_version);
|
||||
if (ret == 0) {
|
||||
ss << "gfx" << kfd_gfx_version;
|
||||
*gfx_version = ss.str();
|
||||
return RSMI_STATUS_SUCCESS;
|
||||
} else {
|
||||
*gfx_version = "Unknown";
|
||||
return RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
std::queue<std::string> getAllDeviceGfxVers() {
|
||||
uint32_t num_monitor_devs = 0;
|
||||
rsmi_status_t ret;
|
||||
std::queue<std::string> deviceGfxVersions;
|
||||
std::string response = "";
|
||||
std::string dev_gfx_ver = "";
|
||||
|
||||
ret = rsmi_num_monitor_devices(&num_monitor_devs);
|
||||
if (ret != RSMI_STATUS_SUCCESS || num_monitor_devs == 0) {
|
||||
response = "N/A - No AMD devices detected";
|
||||
deviceGfxVersions.push(response);
|
||||
return deviceGfxVersions;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num_monitor_devs; ++i) {
|
||||
ret = amd::smi::rsmi_get_gfx_target_version(i , &dev_gfx_ver);
|
||||
response = "Device[" + std::to_string(i) + "]: ";
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
deviceGfxVersions.push(response + getRSMIStatusString(ret, false));
|
||||
} else {
|
||||
deviceGfxVersions.push(response + std::string(dev_gfx_ver));
|
||||
}
|
||||
}
|
||||
return deviceGfxVersions;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* The University of Illinois/NCSA
|
||||
* Open Source License (NCSA)
|
||||
*
|
||||
* Copyright (c) 022, Advanced Micro Devices, Inc.
|
||||
* Copyright (c) 2020-2023, Advanced Micro Devices, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Developed by:
|
||||
@@ -106,20 +106,25 @@ void TestPerfDeterminism::Run(void) {
|
||||
err = amdsmi_get_gpu_od_volt_info(processor_handles_[i], &odv);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** Not supported on this machine" << std::endl;
|
||||
std::cout << "\t** Not supported on this machine\n";
|
||||
}
|
||||
return;
|
||||
}
|
||||
else{
|
||||
} else if (err == AMDSMI_STATUS_SUCCESS) {
|
||||
clkvalue = (odv.curr_sclk_range.lower_bound/1000000) + 50;
|
||||
} else {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t** Unable to retrieve lower bound sclk, continue.. \n";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
std::cout << "About to rsmi_perf_determinism_mode_set() -->\n";
|
||||
|
||||
err = amdsmi_set_gpu_perf_determinism_mode(processor_handles_[i], clkvalue);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Not supported on this machine" << std::endl;
|
||||
}
|
||||
return;
|
||||
continue;
|
||||
} else {
|
||||
ret = amdsmi_get_gpu_perf_level(processor_handles_[i], &pfl);
|
||||
CHK_ERR_ASRT(ret)
|
||||
@@ -138,7 +143,6 @@ void TestPerfDeterminism::Run(void) {
|
||||
std::cout << "\t**New Perf Level:" << GetPerfLevelStr(pfl) <<
|
||||
std::endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
} // END - SET SUPPORTED
|
||||
} // END - DEVICE LOOP
|
||||
}
|
||||
|
||||
@@ -160,6 +160,7 @@ void TestVoltCurvRead::Run(void) {
|
||||
err = amdsmi_get_gpu_od_volt_info(processor_handles_[i], &odv);
|
||||
if (err == AMDSMI_STATUS_NOT_SUPPORTED
|
||||
|| err == AMDSMI_STATUS_NOT_YET_IMPLEMENTED) {
|
||||
//TODO add perf_level tests
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout <<
|
||||
"\t** amdsmi_get_gpu_od_volt_info: Not supported on this machine"
|
||||
|
||||
Ссылка в новой задаче
Block a user