def route(self): self.apply_possible_ops() while self.remaining_dag: self.apply_next_swaps() self.apply_possible_ops() assert ops_are_consistent_with_device_graph(self.physical_ops, self.device_graph)
def route(self): self.apply_possible_ops() empty_steps_remaining = self.max_num_empty_steps while self.remaining_dag: self.apply_next_swaps(not empty_steps_remaining) n_applied_ops = self.apply_possible_ops() if n_applied_ops: empty_steps_remaining = self.max_num_empty_steps else: empty_steps_remaining -= 1 assert ops_are_consistent_with_device_graph(self.physical_ops, self.device_graph)