[SWDEV-513651] Sync Unified And Linux Header (#98)

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

[ROCm/amdsmi commit: dc4a16da6f]
This commit is contained in:
Narlo, Joseph
2025-02-06 22:25:50 -06:00
committed by GitHub
parent e8a8122111
commit c26da62fc7
14 changed files with 161 additions and 154 deletions
+48 -48
View File
@@ -572,7 +572,7 @@ amdsmi_status_t amdsmi_get_gpu_board_info(amdsmi_processor_handle processor_hand
board_info->product_name, AMDSMI_256_LENGTH);
status = rsmi_wrapper(rsmi_dev_serial_number_get, processor_handle, 0,
board_info->product_serial, AMDSMI_NORMAL_STRING_LENGTH);
board_info->product_serial, AMDSMI_MAX_STRING_LENGTH);
}
std::ostringstream ss;
@@ -587,10 +587,10 @@ amdsmi_status_t amdsmi_get_gpu_board_info(amdsmi_processor_handle processor_hand
if (board_info->product_serial[0] == '\0') {
status = rsmi_wrapper(rsmi_dev_serial_number_get, processor_handle, 0,
board_info->product_serial, AMDSMI_NORMAL_STRING_LENGTH);
board_info->product_serial, AMDSMI_MAX_STRING_LENGTH);
if (status != AMDSMI_STATUS_SUCCESS) {
memset(board_info->product_serial, 0,
AMDSMI_NORMAL_STRING_LENGTH * sizeof(board_info->product_serial[0]));
AMDSMI_MAX_STRING_LENGTH * sizeof(board_info->product_serial[0]));
}
ss << __PRETTY_FUNCTION__ << " | [rsmi_correction] board_info->product_serial= |"
<< board_info->product_serial << "|";
@@ -1401,7 +1401,7 @@ amdsmi_status_t amdsmi_get_gpu_vram_info(
// init the info structure with default value
info->vram_type = AMDSMI_VRAM_TYPE_UNKNOWN;
info->vram_size = 0;
info->vram_vendor = AMDSMI_VRAM_VENDOR__PLACEHOLDER0;
info->vram_vendor = AMDSMI_VRAM_VENDOR_UNKNOWN;
info->vram_bit_width = std::numeric_limits<decltype(info->vram_bit_width)>::max();
info->vram_max_bandwidth = std::numeric_limits<decltype(info->vram_max_bandwidth)>::max();
@@ -1434,25 +1434,25 @@ amdsmi_status_t amdsmi_get_gpu_vram_info(
brand, 255);
if (r == AMDSMI_STATUS_SUCCESS) {
if (strcasecmp(brand, "SAMSUNG") == 0)
info->vram_vendor = AMDSMI_VRAM_VENDOR__SAMSUNG;
info->vram_vendor = AMDSMI_VRAM_VENDOR_SAMSUNG;
if (strcasecmp(brand, "INFINEON") == 0)
info->vram_vendor = AMDSMI_VRAM_VENDOR__INFINEON;
info->vram_vendor = AMDSMI_VRAM_VENDOR_INFINEON;
if (strcasecmp(brand, "ELPIDA") == 0)
info->vram_vendor = AMDSMI_VRAM_VENDOR__ELPIDA;
info->vram_vendor = AMDSMI_VRAM_VENDOR_ELPIDA;
if (strcasecmp(brand, "ETRON") == 0)
info->vram_vendor = AMDSMI_VRAM_VENDOR__ETRON;
info->vram_vendor = AMDSMI_VRAM_VENDOR_ETRON;
if (strcasecmp(brand, "NANYA") == 0)
info->vram_vendor = AMDSMI_VRAM_VENDOR__NANYA;
info->vram_vendor = AMDSMI_VRAM_VENDOR_NANYA;
if (strcasecmp(brand, "HYNIX") == 0)
info->vram_vendor = AMDSMI_VRAM_VENDOR__HYNIX;
info->vram_vendor = AMDSMI_VRAM_VENDOR_HYNIX;
if (strcasecmp(brand, "MOSEL") == 0)
info->vram_vendor = AMDSMI_VRAM_VENDOR__MOSEL;
info->vram_vendor = AMDSMI_VRAM_VENDOR_MOSEL;
if (strcasecmp(brand, "WINBOND") == 0)
info->vram_vendor = AMDSMI_VRAM_VENDOR__WINBOND;
info->vram_vendor = AMDSMI_VRAM_VENDOR_WINBOND;
if (strcasecmp(brand, "ESMT") == 0)
info->vram_vendor = AMDSMI_VRAM_VENDOR__ESMT;
info->vram_vendor = AMDSMI_VRAM_VENDOR_ESMT;
if (strcasecmp(brand, "MICRON") == 0)
info->vram_vendor = AMDSMI_VRAM_VENDOR__MICRON;
info->vram_vendor = AMDSMI_VRAM_VENDOR_MICRON;
}
uint64_t total = 0;
r = rsmi_wrapper(rsmi_dev_memory_total_get, processor_handle, 0,
@@ -1806,10 +1806,10 @@ amdsmi_get_gpu_memory_partition_config(amdsmi_processor_handle processor_handle,
// initialization for devices which do not support partitions
amdsmi_nps_caps_t flags;
flags.amdsmi_nps_flags_t.nps1_cap = 0;
flags.amdsmi_nps_flags_t.nps2_cap = 0;
flags.amdsmi_nps_flags_t.nps4_cap = 0;
flags.amdsmi_nps_flags_t.nps8_cap = 0;
flags.nps_flags.nps1_cap = 0;
flags.nps_flags.nps2_cap = 0;
flags.nps_flags.nps4_cap = 0;
flags.nps_flags.nps8_cap = 0;
config->partition_caps = flags;
config->mp_mode = AMDSMI_MEMORY_PARTITION_UNKNOWN;
@@ -1851,16 +1851,16 @@ amdsmi_get_gpu_memory_partition_config(amdsmi_processor_handle processor_handle,
if (status == AMDSMI_STATUS_SUCCESS) {
memory_caps_str = std::string(memory_caps);
if (memory_caps_str.find("NPS1") != std::string::npos) {
flags.amdsmi_nps_flags_t.nps1_cap = 1;
flags.nps_flags.nps1_cap = 1;
}
if (memory_caps_str.find("NPS2") != std::string::npos) {
flags.amdsmi_nps_flags_t.nps2_cap = 1;
flags.nps_flags.nps2_cap = 1;
}
if (memory_caps_str.find("NPS4") != std::string::npos) {
flags.amdsmi_nps_flags_t.nps4_cap = 1;
flags.nps_flags.nps4_cap = 1;
}
if (memory_caps_str.find("NPS8") != std::string::npos) {
flags.amdsmi_nps_flags_t.nps8_cap = 1;
flags.nps_flags.nps8_cap = 1;
}
}
config->partition_caps = flags;
@@ -1900,10 +1900,10 @@ amdsmi_get_gpu_accelerator_partition_profile_config(amdsmi_processor_handle proc
profile_config->resource_profiles->partition_resource = 0;
profile_config->resource_profiles->num_partitions_share_resource = 0;
amdsmi_nps_caps_t flags;
flags.amdsmi_nps_flags_t.nps1_cap = 0;
flags.amdsmi_nps_flags_t.nps2_cap = 0;
flags.amdsmi_nps_flags_t.nps4_cap = 0;
flags.amdsmi_nps_flags_t.nps8_cap = 0;
flags.nps_flags.nps1_cap = 0;
flags.nps_flags.nps2_cap = 0;
flags.nps_flags.nps4_cap = 0;
flags.nps_flags.nps8_cap = 0;
ss << __PRETTY_FUNCTION__
<< " | 1";
@@ -2070,16 +2070,16 @@ amdsmi_get_gpu_accelerator_partition_profile_config(amdsmi_processor_handle proc
supported_nps_caps_str = std::string(supported_nps_configs);
}
if (supported_nps_caps_str.find("NPS1") != std::string::npos) {
profile_config->profiles[i].memory_caps.amdsmi_nps_flags_t.nps1_cap = 1;
profile_config->profiles[i].memory_caps.nps_flags.nps1_cap = 1;
}
if (supported_nps_caps_str.find("NPS2") != std::string::npos) {
profile_config->profiles[i].memory_caps.amdsmi_nps_flags_t.nps2_cap = 1;
profile_config->profiles[i].memory_caps.nps_flags.nps2_cap = 1;
}
if (supported_nps_caps_str.find("NPS4") != std::string::npos) {
profile_config->profiles[i].memory_caps.amdsmi_nps_flags_t.nps4_cap = 1;
profile_config->profiles[i].memory_caps.nps_flags.nps4_cap = 1;
}
if (supported_nps_caps_str.find("NPS8") != std::string::npos) {
profile_config->profiles[i].memory_caps.amdsmi_nps_flags_t.nps8_cap = 1;
profile_config->profiles[i].memory_caps.nps_flags.nps8_cap = 1;
}
// 2) get resource profiles
for (auto r = static_cast<int>(RSMI_ACCELERATOR_XCC);
@@ -2123,7 +2123,7 @@ amdsmi_get_gpu_accelerator_partition_profile_config(amdsmi_processor_handle proc
}
auto current_resource_idx = (resource_index >= 1) ? resource_index - 1 : 0;
std::string nps_caps = "N/A";
if (profile_config->profiles[i].memory_caps.amdsmi_nps_flags_t.nps1_cap == 1) {
if (profile_config->profiles[i].memory_caps.nps_flags.nps1_cap == 1) {
if (nps_caps == "N/A") {
nps_caps.clear();
nps_caps = "NPS1";
@@ -2131,7 +2131,7 @@ amdsmi_get_gpu_accelerator_partition_profile_config(amdsmi_processor_handle proc
nps_caps += ", NPS1";
}
}
if (profile_config->profiles[i].memory_caps.amdsmi_nps_flags_t.nps2_cap == 1) {
if (profile_config->profiles[i].memory_caps.nps_flags.nps2_cap == 1) {
if (nps_caps == "N/A") {
nps_caps.clear();
nps_caps = "NPS2";
@@ -2139,7 +2139,7 @@ amdsmi_get_gpu_accelerator_partition_profile_config(amdsmi_processor_handle proc
nps_caps += ", NPS2";
}
}
if (profile_config->profiles[i].memory_caps.amdsmi_nps_flags_t.nps4_cap == 1) {
if (profile_config->profiles[i].memory_caps.nps_flags.nps4_cap == 1) {
if (nps_caps == "N/A") {
nps_caps.clear();
nps_caps = "NPS4";
@@ -2147,7 +2147,7 @@ amdsmi_get_gpu_accelerator_partition_profile_config(amdsmi_processor_handle proc
nps_caps += ", NPS4";
}
}
if (profile_config->profiles[i].memory_caps.amdsmi_nps_flags_t.nps8_cap == 1) {
if (profile_config->profiles[i].memory_caps.nps_flags.nps8_cap == 1) {
if (nps_caps == "N/A") {
nps_caps.clear();
nps_caps = "NPS8";
@@ -2209,10 +2209,10 @@ amdsmi_get_gpu_accelerator_partition_profile(amdsmi_processor_handle processor_h
profile->num_resources = 0;
amdsmi_nps_caps_t flags;
flags.amdsmi_nps_flags_t.nps1_cap = 0;
flags.amdsmi_nps_flags_t.nps2_cap = 0;
flags.amdsmi_nps_flags_t.nps4_cap = 0;
flags.amdsmi_nps_flags_t.nps8_cap = 0;
flags.nps_flags.nps1_cap = 0;
flags.nps_flags.nps2_cap = 0;
flags.nps_flags.nps4_cap = 0;
flags.nps_flags.nps8_cap = 0;
profile->memory_caps = flags;
// TODO(amdsmi_team): add resources here ^
@@ -2357,16 +2357,16 @@ amdsmi_get_gpu_accelerator_partition_profile(amdsmi_processor_handle processor_h
if (status == AMDSMI_STATUS_SUCCESS) {
memory_caps_str = std::string(memory_caps);
if (memory_caps_str.find("NPS1") != std::string::npos) {
flags.amdsmi_nps_flags_t.nps1_cap = 1;
flags.nps_flags.nps1_cap = 1;
}
if (memory_caps_str.find("NPS2") != std::string::npos) {
flags.amdsmi_nps_flags_t.nps2_cap = 1;
flags.nps_flags.nps2_cap = 1;
}
if (memory_caps_str.find("NPS4") != std::string::npos) {
flags.amdsmi_nps_flags_t.nps4_cap = 1;
flags.nps_flags.nps4_cap = 1;
}
if (memory_caps_str.find("NPS8") != std::string::npos) {
flags.amdsmi_nps_flags_t.nps8_cap = 1;
flags.nps_flags.nps8_cap = 1;
}
}
profile->memory_caps = flags;
@@ -2989,20 +2989,20 @@ amdsmi_get_gpu_vbios_info(amdsmi_processor_handle processor_handle, amdsmi_vbios
strncpy(info->name, (char *) vbios.name, AMDSMI_MAX_STRING_LENGTH);
strncpy(info->build_date, (char *) vbios.date, AMDSMI_MAX_DATE_LENGTH);
strncpy(info->part_number, (char *) vbios.vbios_pn, AMDSMI_MAX_STRING_LENGTH);
strncpy(info->version, (char *) vbios.vbios_ver_str, AMDSMI_NORMAL_STRING_LENGTH);
strncpy(info->version, (char *) vbios.vbios_ver_str, AMDSMI_MAX_STRING_LENGTH);
}
}
else {
// get vbios version string from rocm_smi
char vbios_version[AMDSMI_NORMAL_STRING_LENGTH];
char vbios_version[AMDSMI_MAX_STRING_LENGTH];
status = rsmi_wrapper(rsmi_dev_vbios_version_get, processor_handle, 0,
vbios_version,
AMDSMI_NORMAL_STRING_LENGTH);
AMDSMI_MAX_STRING_LENGTH);
// ignore the errors so that it can populate as many fields as possible.
if (status == AMDSMI_STATUS_SUCCESS) {
strncpy(info->version,
vbios_version, AMDSMI_NORMAL_STRING_LENGTH);
vbios_version, AMDSMI_MAX_STRING_LENGTH);
}
}
@@ -3319,7 +3319,7 @@ amdsmi_get_gpu_process_list(amdsmi_processor_handle processor_handle, uint32_t *
}
amdsmi_status_t
amdsmi_get_power_info(amdsmi_processor_handle processor_handle, amdsmi_power_info_t *info) {
amdsmi_get_power_info(amdsmi_processor_handle processor_handle, uint32_t sensor_ind, amdsmi_power_info_t *info) {
AMDSMI_CHECK_INIT();
if (info == nullptr) {
@@ -3447,7 +3447,7 @@ amdsmi_status_t amdsmi_get_pcie_info(amdsmi_processor_handle processor_handle, a
SMIGPUDEVICE_MUTEX(gpu_device->get_mutex())
char buff[AMDSMI_NORMAL_STRING_LENGTH];
char buff[AMDSMI_MAX_STRING_LENGTH];
FILE* fp;
double pcie_speed = 0;
unsigned pcie_width = 0;
+1 -1
View File
@@ -235,7 +235,7 @@ amdsmi_status_t gpuvsmi_get_pid_info(const amdsmi_bdf_t &bdf, long int pid,
return AMDSMI_STATUS_API_FAILED;
strncpy(info.name, name.c_str(), std::min(
(unsigned long) AMDSMI_NORMAL_STRING_LENGTH,
(unsigned long) AMDSMI_MAX_STRING_LENGTH,
name.length()));
for (int i = 0; i < AMDSMI_MAX_CONTAINER_TYPE; i++) {