Add vcn and jpeg activity
Changes:
- Add new engine field vcn_activity (from 1.4/1.5
gpu_metrics
- Updated log output to enhance view of gpu_metric
data as json pretty print
- Added new fields provided in 1.5
- Added unit overview in python API, CLI is WIP
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
Change-Id: I7d9f29e7ecc35dcd0697814c222cdd02b0d5518e
[ROCm/amdsmi commit: 8f3861e1d9]
This commit is contained in:
@@ -68,6 +68,7 @@
|
||||
#include "amd_smi/impl/amdgpu_drm.h"
|
||||
#include "amd_smi/impl/amd_smi_utils.h"
|
||||
#include "amd_smi/impl/amd_smi_processor.h"
|
||||
#include "rocm_smi/rocm_smi_logger.h"
|
||||
#ifdef ENABLE_ESMI_LIB
|
||||
#include "amd_smi/impl/amd_smi_cpu_socket.h"
|
||||
#include "amd_smi/impl/amd_smi_cpu_core.h"
|
||||
@@ -1154,9 +1155,32 @@ amdsmi_status_t amdsmi_get_gpu_metrics_info(
|
||||
amdsmi_gpu_metrics_t *pgpu_metrics) {
|
||||
AMDSMI_CHECK_INIT();
|
||||
// nullptr api supported
|
||||
|
||||
return rsmi_wrapper(rsmi_dev_gpu_metrics_info_get, processor_handle,
|
||||
amdsmi_status_t ret =
|
||||
rsmi_wrapper(rsmi_dev_gpu_metrics_info_get, processor_handle,
|
||||
reinterpret_cast<rsmi_gpu_metrics_t*>(pgpu_metrics));
|
||||
// WARNING: TEMPORARY - awaiting 1.5 update from amdgpu driver/firmware
|
||||
// intended to be removed later
|
||||
// START: REMOVE WHATS BELOW ME
|
||||
uint8_t content_ver = pgpu_metrics->common_header.content_revision;
|
||||
int8_t format_ver = pgpu_metrics->common_header.format_revision;
|
||||
const uint8_t expected_format_ver = 1;
|
||||
const uint8_t expected_content_ver = 4;
|
||||
if (ret == AMDSMI_STATUS_SUCCESS &&
|
||||
(format_ver == expected_format_ver &&
|
||||
content_ver <= expected_content_ver)) {
|
||||
std::ostringstream ss;
|
||||
ss << __PRETTY_FUNCTION__ << " | SET JPEG_ACTIVITY to MAX_UINT16, "
|
||||
<< "detected content version: " << std::dec << +content_ver
|
||||
<< "; format version: " << std::dec << +format_ver
|
||||
<< "; awaiting 1.5 metrics remove once released";
|
||||
LOG_ALWAYS(ss);
|
||||
std::fill_n(&pgpu_metrics->jpeg_activity[0],
|
||||
(sizeof(pgpu_metrics->jpeg_activity) /
|
||||
sizeof(pgpu_metrics->jpeg_activity[0])),
|
||||
std::numeric_limits<uint16_t>::max());
|
||||
}
|
||||
// END: REMOVE WHATS ABOVE ME
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
|
||||
#include "amd_smi/impl/amd_smi_utils.h"
|
||||
#include "shared_mutex.h" // NOLINT
|
||||
#include "rocm_smi/rocm_smi_logger.h"
|
||||
|
||||
static const uint32_t kAmdGpuId = 0x1002;
|
||||
|
||||
@@ -153,6 +154,20 @@ amdsmi_status_t smi_amdgpu_get_board_info(amd::smi::AMDSmiGPUDevice* device, amd
|
||||
fgets(info->product_name, sizeof(info->product_name), fp);
|
||||
fclose(fp);
|
||||
}
|
||||
std::ostringstream ss;
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< "Returning status = AMDSMI_STATUS_SUCCESS"
|
||||
<< " | model_number_path = " << model_number_path
|
||||
<< "; info->model_number: " << info->model_number
|
||||
<< "\n product_serial_path = " << product_serial_path
|
||||
<< "; info->product_serial: " << info->product_serial
|
||||
<< "\n fru_id_path = " << fru_id_path
|
||||
<< "; info->fru_id: " << info->fru_id
|
||||
<< "\n manufacturer_name_path = " << manufacturer_name_path
|
||||
<< "; info->manufacturer_name: " << info->manufacturer_name
|
||||
<< "\n product_name_path = " << product_name_path
|
||||
<< "; info->product_name: " << info->product_name;
|
||||
LOG_INFO(ss);
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
@@ -236,8 +251,8 @@ amdsmi_status_t smi_amdgpu_get_ranges(amd::smi::AMDSmiGPUDevice* device, amdsmi_
|
||||
unsigned int dpm_level, freq;
|
||||
|
||||
char firstChar = line[0];
|
||||
if (firstChar == 'S'){
|
||||
if (sscanf(line.c_str(), "%c: %d%s", &single_char, &sleep_freq, str) <= 2){
|
||||
if (firstChar == 'S') {
|
||||
if (sscanf(line.c_str(), "%c: %d%s", &single_char, &sleep_freq, str) <= 2) {
|
||||
ranges.close();
|
||||
return AMDSMI_STATUS_NO_DATA;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user