[SWDEV-504583] Resolve Additional Compiler Warnings

Signed-off-by: Joseph Narlo <joseph.narlo@amd.com>


[ROCm/amdsmi commit: dc228398d0]
Этот коммит содержится в:
Joseph Narlo
2025-01-23 11:34:52 -06:00
коммит произвёл Maisam Arif
родитель cdf612c53c
Коммит ab88f38fa0
5 изменённых файлов: 32 добавлений и 36 удалений
+1 -1
Просмотреть файл
@@ -871,7 +871,7 @@ int main() {
idx = 0;
for (const auto& temp : smu.xgmi_link_status) {
std::cout << temp;
if ((idx + 1) != std::size(smu.xgmi_link_status)) {
if ((idx + 1) != static_cast<int>(std::size(smu.xgmi_link_status))) {
std::cout << ", ";
} else {
std::cout << "]\n";
+18 -19
Просмотреть файл
@@ -28,6 +28,7 @@
#include <sys/ioctl.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <inttypes.h>
#include <algorithm>
#include <bitset>
@@ -5855,9 +5856,6 @@ rsmi_dev_compute_partition_xcp_config_set(uint32_t dv_ind,
const int kLen30 = 30;
char available_xcp_configs[kLen30];
available_xcp_configs[0] = '\0';
const int kLen5 = 5;
char current_xcp_config[kLen5];
current_xcp_config[0] = '\0';
switch (xcp_config) {
case RSMI_COMPUTE_PARTITION_CPX:
@@ -7126,7 +7124,7 @@ rsmi_event_notification_get(int timeout_ms,
uint64_t bitmask;
uint64_t counter;
sscanf(message, "%llx:%llx\n", &bitmask, &counter);
sscanf(message, "%" PRIx64 ":%" PRIx64 "\n", &bitmask, &counter);
std::stringstream final_message;
final_message << "bitmask: 0x" << std::hex << bitmask
<< " counter: 0x" << std::hex << counter;
@@ -7152,7 +7150,8 @@ rsmi_event_notification_get(int timeout_ms,
{
uint32_t reset_seq_num;
sscanf(message, "%x %[^\n]\n", &reset_seq_num);
char tmp[MAX_EVENT_NOTIFICATION_MSG_SIZE];
sscanf(message, "%x %[^\n]\n", &reset_seq_num, tmp);
std::stringstream final_message;
final_message << "reset sequence number: " << std::to_string(reset_seq_num).c_str();
@@ -7165,13 +7164,13 @@ rsmi_event_notification_get(int timeout_ms,
int32_t pid;
uint32_t start;
uint32_t size;
uint16_t from;
uint16_t to;
uint16_t prefetch_loc;
uint16_t preferred_loc;
uint32_t from;
uint32_t to;
uint32_t prefetch_loc;
uint32_t preferred_loc;
int32_t migrate_trigger;
sscanf(message, "%lld -%d @%lx(%lx) %x->%x %x:%x %d\n", &ns, &pid, &start, &size, &from, &to, &prefetch_loc, &preferred_loc, &migrate_trigger);
sscanf(message, "%" PRId64 " -%d @%" PRIu32 "(%" PRIu32 ") %x->%x %x:%x %d\n", &ns, &pid, &start, &size, &from, &to, &prefetch_loc, &preferred_loc, &migrate_trigger);
std::stringstream final_message;
final_message << "nd: " << std::to_string(ns).c_str()
<< " pid: " << std::to_string(pid).c_str()
@@ -7197,7 +7196,7 @@ rsmi_event_notification_get(int timeout_ms,
uint32_t migrate_trigger;
uint32_t error_code;
sscanf(message, "%lld -%d @%lx(%lx) %x->%x %d %d\n", &ns, &pid, &start, &size, &from, &to, &migrate_trigger, &error_code);
sscanf(message, "%" PRId64 " -%d @%" PRIu32 "(%" PRIu32 ") %x->%x %d %d\n", &ns, &pid, &start, &size, &from, &to, &migrate_trigger, &error_code);
std::stringstream final_message;
final_message << "nd: " << std::to_string(ns).c_str()
<< " pid: " << std::to_string(pid).c_str()
@@ -7217,9 +7216,9 @@ rsmi_event_notification_get(int timeout_ms,
int32_t pid;
uint32_t addr;
uint32_t node;
char *rw;
char *rw = "\0";
sscanf(message, "%lld -%d @%lx(%x) %c\n", &ns, &pid, &addr, &node, rw);
sscanf(message, "%" PRId64 " -%d @%" PRIx32 "(%x) %c\n", &ns, &pid, &addr, &node, rw);
std::stringstream final_message;
final_message << "ns: " << std::to_string(ns).c_str()
<< " pid: " << std::to_string(pid).c_str()
@@ -7236,9 +7235,9 @@ rsmi_event_notification_get(int timeout_ms,
int32_t pid;
uint32_t addr;
uint32_t node;
char *migrate_update;
char *migrate_update = "\0";
sscanf(message, "%lld -%d @%lx(%x) %c\n", &ns, &pid, &addr, &node, migrate_update);
sscanf(message, "%" PRId64 " -%d @%" PRIx32 "(%x) %c\n", &ns, &pid, &addr, &node, migrate_update);
std::stringstream final_message;
final_message << "ns: " << std::to_string(ns).c_str()
<< " pid: " << std::to_string(pid).c_str()
@@ -7256,7 +7255,7 @@ rsmi_event_notification_get(int timeout_ms,
uint32_t node;
uint32_t evict_trigger;
sscanf(message, "%lld -%d %x %d\n", &ns, &pid, &node, &evict_trigger);
sscanf(message, "%" PRId64 "-%d %x %d\n", &ns, &pid, &node, &evict_trigger);
std::stringstream final_message;
final_message << "ns: " << std::to_string(ns).c_str()
<< " pid: " << std::to_string(pid).c_str()
@@ -7271,9 +7270,9 @@ rsmi_event_notification_get(int timeout_ms,
int64_t ns;
int32_t pid;
uint32_t node;
char *rescheduled;
char *rescheduled = "\0";
sscanf(message, "%lld -%d %x %c\n", &ns, &pid, &node, rescheduled);
sscanf(message, "%" PRId64 "-%d %x %c\n", &ns, &pid, &node, rescheduled);
std::stringstream final_message;
final_message << "ns: " << std::to_string(ns).c_str()
<< " pid: " << std::to_string(pid).c_str()
@@ -7292,7 +7291,7 @@ rsmi_event_notification_get(int timeout_ms,
uint32_t node;
uint32_t unmap_trigger;
sscanf(message, "%lld -%d @%lx(%lx) %x %d\n", &ns, &pid, &addr, &size, &node, &unmap_trigger);
sscanf(message, "%" PRId64 " -%d @%" PRIx32 "(%" PRIx32 ") %x %d\n", &ns, &pid, &addr, &size, &node, &unmap_trigger);
std::stringstream final_message;
final_message << "ns: " << std::to_string(ns).c_str()
<< " pid: " << std::to_string(pid).c_str()
+8 -8
Просмотреть файл
@@ -583,11 +583,11 @@ void GpuMetricsBase_v17_t::dump_internal_metrics_table()
}
for (auto& col : row.gfx_busy_inst) {
ss << "\t [" << idx << "] [" << idy << "]: " << col;
if (idy + 1 != (std::end(row.gfx_busy_inst) - std::end(row.gfx_busy_inst) - 1)) {
if (idy + 1 != static_cast<uint64_t>((std::end(row.gfx_busy_inst) - std::end(row.gfx_busy_inst) - 1))) {
ss << ", ";
}
if (idx + 1 !=
(std::end(m_gpu_metrics_tbl.m_xcp_stats) - std::end(m_gpu_metrics_tbl.m_xcp_stats) - 1)) {
static_cast<uint64_t>((std::end(m_gpu_metrics_tbl.m_xcp_stats) - std::end(m_gpu_metrics_tbl.m_xcp_stats) - 1))) {
ss << "\n";
} else {
ss << "]\n";
@@ -606,11 +606,11 @@ void GpuMetricsBase_v17_t::dump_internal_metrics_table()
}
for (auto& col : row.vcn_busy) {
ss << "\t [" << idx << "] [" << idy << "]: " << col;
if (idy + 1 != (std::end(row.vcn_busy) - std::end(row.vcn_busy) - 1)) {
if (idy + 1 != static_cast<uint64_t>((std::end(row.vcn_busy) - std::end(row.vcn_busy) - 1))) {
ss << ", ";
}
if (idx + 1 !=
(std::end(m_gpu_metrics_tbl.m_xcp_stats) - std::end(m_gpu_metrics_tbl.m_xcp_stats) - 1)) {
static_cast<uint64_t>((std::end(m_gpu_metrics_tbl.m_xcp_stats) - std::end(m_gpu_metrics_tbl.m_xcp_stats) - 1))) {
ss << "\n";
} else {
ss << "]\n";
@@ -629,11 +629,11 @@ void GpuMetricsBase_v17_t::dump_internal_metrics_table()
}
for (auto& col : row.jpeg_busy) {
ss << "\t [" << idx << "] [" << idy << "]: " << col;
if (idy + 1 != (std::end(row.jpeg_busy) - std::end(row.jpeg_busy) - 1)) {
if (idy + 1 != static_cast<uint64_t>((std::end(row.jpeg_busy) - std::end(row.jpeg_busy) - 1))) {
ss << ", ";
}
if (idx + 1 !=
(std::end(m_gpu_metrics_tbl.m_xcp_stats) - std::end(m_gpu_metrics_tbl.m_xcp_stats) - 1)) {
static_cast<uint64_t>((std::end(m_gpu_metrics_tbl.m_xcp_stats) - std::end(m_gpu_metrics_tbl.m_xcp_stats) - 1))) {
ss << "\n";
} else {
ss << "]\n";
@@ -652,11 +652,11 @@ void GpuMetricsBase_v17_t::dump_internal_metrics_table()
}
for (auto& col : row.gfx_busy_acc) {
ss << "\t [" << idx << "] [" << idy << "]: " << col;
if (idy + 1 != (std::end(row.gfx_busy_acc) - std::end(row.gfx_busy_acc) - 1)) {
if (idy + 1 != static_cast<uint64_t>((std::end(row.gfx_busy_acc) - std::end(row.gfx_busy_acc) - 1))) {
ss << ", ";
}
if (idx + 1 !=
(std::end(m_gpu_metrics_tbl.m_xcp_stats) - std::end(m_gpu_metrics_tbl.m_xcp_stats) - 1)) {
static_cast<uint64_t>((std::end(m_gpu_metrics_tbl.m_xcp_stats) - std::end(m_gpu_metrics_tbl.m_xcp_stats) - 1))) {
ss << "\n";
} else {
ss << "]\n";
+4 -5
Просмотреть файл
@@ -1300,7 +1300,7 @@ amdsmi_get_gpu_xgmi_link_status(amdsmi_processor_handle processor_handle,
}
uint32_t dev_num = 0;
auto r = rsmi_num_monitor_devices(&dev_num);
rsmi_num_monitor_devices(&dev_num);
link_status->total_links = AMDSMI_MAX_NUM_XGMI_LINKS;
if (dev_num <= link_status->total_links) {
link_status->total_links = dev_num;
@@ -2030,7 +2030,7 @@ amdsmi_get_gpu_accelerator_partition_profile_config(amdsmi_processor_handle proc
LOG_DEBUG(ss);
auto resource_index = 0;
// get resource info for each profile
for (auto i = 0; i < profile_config->num_profiles; i++) {
for (auto i = 0U; i < profile_config->num_profiles; i++) {
auto it = partition_types_map.find(profile_config->profiles[i].profile_type);
std::string partition_type_str = "UNKNOWN";
if (it != partition_types_map.end()) {
@@ -2223,7 +2223,6 @@ amdsmi_get_gpu_accelerator_partition_profile(amdsmi_processor_handle processor_h
// TODO(amdsmi_team): add resources here ^
auto tmp_partition_id = uint32_t(0);
auto tmp_xcd_count = uint16_t(0);
amdsmi_status_t status = AMDSMI_STATUS_NOT_SUPPORTED;
// get xcp config info (this will tell use # of profiles/index's)
@@ -2279,7 +2278,7 @@ amdsmi_get_gpu_accelerator_partition_profile(amdsmi_processor_handle processor_h
if (accelerator_capabilities.find(current_partition_str) != std::string::npos) {
auto it = std::find(tokens.begin(), tokens.end(), current_partition_str);
if (it != tokens.end()) {
profile->profile_index = std::distance(tokens.begin(), it);
profile->profile_index = static_cast<uint32_t>(std::distance(tokens.begin(), it));
}
}
}
@@ -2403,7 +2402,7 @@ amdsmi_set_gpu_accelerator_partition_profile(amdsmi_processor_handle processor_h
partition_type_str.clear();
partition_type_str = it->second;
}
config.profiles[i].profile_index;
ss << __PRETTY_FUNCTION__ << " | "
<< "config.profiles[" << i << "].profile_type: "
<< static_cast<int>(config.profiles[i].profile_type) << "\n"
+1 -3
Просмотреть файл
@@ -475,7 +475,7 @@ amdsmi_status_t smi_amdgpu_validate_ras_eeprom(amd::smi::AMDSmiGPUDevice* device
}
SMIGPUDEVICE_MUTEX(device->get_mutex())
uint32_t index = GetDeviceIndex(device->get_gpu_path());
//uint32_t index = GetDeviceIndex(device->get_gpu_path());
//TODO: need to expose the corresponding interface to validate the checksum of ras eeprom table.
//verify fail: return AMDSMI_STATUS_CORRUPTED_EEPROM
return AMDSMI_STATUS_NOT_SUPPORTED;
@@ -625,8 +625,6 @@ amdsmi_status_t smi_amdgpu_get_market_name_from_dev_id(amd::smi::AMDSmiGPUDevice
uint32_t gpu_fd = device->get_gpu_fd();
char drm_path[32];
int ret = amdgpu_device_initialize(gpu_fd, &major_version, &minor_version, &device_handle);
if (ret != 0) {
return AMDSMI_STATUS_DRM_ERROR;