[SWDEV-528097] Unique ID fix for missing ID in KGD -> use KFD's (#44)
Changes: - Unique Id tries reading from KGD -> falls back to use KFD if not found Change-Id: I8fb8f38df5db7413805f4a20621ad12ed3fc89a3 Signed-off-by: Charis Poag <Charis.Poag@amd.com>
This commit is contained in:
committed by
GitHub
orang tua
ce405476ca
melakukan
4276207ff8
@@ -4011,11 +4011,47 @@ rsmi_dev_unique_id_get(uint32_t dv_ind, uint64_t *unique_id) {
|
||||
CHK_SUPPORT_NAME_ONLY(unique_id)
|
||||
|
||||
DEVICE_MUTEX
|
||||
if (unique_id == nullptr) {
|
||||
return RSMI_STATUS_INVALID_ARGS;
|
||||
}
|
||||
*unique_id = std::numeric_limits<uint64_t>::max();
|
||||
ret = get_dev_value_int(amd::smi::kDevUniqueId, dv_ind, unique_id);
|
||||
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< (ret == RSMI_STATUS_SUCCESS ?
|
||||
" | No fall back needed retrieved from KGD" : " | fall back needed")
|
||||
<< " | Device #: " << std::to_string(dv_ind)
|
||||
<< " | Data: unique_id = " << std::to_string(*unique_id)
|
||||
<< " | ret = " << getRSMIStatusString(ret, false);
|
||||
LOG_DEBUG(ss);
|
||||
// If the unique ID is not supported, use KFD's unique ID
|
||||
if (ret != RSMI_STATUS_SUCCESS) {
|
||||
GET_DEV_AND_KFDNODE_FROM_INDX
|
||||
uint32_t node_id;
|
||||
uint64_t kfd_unique_id;
|
||||
int ret_kfd = kfd_node->get_node_id(&node_id);
|
||||
ret_kfd = amd::smi::read_node_properties(node_id, "unique_id", &kfd_unique_id);
|
||||
if (ret_kfd == 0) {
|
||||
*unique_id = kfd_unique_id;
|
||||
ret = RSMI_STATUS_SUCCESS;
|
||||
} else {
|
||||
*unique_id = std::numeric_limits<uint64_t>::max();
|
||||
ret = RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | Issue: Could not read unique_id from sysfs, falling back to KFD" << "\n"
|
||||
<< " ; Device #: " << std::to_string(dv_ind) << "\n"
|
||||
<< " ; ret_kfd: " << std::to_string(ret_kfd) << "\n"
|
||||
<< " ; node: " << std::to_string(node_id) << "\n"
|
||||
<< " ; Data: unique_id (from KFD)= " << std::to_string(*unique_id) << "\n"
|
||||
<< " ; ret = " << getRSMIStatusString(ret, false);
|
||||
LOG_DEBUG(ss);
|
||||
}
|
||||
return ret;
|
||||
|
||||
CATCH
|
||||
}
|
||||
|
||||
rsmi_status_t
|
||||
rsmi_dev_counter_create(uint32_t dv_ind, rsmi_event_type_t type,
|
||||
rsmi_event_handle_t *evnt_handle) {
|
||||
|
||||
@@ -1051,6 +1051,7 @@ int KFDNode::get_node_id(uint32_t *node_id) {
|
||||
int ret = 0;
|
||||
std::string nodeid_path = "/sys/class/kfd/kfd/topology/nodes/"
|
||||
+ std::to_string(this->node_indx_);
|
||||
*node_id = this->node_indx_;
|
||||
ss << __PRETTY_FUNCTION__
|
||||
<< " | File: " << nodeid_path
|
||||
<< " | Read node #: " << std::to_string(this->node_indx_)
|
||||
@@ -1058,7 +1059,6 @@ int KFDNode::get_node_id(uint32_t *node_id) {
|
||||
<< " | Return: "
|
||||
<< getRSMIStatusString(amd::smi::ErrnoToRsmiStatus(ret), false)
|
||||
<< " | ";
|
||||
*node_id = this->node_indx_;
|
||||
LOG_DEBUG(ss);
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user