Skip to content

Fix: Update plugin to work with Qiskit 2.0.0 - #20

Open
raynelfss wants to merge 5 commits into
qiskit-community:mainfrom
raynelfss:update-to-2.0
Open

raynelfss wants to merge 5 commits into
qiskit-community:mainfrom
raynelfss:update-to-2.0

Conversation

@raynelfss

Copy link
Copy Markdown
Collaborator

Following the Qiskit 2.0 Migration Guide this package should now be compatible with all Qiskit 2.0 releases and run without issue.

The changes include:

  • Removing basis gates from the pass manager config pipeline.
  • Filter Barrier by instance and ControlFlow instructions only if they're IfElseOp or WhileLoop as condition was removed.

Improvements:

  • Remove unnecessary bit allocation by using DAGCircuit.copy_empty_like().

Following the [Qiskit 2.0 Migration Guide](https://quantum.cloud.ibm.com/docs/en/guides/qiskit-2.0) this package should now be compatible with all Qiskit 2.0 releases and run without issue.

The changes include:
- Removing basis gates from the pass manager config pipeline.
- Filter `Barrier` by instance and `ControlFlow` instructions only if they're `IfElseOp` or `WhileLoop` as `condition` was removed.

Improvements:
- Remove unnecessary bit allocation by using `DAGCircuit.copy_empty_like()`.
# Apply the operation, check for condition
if getattr(current_node.op, "condition") is not None:
# Apply the operation, check for condition if control flow
if isinstance(current_node.op, (IfElseOp, WhileLoopOp)):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this pass valid with control flow in the circuit?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, although it won't re-organize the inner block of the operation. I think the only reason this is here is so that the condition is copied properly whenever it gets re-indexed. Because of how rough the pass is, it will re-index every operation.

Comment thread qiskit_qubit_reuse/plugin.py Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants