[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
This commit is contained in:
Elena Sakhnovitch
2021-09-23 00:57:14 -04:00
کامیت شده توسط Harish Kasiviswanathan
والد e96d6ab77e
کامیت 50ea68e694
6فایلهای تغییر یافته به همراه108 افزوده شده و 2 حذف شده
@@ -3361,6 +3361,32 @@ rsmi_status_t
rsmi_topo_get_link_weight(uint32_t dv_ind_src, uint32_t dv_ind_dst,
uint64_t *weight);
/**
* @brief Retreive minimal and maximal io link bandwidth between 2 GPUs
*
* @details Given a source device index @p dv_ind_src and
* a destination device index @p dv_ind_dst, pointer to an
* uint64_t @p min_bandwidth, and a pointer to uint64_t @p max_bandiwidth,
* this function will write theoretical minimal and maximal bandwidth limits.
* API works if src and dst are connected via xgmi and have 1 hop distance.
*
* @param[in] dv_ind_src the source device index
*
* @param[in] dv_ind_dst the destination device index
*
* @param[inout] min_bandwidth A pointer to an uint64_t to which the
* minimal bandwidth for the connection should be written.
*
* @param[inout] max_bandwidth A pointer to an uint64_t to which the
* maximal bandwidth for the connection should be written.
*
* @retval ::RSMI_STATUS_SUCCESS call was successful
* @retval ::RSMI_STATUS_INVALID_ARGS the provided arguments are not valid
*/
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);
/**
* @brief Retrieve the hops and the connection type between 2 GPUs
*
@@ -98,6 +98,9 @@ class IOLink {
uint32_t node_to(void) const {return node_to_;}
uint64_t weight(void) const {return weight_;}
LINK_DIRECTORY_TYPE get_directory_type(void) const {return link_dir_type_;}
uint64_t min_bandwidth(void) const {return min_bandwidth_;}
uint64_t max_bandwidth(void) const {return max_bandwidth_;}
private:
uint32_t node_indx_;
@@ -106,6 +109,8 @@ class IOLink {
uint32_t node_from_;
uint32_t node_to_;
uint64_t weight_;
uint64_t min_bandwidth_;
uint64_t max_bandwidth_;
std::map<std::string, uint64_t> properties_;
LINK_DIRECTORY_TYPE link_dir_type_;
};
@@ -74,6 +74,8 @@ class KFDNode {
IO_LINK_TYPE numa_node_type(void) const {return numa_node_type_;}
int get_io_link_type(uint32_t node_to, IO_LINK_TYPE *type);
int get_io_link_weight(uint32_t node_to, uint64_t *weight);
int get_io_link_bandwidth(uint32_t node_to, uint64_t *max_bandwidth,
uint64_t *min_bandwidth);
std::shared_ptr<Device> amdgpu_device(void) const {return amdgpu_device_;}
uint32_t amdgpu_dev_index(void) const {return amdgpu_dev_index_;}
void set_amdgpu_dev_index(uint32_t val) {amdgpu_dev_index_ = val;}
@@ -90,6 +92,8 @@ class KFDNode {
uint32_t cu_count_;
std::map<uint32_t, IO_LINK_TYPE> io_link_type_;
std::map<uint32_t, uint64_t> io_link_weight_;
std::map<uint32_t, uint64_t> io_link_max_bandwidth_;
std::map<uint32_t, uint64_t> io_link_min_bandwidth_;
std::map<uint32_t, std::shared_ptr<IOLink>> io_link_map_;
std::map<std::string, uint64_t> properties_;
std::shared_ptr<Device> amdgpu_device_;