Cap the automatic near-port probe at two iterations

This commit is contained in:
Jan Petykiewicz 2026-11-26 19:59:00 -08:00
commit 64e103b59e

View file

@ -59,6 +59,7 @@ if TYPE_CHECKING:
_INITIAL_NODE_LIMIT = 500
_NEAR_PORT_NODE_LIMIT = 100
_NEAR_PORT_ITERATION_LIMIT = 2
def _has_fragmented_shifts(trial: Trial) -> bool:
@ -506,8 +507,12 @@ class _AutomaticRun:
try_construction_early = self.iteration_callback is None and not options.congestion.shuffle_nets
if try_construction_early and self._try_column_jogs(options, trials, target):
return True
small = replace(options, search=replace(options.search, node_limit=min(_NEAR_PORT_NODE_LIMIT, options.search.node_limit)))
probe = self._direct(small, "direct-probe-near-port")
probe_options = replace(
options,
search=replace(options.search, node_limit=min(_NEAR_PORT_NODE_LIMIT, options.search.node_limit)),
congestion=replace(options.congestion, max_iterations=min(_NEAR_PORT_ITERATION_LIMIT, options.congestion.max_iterations)),
)
probe = self._direct(probe_options, "direct-probe-near-port")
trials.extend(probe)
if len(_best_trial(trials).valid_costs) >= target:
return True