[ROCm SMI LIB]: Add rsmi_minmax_bandwidth_get()
API provides min/max bandwidth values between nodes.
(Current implementation only supports directly (1 hop)
connected XGMI devices.
Signed-off-by: Elena Sakhnovitch
Change-Id: Ifc95da13845fbe7903c5386d320183ffd58c5b53
[ROCm/rocm_smi_lib commit: 50ea68e694]
This commit is contained in:
committed by
Harish Kasiviswanathan
szülő
68a7ef02b5
commit
71fe1f8bce
@@ -3453,6 +3453,49 @@ rsmi_topo_get_link_weight(uint32_t dv_ind_src, uint32_t dv_ind_dst,
|
||||
CATCH
|
||||
}
|
||||
|
||||
rsmi_status_t
|
||||
rsmi_minmax_bandwidth_get(uint32_t dv_ind_src, uint32_t dv_ind_dst,
|
||||
uint64_t *min_bandwidth, uint64_t *max_bandwidth){
|
||||
TRY
|
||||
|
||||
uint32_t dv_ind = dv_ind_src;
|
||||
GET_DEV_AND_KFDNODE_FROM_INDX
|
||||
DEVICE_MUTEX
|
||||
|
||||
if (min_bandwidth == nullptr || max_bandwidth == nullptr) {
|
||||
return RSMI_STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
if (dv_ind_src == dv_ind_dst) {
|
||||
return RSMI_STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
rsmi_status_t status;
|
||||
uint32_t node_ind_dst;
|
||||
int ret = smi.get_node_index(dv_ind_dst, &node_ind_dst);
|
||||
|
||||
if (ret != 0) {
|
||||
return RSMI_STATUS_INVALID_ARGS;
|
||||
}
|
||||
|
||||
|
||||
amd::smi::IO_LINK_TYPE type;
|
||||
ret = kfd_node->get_io_link_type(node_ind_dst, &type);
|
||||
if ( ret == 0 && type == amd::smi::IOLINK_TYPE_XGMI) {
|
||||
ret = kfd_node->get_io_link_bandwidth(node_ind_dst,max_bandwidth,
|
||||
min_bandwidth);
|
||||
if (ret == 0)
|
||||
status = RSMI_STATUS_SUCCESS;
|
||||
else
|
||||
status = RSMI_STATUS_INIT_ERROR;
|
||||
} else { // from src GPU to it's CPU node, or type not XGMI
|
||||
status = RSMI_STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
return status;
|
||||
CATCH
|
||||
}
|
||||
|
||||
rsmi_status_t
|
||||
rsmi_topo_get_link_type(uint32_t dv_ind_src, uint32_t dv_ind_dst,
|
||||
uint64_t *hops, RSMI_IO_LINK_TYPE *type) {
|
||||
|
||||
@@ -73,8 +73,8 @@ static const char *kIOLinkPropNODE_TOStr = "node_to";
|
||||
static const char *kIOLinkPropWEIGHTStr = "weight";
|
||||
// static const char *kIOLinkPropMIN_LATENCYStr = "min_latency";
|
||||
// static const char *kIOLinkPropMAX_LATENCYStr = "max_latency";
|
||||
// static const char *kIOLinkPropMIN_BANDWIDTHStr = "min_bandwidth";
|
||||
// static const char *kIOLinkPropMAX_BANDWIDTHStr = "max_bandwidth";
|
||||
static const char *kIOLinkPropMIN_BANDWIDTHStr = "min_bandwidth";
|
||||
static const char *kIOLinkPropMAX_BANDWIDTHStr = "max_bandwidth";
|
||||
// static const char *kIOLinkPropRECOMMENDED_TRANSFER_SIZEStr =
|
||||
// "recommended_transfer_size";
|
||||
// static const char *kIOLinkPropFLAGSStr = "flags";
|
||||
@@ -380,6 +380,12 @@ IOLink::Initialize(void) {
|
||||
if (ret) {return ret;}
|
||||
|
||||
ret = get_property_value(kIOLinkPropWEIGHTStr, &weight_);
|
||||
if (ret) {return ret;}
|
||||
|
||||
ret = get_property_value(kIOLinkPropMIN_BANDWIDTHStr, &min_bandwidth_);
|
||||
if (ret) {return ret;}
|
||||
|
||||
ret = get_property_value(kIOLinkPropMAX_BANDWIDTHStr, &max_bandwidth_);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -679,6 +679,9 @@ KFDNode::Initialize(void) {
|
||||
} else {
|
||||
io_link_type_[node_to] = link->type();
|
||||
io_link_weight_[node_to] = link->weight();
|
||||
io_link_max_bandwidth_[node_to] = link->max_bandwidth();
|
||||
io_link_min_bandwidth_[node_to] = link->min_bandwidth();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -746,5 +749,24 @@ KFDNode::get_io_link_weight(uint32_t node_to, uint64_t *weight) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
KFDNode::get_io_link_bandwidth(uint32_t node_to, uint64_t *max_bandwidth,
|
||||
uint64_t *min_bandwidth){
|
||||
assert (max_bandwidth != nullptr && min_bandwidth != nullptr);
|
||||
if (max_bandwidth == nullptr || min_bandwidth == nullptr ){
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (io_link_max_bandwidth_.find(node_to) == io_link_max_bandwidth_.end() ||
|
||||
io_link_min_bandwidth_.find(node_to) == io_link_min_bandwidth_.end()){
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
*max_bandwidth = io_link_max_bandwidth_[node_to];
|
||||
*min_bandwidth = io_link_min_bandwidth_[node_to];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace smi
|
||||
} // namespace amd
|
||||
|
||||
Reference in New Issue
Block a user