Skip to content

Add discussion of custom-pass implementation #14787

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jakelishman
Copy link
Member

Summary

This is the beginnings of better documentation around writing custom transpiler passes. Historically, we've somewhat implicitly assumed that people would look at the source code to get a feel for it, but really, this should always have been in guide-level documentation.

This commit adds some guiding information about the expectations of passes. It doesn't currently add worked examples; these should be added at some point.

The primary motivation for this commit was to add the discussion about expectations around determinism of passes, and tips for how to achieve that.

Details and comments

In particular, this commit makes explicit the assumptions that lead to the use of DAGCircuit.structurally_equal, proposed in #14762. The determinism of Qiskit preset pipelines have largely already relied on the behaviours expounded on here, so this is not intended to be new restrictions, but rather an explicit statement of previously unsaid ones.

This is the beginnings of better documentation around writing custom
transpiler passes.  Historically, we've somewhat implicitly assumed that
people would look at the source code to get a feel for it, but *really*,
this should always have been in guide-level documentation.

This commit adds some guiding information about the expectations of
passes.  It doesn't currently add worked examples; these should be added
at some point.

The primary motivation for this commit was to add the discussion about
expectations around determinism of passes, and tips for how to achieve
that.
@jakelishman jakelishman added this to the 2.2.0 milestone Jul 25, 2025
@jakelishman jakelishman requested a review from a team as a code owner July 25, 2025 15:50
@jakelishman jakelishman added documentation Something is not clear or an error documentation Changelog: None Do not include in changelog mod: transpiler Issues and PRs related to Transpiler labels Jul 25, 2025
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@coveralls
Copy link

Pull Request Test Coverage Report for Build 16526126528

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 18 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.02%) to 87.736%

Files with Coverage Reduction New Missed Lines %
crates/circuit/src/symbol_expr.rs 2 73.94%
crates/qasm2/src/lex.rs 4 91.49%
crates/qasm2/src/parse.rs 12 96.62%
Totals Coverage Status
Change from base Build 16508029389: -0.02%
Covered Lines: 81418
Relevant Lines: 92799

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: None Do not include in changelog documentation Something is not clear or an error documentation mod: transpiler Issues and PRs related to Transpiler
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants