Simplify routing verification and isolate benchmark policies

This commit is contained in:
Jan Petykiewicz 2026-11-26 21:55:34 -08:00
commit ec2768853e

View file

@ -142,12 +142,6 @@ class RoutingWorld:
def _ensure_static_raw_tree(self) -> None:
self._static_obstacles.ensure_raw_tree()
def _ensure_dynamic_tree(self) -> None:
self._dynamic_paths.ensure_tree()
def _ensure_dynamic_grid(self) -> None:
self._dynamic_paths.ensure_grid()
def add_path(
self,
net_id: str,
@ -349,10 +343,6 @@ class RoutingWorld:
if not dynamic_paths.dilated:
return {}
self._ensure_dynamic_grid()
if not dynamic_paths.grid:
return {}
candidates_by_net: dict[str, dict[int, set[int]]] = {}
for test_geometry_index, test_bounds in enumerate(result.dilated_bounds):
if not self._has_possible_congestion_in_grid(test_bounds, net_id):
@ -407,16 +397,16 @@ class RoutingWorld:
net_id: str,
) -> bool:
gx_min, gy_min, gx_max, gy_max = grid_cell_span(bounds, self.grid_cell_size)
dynamic_paths = self._dynamic_paths
cells = self._dynamic_paths.grid_net_obj_ids
if gx_min == gx_max and gy_min == gy_max:
net_counts = dynamic_paths.grid_net_counts.get((gx_min, gy_min))
return bool(net_counts and (len(net_counts) > 1 or net_id not in net_counts))
members = cells.get((gx_min, gy_min))
return bool(members and (len(members) > 1 or net_id not in members))
for gx in range(gx_min, gx_max + 1):
for gy in range(gy_min, gy_max + 1):
net_counts = dynamic_paths.grid_net_counts.get((gx, gy))
if net_counts and (len(net_counts) > 1 or net_id not in net_counts):
members = cells.get((gx, gy))
if members and (len(members) > 1 or net_id not in members):
return True
return False
@ -430,10 +420,6 @@ class RoutingWorld:
if not dynamic_paths.dilated:
return False
self._ensure_dynamic_grid()
if not dynamic_paths.grid:
return False
for bounds in result.dilated_bounds:
gx_min, gy_min, gx_max, gy_max = grid_cell_span(bounds, self.grid_cell_size)
cache_key = (net_id, gx_min, gy_min, gx_max, gy_max)