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

Support stretchy delays in box #13899

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

Conversation

jakelishman
Copy link
Member

@jakelishman jakelishman commented Feb 20, 2025

Summary

This is currently built on top of a roll-up merge of Kevin's stretchy-delay branch, and just unifies the handling between Delay and Box so that they both support the Expr stuff. There's no need for Rust-space handling for box, because the entirety of the control-flow system isn't handled in Python-space yet.

This might need further modification based on Kevin's work on transpiler support.

This commit will be rebased and amended along with the rest of the stretch patch series.

Details and comments

Built on top of both #13869 and #13853.

This adds in the base `box` control-flow construction, with support for
containing instructions and having a literal delay, like the `Delay`
instruction.

This supports basic output to OpenQASM 3, QPY and some rudimentary
support in the text and mpl drawers.  The transpiler largely handles
things already, since control flow is handled generically in most
places.

Known issues:

- QPY fails to round-trip the `unit` field from an instruction's
  duration.
- We expect this to be able to accept stretches in its duration, just as
  `Delay` can, which will need a follow-up.
- We expect `Box` to support "annotations" in a future release of
  Qiskit.
- There is currently no way in OpenQASM 3 to represent a qubit that is
  idle during a `box` without inserting a magic instruction on it.
- There's no support for import from OpenQASM 3 for `box` yet - that
  happens in different package (`qiskit-qasm3-import`) right now.
- IBM backends don't claim support for `box` yet, so `transpile` against
  a backend will fail, though you can modify the `Target` to add the
  instruction manually.
This is currently built on top of a roll-up merge of Kevin's
`stretchy-delay` branch, and just unifies the handling between `Delay`
and `Box` so that they both support the `Expr` stuff.  There's no need
for Rust-space handling for `box`, because the entirety of the
control-flow system isn't handled in Python-space yet.

This might need further modification based on Kevin's work on transpiler
support.

This commit will be rebased and amended along with the rest of the
`stretch` patch series.
@jakelishman jakelishman added Changelog: New Feature Include in the "Added" section of the changelog mod: transpiler Issues and PRs related to Transpiler mod: circuit Related to the core of the `QuantumCircuit` class or the circuit library labels Feb 20, 2025
@jakelishman jakelishman added this to the 2.0.0 milestone Feb 20, 2025
@jakelishman jakelishman added the on hold Can not fix yet label Feb 20, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 13442238275

Details

  • 1111 of 1522 (73.0%) changed or added relevant lines in 36 files are covered.
  • 199 unchanged lines in 16 files lost coverage.
  • Overall coverage decreased (-0.1%) to 87.994%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/dagcircuit/dagnode.py 1 2 50.0%
qiskit/visualization/circuit/text.py 4 5 80.0%
qiskit/circuit/classical/types/types.py 37 39 94.87%
qiskit/qasm3/ast.py 17 19 89.47%
qiskit/circuit/delay.py 17 20 85.0%
qiskit/qpy/binary_io/circuits.py 5 8 62.5%
crates/circuit/src/dag_circuit.rs 1 5 20.0%
qiskit/circuit/quantumcircuit.py 43 49 87.76%
qiskit/visualization/circuit/matplotlib.py 0 6 0.0%
crates/circuit/src/duration.rs 6 14 42.86%
Files with Coverage Reduction New Missed Lines %
qiskit/qpy/type_keys.py 1 81.84%
qiskit/transpiler/passmanager_config.py 1 98.55%
qiskit/transpiler/passes/layout/dense_layout.py 3 96.34%
crates/qasm2/src/lex.rs 4 92.48%
qiskit/transpiler/passes/layout/vf2_utils.py 4 97.22%
qiskit/circuit/quantumcircuit.py 5 93.4%
qiskit/compiler/transpiler.py 7 92.93%
qiskit/transpiler/passes/scheduling/time_unit_conversion.py 7 74.64%
qiskit/transpiler/preset_passmanagers/generate_preset_pass_manager.py 7 95.93%
qiskit/qpy/binary_io/value.py 10 86.37%
Totals Coverage Status
Change from base Build 13441968406: -0.1%
Covered Lines: 78717
Relevant Lines: 89457

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog mod: circuit Related to the core of the `QuantumCircuit` class or the circuit library mod: transpiler Issues and PRs related to Transpiler on hold Can not fix yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants