Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove recursion from ConstrainedReschedule pass (#10051)
* Remove recurssion from ConstrainedReschedule pass The ConstrainedReschedule pass previosuly was using a recursive depth first traversal to push back overlapping gates after aligning operations. This however would cause a failure for a sufficiently large circuit when the recursion depth could potentially exceed the maximum stack depth allowed in python. To address this, this commit rewrites the depth first traversal to be iterative instead of recursive. This removes the stack depth limitation and should let the pass run with any size circuit. However, the performance of this pass is poor for large circuits. One thing we can look at using to try and speed it up is rustworkx's dfs_search() function which will let us shift the traversal to rust and call back to python to do the timing offsets. If this is insufficient we'll have to investigate a different algorithm for adjusting the time that doesn't require multiple iterations like the current approach. Fixes #10049 * Use rustworkx's dfs_search instead of manual dfs implementation This commit rewrites the pass to leverage rustworkx's dfs_search function which provides a way to have rustworkx traverse the graph in a depth first manner and then provides hook points to execute code at different named portions of the DFS. By leveraging this function we're able to speed up the search by leveraging rust to perform the actual graph traversal. * Revert "Use rustworkx's dfs_search instead of manual dfs implementation" This made performance of the pass worse so reverting this for now. We can investigate this at a later date. This reverts commit bd3cbb2. * Remove visited node check from DFS This commit removes the visited node check and skip logic from the DFS traversal. To ensure this code behaves identically to the recursive version before this PR this logic is removed because there wasn't a similar check in that version. (cherry picked from commit 112bd6e)
- Loading branch information