-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Rework RemoveFinalMeasurements pass (bug fixes) #7196
Rework RemoveFinalMeasurements pass (bug fixes) #7196
Conversation
For now, just warn if a busy bit is left without any referencing cregs.
Todo
|
Regarding performance, results of Release 0.18.3: This is about what I'd expect, since the current version of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates. One question in the Clbit
removal behavior of RemoveFinalMeasurements
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this - it seems quite a bit more logical to me than what we had before, and the behaviour seems much more consistent.
I left a few (rather more than I thought I had...) comments in line. A lot of them are about magic Sphinx incantations, and a few comments just on stuff I like. I don't think there were any serious changes at all, but there were a couple of places where comments/documentation had got out-of-sync with code.
Co-authored-by: Jake Lishman <jake@binhbar.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to accept to me. Looks like there's a merge conflict - did you base this branch off a main
before #7039? If so, we can probably just merge with strategy "ours". You can do the merge locally and push - it's fine to have merge commits in PRs here, because we squash all PRs into a single change before applying, so the history will be fine.
I believe that had already gone in prior to me starting this branch, so maybe some other refactor touched that file. I should have a chance to do the merge shorty! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the prompt changes on this. I'm happy to accept it as-is. Kevin was already happy with it (as best as I can tell), so I'll merge now without waiting for him to re-comment because I anticipate a nasty CI crunch on Monday and Tuesday even in the best-case scenario.
Summary
Fixes several bugs with
RemoveFinalMeasurements
andQuantumCircuit.remove_final_measurements
discussed in #7089.Details and comments
RemoveFinalMeasurements
DAGCircuit
manually without updatingDAGCircuit.{clbits, _wires, input_map, output_map, _multi_graph}
, which resulted in an invalid DAG.DAGCircuit
remove_cregs
to remove classical registers from the circuit.remove_clbits
to remove idle classical bits as well as any registers that reference them.QuantumCircuit
clbit
copy from DAG inremove_final_measurements
.Sample output
Before pass
After pass