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

Remove deprecated QuantumCircuit.duration and DAGCircuit.duration #13894

Open
wants to merge 81 commits into
base: main
Choose a base branch
from

Conversation

mtreinish
Copy link
Member

Summary

This commit removes the deprecated duration attributes for circuits.
This was deprecated in the 1.3.0 release and replaced by the
QuantumCircuit.estimate_duration() method in 1.4.0.

Details and comments

This commit is based on top of #13506 and is blocked on #13708 and #13662
(as many tests using this functionality are of these deprecated
components)

This commit removes the per instruction attributes for condition,
duration, and unit. These attributes were deprecated in 1.3.0. Besides
the label these attributes were the only mutable state for singleton
instructions and removing them simplifies what needs to be tracked for
instructions in both Python and rust. The associated methods and classes
that were previously dependent on these attributes are also removed as
they no longer serve a purpose. The removal of condition in particular
removes a lot of logic from Qiskit especially from the transpiler
because it was a something that needed to be checked outside of the
normal data model for every operation.

This PR simplifies the representation of this extra mutable state in
Rust by removing the `ExtraInstructionAttributes` struct and replacing
it with a `Option<Box<String>>`. The `Option<Box<String>>` is used
instead of the simpler `Option<String>` because this this reduces the
size of the label field from 24 bytes for `Option<String>` to 8 bytes
for `Option<Box<String>>` with an extra layer of pointer indirection
and a second heap allocation. This will have runtime overhead when
labels are set, but because the vast majority of operations don't set
labels the tradeoff for optimizing for the None case makes more sense.
Another option would have been to use `Box<str>` here which is the
equivalent of `Box<[u8]>` (where `String` is the equivalent to
`Vec<u8>`) and from a runtime memory tradeoff would be a better
choice for this application if labels were commonly used as labels
aren't growable. But that requires 16 bytes instead of 8 and we'd be
wasting an additional 8 bytes for each instruction in the circuit which
isn't worth the cost.
mtreinish and others added 23 commits February 7, 2025 17:11
Co-authored-by: Elena Peña Tapia <[email protected]>
Co-authored-by: Elena Peña Tapia <[email protected]>
This commit removes the deprecated duration attributes for circuits.
This was deprecated in the 1.3.0 release and replaced by the
QuantumCircuit.estimate_duration() method in 1.4.0.

This commit is based on top of Qiskit#13506 and is blocked on Qiskit#13708 and Qiskit#13662
(as many tests using this functionality are of these deprecated
components)
@mtreinish mtreinish added on hold Can not fix yet Changelog: Removal Include in the Removed section of the changelog labels Feb 19, 2025
@mtreinish mtreinish added this to the 2.0.0 milestone Feb 19, 2025
@mtreinish mtreinish requested review from a team and nonhermitian as code owners February 19, 2025 19:18
@qiskit-bot
Copy link
Collaborator

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

  • @enavarro51
  • @Cryoris
  • @Qiskit/terra-core
  • @ajavadia
  • @levbishop
  • @mtreinish
  • @nkanazawa1989
  • @t-imamichi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Removal Include in the Removed section of the changelog on hold Can not fix yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants