Skip to content

Commit e515909

Browse files
committed
[mode] WIP network model
1 parent 57423ea commit e515909

3 files changed

Lines changed: 23 additions & 4 deletions

File tree

accelforge/frontend/mapping/mapping.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,6 @@ def split_reservations(self):
16031603

16041604
def split_loop_with_multiple_rank_variables(self, einsum_name: EinsumName):
16051605
new_nodes = []
1606-
my_rank_variables = set(x[1] for x in stride_and_halo)
16071606
for node in self.nodes:
16081607
if isinstance(node, Loop) and isinstance(node.rank_variable, set):
16091608
if einsum_name not in node._einsum_to_rank_variables:

accelforge/model/_looptree/reuse/symbolic/symbolic.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ def max_dict(a: dict[Any, Any], b: dict[Any, Any]) -> dict[Any, Any]:
9999

100100
@dataclass
101101
class 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

accelforge/model/_looptree/types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@ class Network:
4545
"The source of data."
4646
destination: ComponentName
4747
"The destination of data."
48+
component: ComponentName = None
49+
"The network component used to deliver the data."

0 commit comments

Comments
 (0)