[SWDEV-483526] Fix MI3x partitions not showing all logical nodes
Changes:
- Updates to amdsmi_asic_info_t structure to include:
target_graphics_version, kfd_id, node_id, partition_id
- Updates to amd-smi static --asic to display new
samdsmi_asic_info_t fields
- Updates to gpu enumeration during amdsmi_init()
to discover all logical GPUs when in a non-SPX mode
(ex. DPX, TPX, QPX, or CPX)
- Updates to amdsmi_get_gpu_bdf_id(..) to include
partition_id details when in BDF or optional bits.
- bits [63:32] = domain
- bits [31:28] or bits [2:0] = partition id
- bits [27:16] = reserved
- bits [15:8] = Bus
- bits [7:3] = Device
- bits [2:0] = Function (partition id maybe in bits [2:0]) <-- Fallback for non SPX modes
- C++/Python tests updated to reflect these outputs
Change-Id: I4be0ea35bb98f3109ae2ca9e82f6b21baa38de29
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
Tento commit je obsažen v:
@@ -753,18 +753,54 @@ amdsmi_get_gpu_asic_info(amdsmi_processor_handle processor_handle, amdsmi_asic_i
|
||||
// default to 0xffff as not supported
|
||||
info->oam_id = std::numeric_limits<uint16_t>::max();
|
||||
uint16_t tmp_oam_id = 0;
|
||||
status = rsmi_wrapper(rsmi_dev_oam_id_get, processor_handle, &(tmp_oam_id));
|
||||
status = rsmi_wrapper(rsmi_dev_xgmi_physical_id_get, processor_handle, &(tmp_oam_id));
|
||||
info->oam_id = tmp_oam_id;
|
||||
|
||||
// default to 0xffffffff as not supported
|
||||
info->num_of_compute_units = std::numeric_limits<uint32_t>::max();
|
||||
auto tmp_num_of_compute_units = uint32_t(0);
|
||||
status = rsmi_wrapper(amd::smi::rsmi_dev_number_of_computes_get, processor_handle,
|
||||
&tmp_num_of_compute_units);
|
||||
&(tmp_num_of_compute_units));
|
||||
if (status == amdsmi_status_t::AMDSMI_STATUS_SUCCESS) {
|
||||
info->num_of_compute_units = tmp_num_of_compute_units;
|
||||
}
|
||||
|
||||
// default to 0xffffffffffffffff as not supported
|
||||
info->target_graphics_version = std::numeric_limits<uint64_t>::max();
|
||||
auto tmp_target_gfx_version = uint64_t(0);
|
||||
status = rsmi_wrapper(rsmi_dev_target_graphics_version_get, processor_handle,
|
||||
&(tmp_target_gfx_version));
|
||||
if (status == amdsmi_status_t::AMDSMI_STATUS_SUCCESS) {
|
||||
info->target_graphics_version = tmp_target_gfx_version;
|
||||
}
|
||||
|
||||
// default to 0xffffffffffffffff as not supported
|
||||
info->kfd_id = std::numeric_limits<uint64_t>::max();
|
||||
auto tmp_kfd_id = uint64_t(0);
|
||||
status = rsmi_wrapper(rsmi_dev_guid_get, processor_handle,
|
||||
&(tmp_kfd_id));
|
||||
if (status == amdsmi_status_t::AMDSMI_STATUS_SUCCESS) {
|
||||
info->kfd_id = tmp_kfd_id;
|
||||
}
|
||||
|
||||
// default to 0xffffffff as not supported
|
||||
info->node_id = std::numeric_limits<uint32_t>::max();
|
||||
auto tmp_node_id = uint32_t(0);
|
||||
status = rsmi_wrapper(rsmi_dev_node_id_get, processor_handle,
|
||||
&(tmp_node_id));
|
||||
if (status == amdsmi_status_t::AMDSMI_STATUS_SUCCESS) {
|
||||
info->node_id = tmp_node_id;
|
||||
}
|
||||
|
||||
// default to 0xffffffff as not supported
|
||||
info->partition_id = std::numeric_limits<uint32_t>::max();
|
||||
auto tmp_partition_id = uint32_t(0);
|
||||
status = rsmi_wrapper(rsmi_dev_partition_id_get, processor_handle,
|
||||
&(tmp_partition_id));
|
||||
if (status == amdsmi_status_t::AMDSMI_STATUS_SUCCESS) {
|
||||
info->partition_id = tmp_partition_id;
|
||||
}
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
#include "amd_smi/impl/amd_smi_common.h"
|
||||
#include "rocm_smi/rocm_smi.h"
|
||||
#include "rocm_smi/rocm_smi_main.h"
|
||||
#include "rocm_smi/rocm_smi_utils.h"
|
||||
#include "rocm_smi/rocm_smi_logger.h"
|
||||
|
||||
namespace amd {
|
||||
namespace smi {
|
||||
@@ -173,10 +175,26 @@ amdsmi_status_t AMDSmiDrm::init() {
|
||||
}
|
||||
|
||||
has_valid_fds = true;
|
||||
bdf.function_number = device->businfo.pci->func;
|
||||
bdf.device_number = device->businfo.pci->dev;
|
||||
bdf.bus_number = device->businfo.pci->bus;
|
||||
bdf.domain_number = device->businfo.pci->domain;
|
||||
std::ostringstream ss;
|
||||
uint64_t bdf_rocm = 0;
|
||||
rsmi_dev_pci_id_get(i, &bdf_rocm);
|
||||
ss << __PRETTY_FUNCTION__ << " | "
|
||||
<< "bdf_rocm | Received bdf: "
|
||||
<< "\nWhole BDF: " << amd::smi::print_unsigned_hex_and_int(bdf_rocm)
|
||||
<< "\nDomain = "
|
||||
<< amd::smi::print_unsigned_hex_and_int((bdf_rocm & 0xFFFFFFFF00000000) >> 32)
|
||||
<< "; \nBus# = " << amd::smi::print_unsigned_hex_and_int((bdf_rocm & 0xFF00) >> 8)
|
||||
<< "; \nDevice# = "<< amd::smi::print_unsigned_hex_and_int((bdf_rocm & 0xF8) >> 3)
|
||||
<< "; \nFunction# = " << amd::smi::print_unsigned_hex_and_int((bdf_rocm & 0x7));
|
||||
LOG_INFO(ss);
|
||||
bdf.function_number = ((bdf_rocm & 0x7));
|
||||
bdf.device_number = ((bdf_rocm & 0xF8) >> 3);
|
||||
bdf.bus_number = ((bdf_rocm & 0xFF00) >> 8);
|
||||
bdf.domain_number = ((bdf_rocm & 0xFFFFFFFF00000000) >> 32);
|
||||
ss << __PRETTY_FUNCTION__ << " | " << "Received bdf: Domain = " << bdf.domain_number
|
||||
<< "; Bus# = " << bdf.bus_number << "; Device# = "<< bdf.device_number
|
||||
<< "; Function# = " << bdf.function_number;
|
||||
LOG_INFO(ss);
|
||||
|
||||
vendor_id = device->deviceinfo.pci->vendor_id;
|
||||
|
||||
@@ -309,6 +327,14 @@ amdsmi_status_t AMDSmiDrm::get_drm_fd_by_index(uint32_t gpu_index, uint32_t *fd_
|
||||
amdsmi_status_t AMDSmiDrm::get_bdf_by_index(uint32_t gpu_index, amdsmi_bdf_t *bdf_info) const {
|
||||
if (gpu_index + 1 > drm_bdfs_.size()) return AMDSMI_STATUS_NOT_SUPPORTED;
|
||||
*bdf_info = drm_bdfs_[gpu_index];
|
||||
std::ostringstream ss;
|
||||
ss << __PRETTY_FUNCTION__ << " | gpu_index = " << gpu_index
|
||||
<< "; \nreceived bdf: Domain = " << bdf_info->domain_number
|
||||
<< "; \nBus# = " << bdf_info->bus_number
|
||||
<< "; \nDevice# = " << bdf_info->device_number
|
||||
<< "; \nFunction# = " << bdf_info->function_number
|
||||
<< "\nReturning = AMDSMI_STATUS_SUCCESS";
|
||||
LOG_INFO(ss);
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Odkázat v novém úkolu
Zablokovat Uživatele