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

Add CustomPassMap #1778

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Add CustomPassMap #1778

wants to merge 9 commits into from

Conversation

sjdilkes
Copy link
Contributor

@sjdilkes sjdilkes commented Feb 21, 2025

Description

CompilationUnit has a maps attribute that is used to store relabelling of qubits and implicit permutations of qubits caused by the application of PassPtr. CustomPass allows users to write python level transformations on pytket Circuit objects and wrap them into PassPtr objects that can be applied within the CompilationUnit framework. However, CustomPass does not allow the user to update the maps attribute, while transformations on pytket Circuit can make changes that should be updated in the maps attribute.

As an example, the LightSABREPass CustomPass used in pytket-qiskit will relabel and permute qubits, but won't update the maps attribute. This is not an issue if the routed circuit is being used for shot based execution, as Bit will correspond to the same logical qubits, but is an issue if it's being used for unitary synthesis.

This PR adds a new PassPtr generator CustomPassMap, which is similar to CustomPass, except the required Transformation object also must return updated maps objects corresponding to relabelling and permutation changes.

Related issues

Please mention any github issues addressed by this PR.

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.

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.

1 participant