[SWDEV-543308] Revert amdsmi_link_metrics structure change
Moved the bit_rate and max_bandwidth back into links in the
amdsmi_link_metrics_t struct as this change was impacting
other teams. Modified the C and python API's, wrapper, and
CLI accordingly.
Signed-off-by: Bindhiya Kanangot Balakrishnan <Bindhiya.KanangotBalakrishnan@amd.com>
[ROCm/amdsmi commit: 645c313f00]
このコミットが含まれているのは:
@@ -6034,8 +6034,8 @@ class AMDSMICommands():
|
||||
|
||||
try:
|
||||
xgmi_metrics_info = amdsmi_interface.amdsmi_get_link_metrics(src_gpu)
|
||||
bitrate = xgmi_metrics_info['bit_rate']
|
||||
max_bandwidth = xgmi_metrics_info['max_bandwidth']
|
||||
bitrate = xgmi_metrics_info['links'][0]['bit_rate']
|
||||
max_bandwidth = xgmi_metrics_info['links'][0]['max_bandwidth']
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
bitrate = "N/A"
|
||||
max_bandwidth = "N/A"
|
||||
|
||||
@@ -974,10 +974,10 @@ typedef struct {
|
||||
*/
|
||||
typedef struct {
|
||||
uint32_t num_links; //!< number of links
|
||||
uint32_t bit_rate; //!< current link speed in Gb/s
|
||||
uint32_t max_bandwidth; //!< max bandwidth of the link in Gb/s
|
||||
struct _links {
|
||||
amdsmi_bdf_t bdf; //!< bdf of the destination gpu
|
||||
uint32_t bit_rate; //!< current link speed in Gb/s
|
||||
uint32_t max_bandwidth; //!< max bandwidth of the link in Gb/s
|
||||
amdsmi_link_type_t link_type; //!< type of the link
|
||||
uint64_t read; //!< total data received for each link in KB
|
||||
uint64_t write; //!< total data transfered for each link in KB
|
||||
|
||||
@@ -3126,6 +3126,8 @@ def amdsmi_get_link_metrics(processor_handle: processor_handle):
|
||||
link = link_metrics.links[i]
|
||||
links.append({
|
||||
"bdf": _format_bdf(link.bdf),
|
||||
"bit_rate": link.bit_rate,
|
||||
"max_bandwidth": link.max_bandwidth,
|
||||
"link_type": link.link_type,
|
||||
"read": link.read,
|
||||
"write": link.write,
|
||||
@@ -3133,8 +3135,6 @@ def amdsmi_get_link_metrics(processor_handle: processor_handle):
|
||||
|
||||
return {
|
||||
"num_links": link_metrics.num_links,
|
||||
"bit_rate": link_metrics.bit_rate,
|
||||
"max_bandwidth": link_metrics.max_bandwidth,
|
||||
"links": links
|
||||
}
|
||||
|
||||
|
||||
@@ -1160,6 +1160,8 @@ class struct__links(Structure):
|
||||
struct__links._pack_ = 1 # source:False
|
||||
struct__links._fields_ = [
|
||||
('bdf', amdsmi_bdf_t),
|
||||
('bit_rate', ctypes.c_uint32),
|
||||
('max_bandwidth', ctypes.c_uint32),
|
||||
('link_type', amdsmi_link_type_t),
|
||||
('PADDING_0', ctypes.c_ubyte * 4),
|
||||
('read', ctypes.c_uint64),
|
||||
@@ -1170,8 +1172,6 @@ struct__links._fields_ = [
|
||||
struct_amdsmi_link_metrics_t._pack_ = 1 # source:False
|
||||
struct_amdsmi_link_metrics_t._fields_ = [
|
||||
('num_links', ctypes.c_uint32),
|
||||
('bit_rate', ctypes.c_uint32),
|
||||
('max_bandwidth', ctypes.c_uint32),
|
||||
('PADDING_0', ctypes.c_ubyte * 4),
|
||||
('links', struct__links * 64),
|
||||
('reserved', ctypes.c_uint64 * 7),
|
||||
|
||||
@@ -2132,7 +2132,9 @@ amdsmi_status_t amdsmi_get_link_metrics(amdsmi_processor_handle processor_handle
|
||||
if (link_metrics == nullptr) return AMDSMI_STATUS_INVAL;
|
||||
|
||||
amdsmi_gpu_metrics_t metric_info = {};
|
||||
link_metrics->max_bandwidth = std::numeric_limits<uint32_t>::max();
|
||||
for (unsigned int i = 0; i < AMDSMI_MAX_NUM_XGMI_LINKS; ++i) {
|
||||
link_metrics->links[i].max_bandwidth = std::numeric_limits<uint32_t>::max();
|
||||
}
|
||||
|
||||
amdsmi_status_t status = amdsmi_get_gpu_metrics_info(
|
||||
processor_handle, &metric_info);
|
||||
@@ -2140,11 +2142,6 @@ amdsmi_status_t amdsmi_get_link_metrics(amdsmi_processor_handle processor_handle
|
||||
return status;
|
||||
link_metrics->num_links = AMDSMI_MAX_NUM_XGMI_LINKS;
|
||||
|
||||
link_metrics->bit_rate = metric_info.xgmi_link_speed;
|
||||
if ((metric_info.xgmi_link_speed != std::numeric_limits<uint16_t>::max()) &&
|
||||
(metric_info.xgmi_link_width != std::numeric_limits<uint16_t>::max()))
|
||||
link_metrics->max_bandwidth = metric_info.xgmi_link_speed * metric_info.xgmi_link_width;
|
||||
|
||||
uint16_t link_to_dst_node[AMDSMI_MAX_NUM_XGMI_LINKS];
|
||||
std::fill_n(link_to_dst_node, AMDSMI_MAX_NUM_XGMI_LINKS, std::numeric_limits<uint16_t>::max());
|
||||
status = rsmi_wrapper(rsmi_dev_xgmi_port_num_get, processor_handle, 0,
|
||||
@@ -2191,6 +2188,10 @@ amdsmi_status_t amdsmi_get_link_metrics(amdsmi_processor_handle processor_handle
|
||||
link_metrics->links[i].read = metric_info.xgmi_read_data_acc[i];
|
||||
link_metrics->links[i].write = metric_info.xgmi_write_data_acc[i];
|
||||
link_metrics->links[i].link_type = AMDSMI_LINK_TYPE_XGMI;
|
||||
link_metrics->links[i].bit_rate = metric_info.xgmi_link_speed;
|
||||
if ((metric_info.xgmi_link_speed != std::numeric_limits<uint16_t>::max()) &&
|
||||
(metric_info.xgmi_link_width != std::numeric_limits<uint16_t>::max()))
|
||||
link_metrics->links[i].max_bandwidth = metric_info.xgmi_link_speed * metric_info.xgmi_link_width;
|
||||
}
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする