From d1b71cc068f53172bf6bafb76f5b0d7a578df557 Mon Sep 17 00:00:00 2001 From: Andrew Rowley Date: Fri, 23 Aug 2024 10:54:41 +0100 Subject: [PATCH] Also account for the partition here --- .../router_algorithms/application_router.py | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/pacman/operations/router_algorithms/application_router.py b/pacman/operations/router_algorithms/application_router.py index adf05746e..ed1f87c7a 100644 --- a/pacman/operations/router_algorithms/application_router.py +++ b/pacman/operations/router_algorithms/application_router.py @@ -202,7 +202,10 @@ def route_application_graph() -> MulticastRoutingTableByPartition: source_xy = next(iter(source_mappings.keys())) # Get all source chips coordinates - all_source_xys = _get_all_xys(source) + all_source_xys = { + vertex_xy(m_vertex) + for m_vertex in source.splitter.get_out_going_vertices( + partition.identifier)} # Keep track of the source edge chips source_edge_xys: Set[XY] = set() @@ -234,8 +237,8 @@ def route_application_graph() -> MulticastRoutingTableByPartition: _route_source_to_source(source, partition, targets, self_xys) # Deal with internal multicast partitions - internal = _get_filtered_internal_partitions( - source, partition.identifier) + internal = list(_get_filtered_internal_partitions( + source, partition.identifier)) if internal: self_connected = True _route_internal(internal, targets, self_xys) @@ -320,7 +323,8 @@ def _route_source_to_target( overlaps = None else: # Find all coordinates for chips (xy) that are in the target - target_xys = _get_all_xys(target) + target_xys = {vertex_xy(m_vertex) + for m_vertex, _srcs in target_vertices} # Pick one to actually use as a target target_xy, overlaps = _find_target_xy( @@ -642,18 +646,6 @@ def _get_outgoing_mapping( return outgoing_mapping -def _get_all_xys(app_vertex: ApplicationVertex) -> Set[XY]: - """ - Gets the list of all the x,y coordinates that the vertex's machine vertices - are placed on. - - :param ApplicationVertex app_vertex: - :rtype: set(tuple(int, int)) - """ - return {vertex_xy(m_vertex) - for m_vertex in app_vertex.machine_vertices} - - def _route_to_xys( first_xy: XY, all_xys: Set[XY], machine: Machine, routes: Dict[XY, RoutingTree], targets: Iterable[XY], label: str):