Skip to content
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

Overloaded get_compiled_circuit/s #423

Merged
merged 21 commits into from
Nov 26, 2024
Merged

Overloaded get_compiled_circuit/s #423

merged 21 commits into from
Nov 26, 2024

Conversation

sjdilkes
Copy link
Contributor

@sjdilkes sjdilkes commented Nov 25, 2024

The timeout wasn't being passed appropriately in the previous version. This PR overloads the Backend.get_compiled_circuit and Backend.get_compiled_circuits methods to add a timeout parameter, as with pytket-quantinuum, making sure users can modify it for using optimisation level 3.

Checklist

  • I have performed a self-review of my code.
  • I have commented hard-to-understand parts of my code.
  • I have made corresponding changes to the public API documentation.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the changelog with any user-facing changes.

@sjdilkes sjdilkes marked this pull request as ready for review November 25, 2024 09:21
@sjdilkes sjdilkes requested a review from cqc-melf as a code owner November 25, 2024 09:21
@@ -410,7 +410,34 @@ def default_compilation_pass_offline(
passlist.append(FullPeepholeOptimise())
elif optimisation_level == 3:
passlist.append(RemoveBarriers())
passlist.append(AutoRebase({OpType.CX, OpType.H, OpType.Rz}))
passlist.append(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this a relevant change, that should be in the changelog, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we don't need to include this - all I've done is update the set of gates we AutoRebase to so that it exactly matches what GreedyPauliSimp accepts. We don't mention this rebase for the GreedyPauliSimp line of the changelog so I don't think it's worth explicitly pointing out.

:rtype: Circuit
"""
return_circuit = circuit.copy()
if optimisation_level == 3 and circuit.n_gates_of_type(OpType.Barrier) > 0:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this check not in the other function get_compiled_circuits ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

get_compiled_circuits calls this method so the check is done implicitly

:rtype: Circuit
"""
return_circuit = circuit.copy()
if optimisation_level == 3 and circuit.n_gates_of_type(OpType.Barrier) > 0:
Copy link
Collaborator

Choose a reason for hiding this comment

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

See above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same answer as for AerBackend

@sjdilkes sjdilkes requested a review from cqc-melf November 26, 2024 10:13
@sjdilkes sjdilkes merged commit 894aa8c into main Nov 26, 2024
6 checks passed
@sjdilkes sjdilkes deleted the Optimisation-level-3 branch November 26, 2024 11:02
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