Merge amd-staging into amd-master 20230727
Signed-off-by: Hao Zhou <Hao.Zhou@amd.com> Change-Id: I476516b5ce8c7a6c05d48d06acd7736141bee0dd
Этот коммит содержится в:
@@ -15,3 +15,6 @@ build/
|
||||
|
||||
# CMake cache
|
||||
.cache/
|
||||
|
||||
# Simulated SYSFS - for early development or debug
|
||||
device/
|
||||
+24
-19
@@ -1,32 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
#set -x
|
||||
|
||||
packageName="rocm-smi-lib"
|
||||
logPath=/var/log/rocm_smi_lib
|
||||
logName=ROCm-SMI-lib.log
|
||||
logFile="${logPath}/${logName}"
|
||||
logrotateConfFile=/etc/logrotate.d/rocm_smi.conf
|
||||
|
||||
do_addLogFolder() {
|
||||
sudo mkdir -p /var/log/rocm_smi_lib
|
||||
sudo touch /var/log/rocm_smi_lib/ROCm-SMI-lib.log
|
||||
sudo chmod -R a+rw /var/log/rocm_smi_lib
|
||||
sudo chmod a+rw /var/log/rocm_smi_lib/ROCm-SMI-lib.log
|
||||
sudo mkdir -p "${logPath}"
|
||||
sudo touch "${logFile}"
|
||||
sudo chmod -R a+rw "${logPath}"
|
||||
sudo chmod a+rw "${logFile}"
|
||||
}
|
||||
|
||||
do_configureLogrotate() {
|
||||
logrotate --version &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "[WARNING] Detected logrotate is not installed."\
|
||||
"ROCm-smi logs (when turned on) will not rotate properly."
|
||||
"$packageName logs (when turned on) will not rotate properly."
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/logrotate.d/rocm_smi.conf ]; then
|
||||
sudo touch /etc/logrotate.d/rocm_smi.conf
|
||||
sudo chmod 644 /etc/logrotate.d/rocm_smi.conf # root r/w, all others read
|
||||
if [ ! -f $logrotateConfFile ]; then
|
||||
sudo touch "${logrotateConfFile}"
|
||||
sudo chmod 644 "${logrotateConfFile}" # root r/w, all others read
|
||||
# ROCm SMI logging rotation, rotates files using root user/group
|
||||
# Hourly logrotation check
|
||||
# Only rotates if size grew larger than 1MB
|
||||
# Max of 4 rotation files, oldest will be removed
|
||||
# Rotated files use date extention of ex. ROCm-SMI-lib.log.2023-05-09_16:51:42
|
||||
cat <<'EOF' | sudo tee /etc/logrotate.d/rocm_smi.conf >/dev/null
|
||||
/var/log/rocm_smi_lib/ROCm-SMI-lib.log {
|
||||
cat << EOF | sudo tee "${logrotateConfFile}" >/dev/null
|
||||
${logFile} {
|
||||
su root root
|
||||
hourly
|
||||
missingok
|
||||
@@ -42,12 +47,12 @@ EOF
|
||||
# issue was RPM build thought we were using macros
|
||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/22965
|
||||
# https://rpm-software-management.github.io/rpm/manual/spec.html
|
||||
sudo sed -i s/%%/%/g /etc/logrotate.d/rocm_smi.conf
|
||||
sudo sed -i s/%%/%/g "${logrotateConfFile}"
|
||||
# workaround: remove extra 'OURCE' text
|
||||
# from rocm_smi.conf. Unsure if CMAKE,
|
||||
# bash, or here document
|
||||
# issue (only seen on RHEL 8.7)
|
||||
sudo sed -i s/OURCE//g /etc/logrotate.d/rocm_smi.conf
|
||||
sudo sed -i s/OURCE//g "${logrotateConfFile}"
|
||||
fi
|
||||
# check if logrotate uses system timers, Ubuntu/modern OS's do
|
||||
# Several older OS's like RHEL 8.7, do not. Instead defaults
|
||||
@@ -60,16 +65,16 @@ EOF
|
||||
if [ -f /etc/cron.hourly/logrotate ]; then
|
||||
sudo mv /etc/cron.daily/logrotate /etc/cron.hourly/logrotate
|
||||
else
|
||||
echo "[WARNING] Could find and configure hourly cron for ROCm-smi's"\
|
||||
" logrotate. ROCm-smi logs (when turned on) will not rotate properly."
|
||||
echo "[WARNING] Could find and configure hourly cron for $packageName's"\
|
||||
" logrotate. $packageName logs (when turned on) will not rotate properly."
|
||||
return
|
||||
fi
|
||||
else
|
||||
# confirm that it's already been moved to hourly
|
||||
sudo find /etc/cron.* -iname logrotate -print -quit |grep -iq hourly
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "[WARNING] Could not configure an hourly cron for ROCm-smi's logrotate."\
|
||||
"ROCm-smi logs (when turned on) may not rotate properly."
|
||||
echo "[WARNING] Could not configure an hourly cron for $packageName's logrotate."\
|
||||
"$packageName logs (when turned on) may not rotate properly."
|
||||
fi
|
||||
fi
|
||||
else
|
||||
@@ -94,8 +99,8 @@ WantedBy=timers.target
|
||||
EOF
|
||||
sudo systemctl reenable --now logrotate.timer
|
||||
else
|
||||
echo "[WARNING] Could not configure systemd timer for ROCm's logrotate."\
|
||||
"ROCm-smi logs (when turned on) will not rotate properly."
|
||||
echo "[WARNING] Could not configure systemd timer for $packageName's logrotate."\
|
||||
"$packageName logs (when turned on) will not rotate properly."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
+10
-4
@@ -1,14 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
packageName="rocm-smi-lib"
|
||||
logPath=/var/log/rocm_smi_lib
|
||||
logName=ROCm-SMI-lib.log
|
||||
logFile="${logPath}/${logName}"
|
||||
logrotateConfFile=/etc/logrotate.d/rocm_smi.conf
|
||||
|
||||
rm_logFolder() {
|
||||
sudo rm -rf /var/log/rocm_smi_lib
|
||||
sudo rm -rf "$logPath"
|
||||
}
|
||||
|
||||
return_logrotateToOrigConfig() {
|
||||
if [ -f /etc/logrotate.d/rocm_smi.conf ]; then
|
||||
sudo rm -rf /etc/logrotate.d/rocm_smi.conf
|
||||
if [ -f $logrotateConfFile ]; then
|
||||
sudo rm -rf "${logrotateConfFile}"
|
||||
fi
|
||||
if [ -f /etc/cron.hourly/logrotate ]; then
|
||||
sudo mv /etc/cron.hourly/logrotate /etc/cron.daily/logrotate
|
||||
@@ -33,6 +38,7 @@ rm_pyc() {
|
||||
rm -rf @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBEXECDIR@/rocm_smi/__pycache__
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
( remove | upgrade)
|
||||
rm_ldconfig
|
||||
|
||||
+7
-8
@@ -8,7 +8,7 @@ The ROCm System Management Interface Library, or ROCm SMI library, is part of th
|
||||
|
||||
The information contained herein is for informational purposes only, and is subject to change without notice. In addition, any stated support is planned and is also subject to change. 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.
|
||||
|
||||
© 2022 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
© 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
|
||||
|
||||
# Building ROCm SMI
|
||||
@@ -28,8 +28,8 @@ After the ROCm SMI library git repository has been cloned to a local Linux machi
|
||||
```shell
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake <location of root of ROCm SMI library CMakeLists.txt>
|
||||
make
|
||||
cmake ..
|
||||
make -j $(nproc)
|
||||
# Install library file and header; default location is /opt/rocm
|
||||
$ make install
|
||||
```
|
||||
@@ -57,11 +57,10 @@ In order to verify the build and capability of ROCm SMI on your system and to se
|
||||
|
||||
```shell
|
||||
# Set environment variables used in CMakeLists.txt file
|
||||
ROCM_DIR=<parent dir. to lib/ and inc/, containing RSMI library and header>
|
||||
mkdir <location for test build>
|
||||
cd <location for test build>
|
||||
cmake -DROCM_DIR=$ROCM_DIR <ROCm SMI source root>/tests/rocm_smi_test
|
||||
make
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DBUILD_TESTS=ON ..
|
||||
make -j $(nproc)
|
||||
```
|
||||
|
||||
To run the test, execute the program `rsmitst` that is built from the steps above.
|
||||
|
||||
+32
-18
@@ -1,31 +1,37 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
|
||||
packageName="rocm-smi-lib"
|
||||
logPath=/var/log/rocm_smi_lib
|
||||
logName=ROCm-SMI-lib.log
|
||||
logFile="${logPath}/${logName}"
|
||||
logrotateConfFile=/etc/logrotate.d/rocm_smi.conf
|
||||
|
||||
do_addLogFolder() {
|
||||
sudo mkdir -p /var/log/rocm_smi_lib
|
||||
sudo touch /var/log/rocm_smi_lib/ROCm-SMI-lib.log
|
||||
sudo chmod -R a+rw /var/log/rocm_smi_lib
|
||||
sudo chmod a+rw /var/log/rocm_smi_lib/ROCm-SMI-lib.log
|
||||
sudo mkdir -p "${logPath}"
|
||||
sudo touch "${logFile}"
|
||||
sudo chmod -R a+rw "${logPath}"
|
||||
sudo chmod a+rw "${logFile}"
|
||||
}
|
||||
|
||||
do_configureLogrotate() {
|
||||
logrotate --version &>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "[WARNING] Detected logrotate is not installed."\
|
||||
"ROCm-smi logs (when turned on) will not rotate properly."
|
||||
"$packageName logs (when turned on) will not rotate properly."
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f /etc/logrotate.d/rocm_smi.conf ]; then
|
||||
sudo touch /etc/logrotate.d/rocm_smi.conf
|
||||
sudo chmod 644 /etc/logrotate.d/rocm_smi.conf # root r/w, all others read
|
||||
if [ ! -f $logrotateConfFile ]; then
|
||||
sudo touch "${logrotateConfFile}"
|
||||
sudo chmod 644 "${logrotateConfFile}" # root r/w, all others read
|
||||
# ROCm SMI logging rotation, rotates files using root user/group
|
||||
# Hourly logrotation check
|
||||
# Only rotates if size grew larger than 1MB
|
||||
# Max of 4 rotation files, oldest will be removed
|
||||
# Rotated files use date extention of ex. ROCm-SMI-lib.log.2023-05-09_16:51:42
|
||||
cat <<'EOF' | sudo tee /etc/logrotate.d/rocm_smi.conf >/dev/null
|
||||
/var/log/rocm_smi_lib/ROCm-SMI-lib.log {
|
||||
cat << EOF | sudo tee "${logrotateConfFile}" >/dev/null
|
||||
${logFile} {
|
||||
su root root
|
||||
hourly
|
||||
missingok
|
||||
@@ -41,12 +47,12 @@ EOF
|
||||
# issue was RPM build thought we were using macros
|
||||
# https://gitlab.kitware.com/cmake/cmake/-/issues/22965
|
||||
# https://rpm-software-management.github.io/rpm/manual/spec.html
|
||||
sudo sed -i s/%%/%/g /etc/logrotate.d/rocm_smi.conf
|
||||
sudo sed -i s/%%/%/g "${logrotateConfFile}"
|
||||
# workaround: remove extra 'OURCE' text
|
||||
# from rocm_smi.conf. Unsure if CMAKE,
|
||||
# bash, or here document
|
||||
# issue (only seen on RHEL 8.7)
|
||||
sudo sed -i s/OURCE//g /etc/logrotate.d/rocm_smi.conf
|
||||
sudo sed -i s/OURCE//g "${logrotateConfFile}"
|
||||
fi
|
||||
# check if logrotate uses system timers, Ubuntu/modern OS's do
|
||||
# Several older OS's like RHEL 8.7, do not. Instead defaults
|
||||
@@ -59,16 +65,16 @@ EOF
|
||||
if [ -f /etc/cron.hourly/logrotate ]; then
|
||||
sudo mv /etc/cron.daily/logrotate /etc/cron.hourly/logrotate
|
||||
else
|
||||
echo "[WARNING] Could find and configure hourly cron for ROCm-smi's"\
|
||||
" logrotate. ROCm-smi logs (when turned on) will not rotate properly."
|
||||
echo "[WARNING] Could find and configure hourly cron for $packageName's"\
|
||||
" logrotate. $packageName logs (when turned on) will not rotate properly."
|
||||
return
|
||||
fi
|
||||
else
|
||||
# confirm that it's already been moved to hourly
|
||||
sudo find /etc/cron.* -iname logrotate -print -quit |grep -iq hourly
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "[WARNING] Could not configure an hourly cron for ROCm-smi's logrotate."\
|
||||
"ROCm-smi logs (when turned on) may not rotate properly."
|
||||
echo "[WARNING] Could not configure an hourly cron for $packageName's logrotate."\
|
||||
"$packageName logs (when turned on) may not rotate properly."
|
||||
fi
|
||||
fi
|
||||
else
|
||||
@@ -93,12 +99,20 @@ WantedBy=timers.target
|
||||
EOF
|
||||
sudo systemctl reenable --now logrotate.timer
|
||||
else
|
||||
echo "[WARNING] Could not configure systemd timer for ROCm's logrotate."\
|
||||
"ROCm-smi logs (when turned on) will not rotate properly."
|
||||
echo "[WARNING] Could not configure systemd timer for $packageName's logrotate."\
|
||||
"$packageName logs (when turned on) will not rotate properly."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
do_ldconfig() {
|
||||
# left-hand term originates from ENABLE_LDCONFIG = ON/OFF at package build
|
||||
if [ "@ENABLE_LDCONFIG@" == "ON" ]; then
|
||||
echo @CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ > /etc/ld.so.conf.d/x86_64-librocm_smi_lib.conf
|
||||
ldconfig
|
||||
fi
|
||||
}
|
||||
|
||||
# left-hand term originates from ENABLE_LDCONFIG = ON/OFF at package build
|
||||
if [ "@ENABLE_LDCONFIG@" == "ON" ]; then
|
||||
echo -e "@CPACK_PACKAGING_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@" > /etc/ld.so.conf.d/x86_64-librocm_smi_lib.conf
|
||||
|
||||
+9
-3
@@ -1,13 +1,19 @@
|
||||
#!/bin/bash
|
||||
#set -x
|
||||
|
||||
packageName="rocm-smi-lib"
|
||||
logPath=/var/log/rocm_smi_lib
|
||||
logName=ROCm-SMI-lib.log
|
||||
logFile="${logPath}/${logName}"
|
||||
logrotateConfFile=/etc/logrotate.d/rocm_smi.conf
|
||||
|
||||
rm_logFolder() {
|
||||
sudo rm -rf /var/log/rocm_smi_lib
|
||||
sudo rm -rf "$logPath"
|
||||
}
|
||||
|
||||
return_logrotateToOrigConfig() {
|
||||
if [ -f /etc/logrotate.d/rocm_smi.conf ]; then
|
||||
sudo rm -rf /etc/logrotate.d/rocm_smi.conf
|
||||
if [ -f $logrotateConfFile ]; then
|
||||
sudo rm -rf "${logrotateConfFile}"
|
||||
fi
|
||||
if [ -f /etc/cron.hourly/logrotate ]; then
|
||||
sudo mv /etc/cron.hourly/logrotate /etc/cron.daily/logrotate
|
||||
|
||||
@@ -1088,6 +1088,21 @@ rsmi_status_t rsmi_num_monitor_devices(uint32_t *num_devices);
|
||||
*/
|
||||
rsmi_status_t rsmi_dev_id_get(uint32_t dv_ind, uint16_t *id);
|
||||
|
||||
/**
|
||||
* @brief Get the device revision associated with the device
|
||||
*
|
||||
* @details Given a device index @p dv_ind and a pointer to a uint32_t to
|
||||
* which the revision will be written
|
||||
*
|
||||
* @param[in] dv_ind a device index
|
||||
*
|
||||
* @param[inout] revision a pointer to uint32_t to which the device revision
|
||||
* will be written
|
||||
*
|
||||
* @retval ::RSMI_STATUS_SUCCESS is returned upon successful call.
|
||||
*
|
||||
*/
|
||||
rsmi_status_t rsmi_dev_revision_get(uint32_t dv_ind, uint16_t *revision);
|
||||
|
||||
/**
|
||||
* @brief Get the SKU for a desired device associated with the device with
|
||||
|
||||
@@ -100,6 +100,7 @@ enum DevInfoTypes {
|
||||
kDevOverDriveLevel,
|
||||
kDevMemOverDriveLevel,
|
||||
kDevDevID,
|
||||
kDevDevRevID,
|
||||
kDevDevProdName,
|
||||
kDevDevProdNum,
|
||||
kDevVendorID,
|
||||
|
||||
@@ -249,6 +249,17 @@ def getId(device):
|
||||
return hex(dv_id.value)
|
||||
|
||||
|
||||
def getRev(device):
|
||||
""" Return the hexadecimal value of a device's Revision
|
||||
|
||||
@param device: DRM device identifier
|
||||
"""
|
||||
dv_rev = c_short()
|
||||
ret = rocmsmi.rsmi_dev_revision_get(device, byref(dv_rev))
|
||||
if rsmi_ret_ok(ret, device, 'get_device_rev'):
|
||||
return hex(dv_rev.value)
|
||||
|
||||
|
||||
def getMaxPower(device):
|
||||
""" Return the maximum power cap of a given device
|
||||
|
||||
@@ -1620,19 +1631,23 @@ def showAllConciseHw(deviceList):
|
||||
print('ERROR: Cannot print JSON/CSV output for concise hardware output')
|
||||
sys.exit(1)
|
||||
printLogSpacer(' Concise Hardware Info ')
|
||||
header = ['GPU', 'DID', 'GFX RAS', 'SDMA RAS', 'UMC RAS', 'VBIOS', 'BUS']
|
||||
header = ['GPU', 'DID', 'DREV', 'GFX RAS', 'SDMA RAS', 'UMC RAS', 'VBIOS', 'BUS']
|
||||
head_widths = [len(head) + 2 for head in header]
|
||||
values = {}
|
||||
for device in deviceList:
|
||||
gpuid = getId(device)
|
||||
if str(gpuid).startswith('0x'):
|
||||
gpuid = str(gpuid)[2:]
|
||||
gpurev = getRev(device)
|
||||
if str(gpurev).startswith('0x'):
|
||||
gpurev = str(gpurev)[2:]
|
||||
|
||||
gfxRas = getRasEnablement(device, 'GFX')
|
||||
sdmaRas = getRasEnablement(device, 'SDMA')
|
||||
umcRas = getRasEnablement(device, 'UMC')
|
||||
vbios = getVbiosVersion(device)
|
||||
bus = getBus(device)
|
||||
values['card%s' % (str(device))] = [device, gpuid, gfxRas, sdmaRas, umcRas, vbios, bus]
|
||||
values['card%s' % (str(device))] = [device, gpuid, gpurev, gfxRas, sdmaRas, umcRas, vbios, bus]
|
||||
val_widths = {}
|
||||
for device in deviceList:
|
||||
val_widths[device] = [len(str(val)) + 2 for val in values['card%s' % (str(device))]]
|
||||
@@ -1971,6 +1986,7 @@ def showId(deviceList):
|
||||
printLogSpacer(' ID ')
|
||||
for device in deviceList:
|
||||
printLog(device, 'GPU ID', getId(device))
|
||||
printLog(device, 'GPU Rev', getRev(device))
|
||||
printLogSpacer()
|
||||
|
||||
|
||||
|
||||
@@ -11,8 +11,16 @@ import os
|
||||
|
||||
# Use ROCm installation path if running from standard installation
|
||||
# With File Reorg rsmiBindings.py will be installed in /opt/rocm/libexec/rocm_smi.
|
||||
# relative path changed accordingly
|
||||
path_librocm = os.path.dirname(os.path.realpath(__file__)) + '/../../@CMAKE_INSTALL_LIBDIR@/librocm_smi64.so.@VERSION_MAJOR@'
|
||||
# relative path changed accordingly.
|
||||
# if ROCM_SMI_LIB_PATH is set, we can load 'librocm_smi64.so' from that location
|
||||
#
|
||||
path_librocm = str()
|
||||
rocm_smi_lib_path = os.getenv('ROCM_SMI_LIB_PATH')
|
||||
if (rocm_smi_lib_path != None):
|
||||
path_librocm = rocm_smi_lib_path
|
||||
else:
|
||||
path_librocm = os.path.dirname(os.path.realpath(__file__)) + '/../../@CMAKE_INSTALL_LIBDIR@/librocm_smi64.so.@VERSION_MAJOR@'
|
||||
|
||||
if not os.path.isfile(path_librocm):
|
||||
print('Unable to find %s . Trying /opt/rocm*' % path_librocm)
|
||||
for root, dirs, files in os.walk('/opt', followlinks=True):
|
||||
@@ -22,9 +30,10 @@ if not os.path.isfile(path_librocm):
|
||||
print('Using lib from %s' % path_librocm)
|
||||
else:
|
||||
print('Unable to find librocm_smi64.so.@VERSION_MAJOR@')
|
||||
else:
|
||||
print('Library loaded from: %s ' % path_librocm)
|
||||
|
||||
# ----------> TODO: Support static libs as well as SO
|
||||
|
||||
try:
|
||||
cdll.LoadLibrary(path_librocm)
|
||||
rocmsmi = CDLL(path_librocm)
|
||||
@@ -36,7 +45,6 @@ except OSError:
|
||||
.format('\33[33m', '\033[0m'))
|
||||
exit()
|
||||
|
||||
|
||||
# Device ID
|
||||
dv_id = c_uint64()
|
||||
# GPU ID
|
||||
|
||||
@@ -718,6 +718,9 @@ int main() {
|
||||
ret = rsmi_dev_id_get(i, &val_ui16);
|
||||
CHK_RSMI_RET_I(ret)
|
||||
std::cout << "\t**Device ID: 0x" << std::hex << val_ui16 << std::endl;
|
||||
ret = rsmi_dev_revision_get(i, &val_ui16);
|
||||
CHK_RSMI_RET_I(ret)
|
||||
std::cout << "\t**Dev.Rev.ID: 0x" << std::hex << val_ui16 << std::endl;
|
||||
|
||||
char current_compute_partition[256];
|
||||
current_compute_partition[0] = '\0';
|
||||
|
||||
+16
-1
@@ -632,7 +632,7 @@ rsmi_status_t
|
||||
rsmi_dev_ecc_count_get(uint32_t dv_ind, rsmi_gpu_block_t block,
|
||||
rsmi_error_count_t *ec) {
|
||||
std::vector<std::string> val_vec;
|
||||
rsmi_status_t ret;
|
||||
rsmi_status_t ret(RSMI_STATUS_NOT_SUPPORTED);
|
||||
std::ostringstream ss;
|
||||
|
||||
TRY
|
||||
@@ -820,6 +820,21 @@ rsmi_dev_id_get(uint32_t dv_ind, uint16_t *id) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
rsmi_status_t
|
||||
rsmi_dev_revision_get(uint32_t dv_ind, uint16_t *revision) {
|
||||
std::ostringstream outss;
|
||||
rsmi_status_t ret;
|
||||
outss << __PRETTY_FUNCTION__ << "| ======= start =======";
|
||||
LOG_TRACE(outss);
|
||||
CHK_SUPPORT_NAME_ONLY(revision)
|
||||
|
||||
ret = get_id(dv_ind, amd::smi::kDevDevRevID, revision);
|
||||
outss << __PRETTY_FUNCTION__ << " | ======= end ======="
|
||||
<< ", reporting " << amd::smi::getRSMIStatusString(ret);
|
||||
LOG_TRACE(outss);
|
||||
return ret;
|
||||
}
|
||||
|
||||
rsmi_status_t
|
||||
rsmi_dev_sku_get(uint32_t dv_ind, uint16_t *id) {
|
||||
TRY
|
||||
|
||||
@@ -85,6 +85,7 @@ static const char *kDevPerfLevelFName = "power_dpm_force_performance_level";
|
||||
static const char *kDevDevProdNameFName = "product_name";
|
||||
static const char *kDevDevProdNumFName = "product_number";
|
||||
static const char *kDevDevIDFName = "device";
|
||||
static const char *kDevDevRevIDFName = "revision";
|
||||
static const char *kDevVendorIDFName = "vendor";
|
||||
static const char *kDevSubSysDevIDFName = "subsystem_device";
|
||||
static const char *kDevSubSysVendorIDFName = "subsystem_vendor";
|
||||
@@ -238,6 +239,7 @@ static const std::map<DevInfoTypes, const char *> kDevAttribNameMap = {
|
||||
{kDevDevProdName, kDevDevProdNameFName},
|
||||
{kDevDevProdNum, kDevDevProdNumFName},
|
||||
{kDevDevID, kDevDevIDFName},
|
||||
{kDevDevRevID, kDevDevRevIDFName},
|
||||
{kDevVendorID, kDevVendorIDFName},
|
||||
{kDevSubSysDevID, kDevSubSysDevIDFName},
|
||||
{kDevSubSysVendorID, kDevSubSysVendorIDFName},
|
||||
@@ -374,8 +376,8 @@ static const std::map<const char *, dev_depends_t> kDevFuncDependsMap = {
|
||||
// Functions with only mandatory dependencies
|
||||
{"rsmi_dev_vram_vendor_get", {{kDevVramVendorFName}, {}}},
|
||||
{"rsmi_dev_id_get", {{kDevDevIDFName}, {}}},
|
||||
{"rsmi_dev_revision_get", {{kDevDevRevIDFName}, {}}},
|
||||
{"rsmi_dev_vendor_id_get", {{kDevVendorIDFName}, {}}},
|
||||
|
||||
{"rsmi_dev_name_get", {{kDevVendorIDFName,
|
||||
kDevDevIDFName}, {}}},
|
||||
{"rsmi_dev_sku_get", {{kDevDevProdNumFName}, {}}},
|
||||
@@ -889,6 +891,7 @@ int Device::readDevInfo(DevInfoTypes type, uint64_t *val) {
|
||||
|
||||
switch (type) {
|
||||
case kDevDevID:
|
||||
case kDevDevRevID:
|
||||
case kDevSubSysDevID:
|
||||
case kDevSubSysVendorID:
|
||||
case kDevVendorID:
|
||||
@@ -1026,6 +1029,7 @@ int Device::readDevInfo(DevInfoTypes type, std::string *val) {
|
||||
case kDevDevProdName:
|
||||
case kDevDevProdNum:
|
||||
case kDevDevID:
|
||||
case kDevDevRevID:
|
||||
case kDevSubSysDevID:
|
||||
case kDevSubSysVendorID:
|
||||
case kDevVendorID:
|
||||
|
||||
@@ -84,6 +84,7 @@ amd::smi::RocmSMI::devInfoTypesStrings = {
|
||||
{amd::smi::kDevOverDriveLevel, amdSMI + "kDevOverDriveLevel"},
|
||||
{amd::smi::kDevMemOverDriveLevel, amdSMI + "kDevMemOverDriveLevel"},
|
||||
{amd::smi::kDevDevID, amdSMI + "kDevDevID"},
|
||||
{amd::smi::kDevDevRevID, amdSMI + "kDevDevRevID"},
|
||||
{amd::smi::kDevDevProdName, amdSMI + "kDevDevProdName"},
|
||||
{amd::smi::kDevDevProdNum, amdSMI + "kDevDevProdNum"},
|
||||
{amd::smi::kDevVendorID, amdSMI + "kDevVendorID"},
|
||||
|
||||
@@ -121,6 +121,24 @@ void TestIdInfoRead::Run(void) {
|
||||
err = rsmi_dev_id_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
// Get device Revision
|
||||
err = rsmi_dev_revision_get(i, &id);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
rsmi_status_t ret;
|
||||
// Verify api support checking functionality is working
|
||||
ret = rsmi_dev_revision_get(i, nullptr);
|
||||
ASSERT_EQ(ret, RSMI_STATUS_NOT_SUPPORTED);
|
||||
} else {
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Dev.Rev.ID: 0x" << std::hex << id << std::endl;
|
||||
}
|
||||
// Verify api support checking functionality is working
|
||||
err = rsmi_dev_revision_get(i, nullptr);
|
||||
ASSERT_EQ(err, RSMI_STATUS_INVALID_ARGS);
|
||||
}
|
||||
|
||||
err = rsmi_dev_name_get(i, buffer, kBufferLen);
|
||||
if (err == RSMI_STATUS_NOT_SUPPORTED) {
|
||||
std::cout << "\t**Device Marketing name not found on this system." <<
|
||||
|
||||
@@ -132,6 +132,12 @@ void TestBase::PrintDeviceHeader(uint32_t dv_ind) {
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Device ID: 0x" << std::hex << val_ui16 << std::endl;
|
||||
}
|
||||
err = rsmi_dev_revision_get(dv_ind, &val_ui16);
|
||||
CHK_ERR_ASRT(err)
|
||||
IF_VERB(STANDARD) {
|
||||
std::cout << "\t**Dev.Rev.ID: 0x" << std::hex << val_ui16 << std::endl;
|
||||
}
|
||||
|
||||
char name[128];
|
||||
err = rsmi_dev_name_get(dv_ind, name, 128);
|
||||
CHK_ERR_ASRT(err)
|
||||
|
||||
@@ -278,6 +278,7 @@ void DumpMonitorInfo(const TestBase *test) {
|
||||
};
|
||||
|
||||
print_val_str(amd::smi::kDevDevID, "Device ID: ");
|
||||
print_val_str(amd::smi::kDevDevRevID, "Dev.Rev.ID: ");
|
||||
print_val_str(amd::smi::kDevPerfLevel, "Performance Level: ");
|
||||
print_val_str(amd::smi::kDevOverDriveLevel, "OverDrive Level: ");
|
||||
print_vector(amd::smi::kDevGPUMClk,
|
||||
|
||||
Ссылка в новой задаче
Block a user