-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix creation of registers in synthesis methods #13086
Conversation
One or more of the following people are relevant to this code:
|
I'm not 100% happy with this solution of Another solution could be to change that |
Pull Request Test Coverage Report for Build 10789366864Details
💛 - Coveralls |
Thanks, @Cryoris! If I recall correctly, many of the circuit definition functions in |
It now works without an additional
I think in practice this won't be an issue as HLS doesn't need the registers to synthesize building blocks within an existing circuit. We can add this fast path in a follow up, since that will require changing the API by adding an additional argument to the synthesis method, so we should avoid that in the backport. |
@alexanderivrii for backward compatibility it would probably make sense to keep it, but let's see if that adds a significant overhead 🙂 |
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.
LGTM, thanks!
* add qregs to output circuits * never develop while not on up-to-date main * one shan't commit faster than ones IDE can run black * avoid compose (cherry picked from commit 1962704) # Conflicts: # qiskit/synthesis/linear_phase/cz_depth_lnn.py # qiskit/synthesis/permutation/permutation_reverse_lnn.py
) * Fix creation of registers in synthesis methods (#13086) * add qregs to output circuits * never develop while not on up-to-date main * one shan't commit faster than ones IDE can run black * avoid compose (cherry picked from commit 1962704) # Conflicts: # qiskit/synthesis/linear_phase/cz_depth_lnn.py # qiskit/synthesis/permutation/permutation_reverse_lnn.py * Fix merge conflicts some methods are not available in Rust on 1.2, so there's no add_regs flag to add --------- Co-authored-by: Julien Gacon <jules.gacon@googlemail.com>
Summary
Fixes #13041 (and the same problem in other places, but no one complained yet 🙂).
Details and comments
With the moving the circuit creation to Rust-space, we created circuits that did not have any quantum (or classical) registers, which led to issues as #13041. This PR adds an argument
add_regs
toQuantumCircuit._from_circuit_data
(defaultFalse
) which allows to add these registers and create backward-compatible circuits. In places where the final circuit was created from circuit data, this argument is set toTrue
.