@@ -99,8 +99,8 @@ def max_dict(a: dict[Any, Any], b: dict[Any, Any]) -> dict[Any, Any]:
9999
100100@dataclass
101101class NetworkStats :
102- buffet_to_total_hops : Any
103- buffet_to_max_hops : Any
102+ total_hops : Any = field ( default = 0 )
103+ max_hops : Any = field ( default = 0 )
104104
105105
106106@dataclass
@@ -556,7 +556,7 @@ def analyze_reuse_and_add_reservations_to_mapping(
556556 tensor_to_backer_id = tensor_to_backer_id ,
557557 is_copy_operation = is_copy_operation ,
558558 job = job ,
559- src_to_dst_movement = DataMovementConnections .from_pmapping (cur_mapping .nodes ),
559+ data_movement_connections = DataMovementConnections .from_pmapping (cur_mapping .nodes ),
560560 )
561561 cur_result = analyze_node (0 , job .rank_variable_bounds , info )
562562 if result is None :
@@ -1169,6 +1169,16 @@ def analyze_reservation(node_idx, current_shape, info: AnalysisInfo):
11691169 )
11701170 child_result .buffet_stats [buffet ] = stats
11711171
1172+ # Reservation nodes are the first to produce stats for a network
1173+ assert network not in child_result .network_stats
1174+ network = Network (
1175+ tensor ,
1176+ einsum_name ,
1177+ info .data_movement_connections .get_src (buffet ),
1178+ buffet
1179+ )
1180+ child_result .network_stats [network ] = NetworkStats ()
1181+
11721182 fanout_key = (node .resource , einsum_name )
11731183 if fanout_key not in child_result .fanout :
11741184 child_result .fanout [fanout_key ] = {}
@@ -1209,6 +1219,14 @@ def analyze_compute(
12091219 stats .max_occupancy = 1
12101220 result_accumulator .buffet_stats [buffet ] = stats
12111221
1222+ network = Network (
1223+ tensor ,
1224+ einsum ,
1225+ info .data_movement_connections .get_src (buffet ),
1226+ buffet
1227+ )
1228+ result_accumulator .network_stats [network ] = NetworkStats ()
1229+
12121230 return result_accumulator
12131231
12141232
0 commit comments