-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix overhead of DAGCircuit.remove_op_node
#11677
Comments
Fwiw I have a proof of concept patch to rustworkx and Qiskit locally that solves this, but the issue is to remind us to sort it out properly after the 1.0 release. |
See Qiskit/rustworkx#1083 for the Rustworkx side of this, which is the non-trivial part. If that (or something like it) merges there, the changes on the Qiskit side are pretty trivial - we just need to swap |
Ha, I forgot we had the issue and opened #12156 to remind myself about it as well. Oh well. |
This commit updates the minimum rustworkx version to 0.15.0 to pull in the new PyDiGraph.remove_node_retain_edges_by_id() method introduced in that release. This new function is used for the DAGCircuit.remove_op_node() method instead of the PyDiGraph.remove_node_retain_edges() function. This new method has much better scaling characteristics and should improve the performance characteristics of removing very wide operations from a DAGCircuit. Fixes Qiskit#11677 Part of Qiskit#12156
This commit updates the minimum rustworkx version to 0.15.0 to pull in the new PyDiGraph.remove_node_retain_edges_by_id() method introduced in that release. This new function is used for the DAGCircuit.remove_op_node() method instead of the PyDiGraph.remove_node_retain_edges() function. This new method has much better scaling characteristics and should improve the performance characteristics of removing very wide operations from a DAGCircuit. Fixes #11677 Part of #12156
) This commit updates the minimum rustworkx version to 0.15.0 to pull in the new PyDiGraph.remove_node_retain_edges_by_id() method introduced in that release. This new function is used for the DAGCircuit.remove_op_node() method instead of the PyDiGraph.remove_node_retain_edges() function. This new method has much better scaling characteristics and should improve the performance characteristics of removing very wide operations from a DAGCircuit. Fixes Qiskit#11677 Part of Qiskit#12156
What should we add?
Right now the
DAGCircuit,remove_op_node
function has quadratic overhead as a function of the number of bits/dag edges are on an operation. This is do to how the underlyingrustworkx.PyDiGraph.remove_node_retain_edges
method is used byremove_op_node
. Normally this doesn't matter because in most cases this is only ever called on operations with 1 or 2 qubits. However, since the introduction of #10323 this is now getting called on a barrier of n qubits for the the width of the target backend. This can become a large performance bottleneck, for example when targeting a 60k qubit backend callingremove_op_node
took 47 min while it was processing the list of qubits.To fix this optimally we'll need to likely add a new interface to rustworkx to handle this more efficiently.
The text was updated successfully, but these errors were encountered: