-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 v1 primitive implementations #13877
Open
mtreinish
wants to merge
7
commits into
Qiskit:main
Choose a base branch
from
mtreinish:remove-deprecated-primitives-impl
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Remove v1 primitive implementations #13877
mtreinish
wants to merge
7
commits into
Qiskit:main
from
mtreinish:remove-deprecated-primitives-impl
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit removes the deprecated implementation of the v1 primitives interface. These were deprecated in the 1.2 release and have been superseded by the implementation of the v2 primtives interface.
One or more of the following people are relevant to this code:
|
5 tasks
mtreinish
added a commit
to mtreinish/qiskit-core
that referenced
this pull request
Feb 24, 2025
Two primitives tests were returning incorrect results after being rewritten to use IfElseOp instead of c_if. This is likely pointing to a bug in the primitive implementation or an aer bug. But since those classes are deprecated and the tests will be removed as part of the larger backend v1 primitive implementation removal in Qiskit#13877 anyway this commit opts to just delete these tests now.
Pull Request Test Coverage Report for Build 13549367482Details
💛 - Coveralls |
github-merge-queue bot
pushed a commit
that referenced
this pull request
Feb 24, 2025
* Remove condition/c_if, duration, and unit from instructions 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. * Update random_circuit * Update more tests * Fix new scheduling pass implementation * Fix clippy::redundant_closure * Add release note for new args * Remove unused ExtraAttributes struct * Remove unused propagate_condition argument * Update legacy scheduling pass * Remove AlignMeasures which was deprecated and can not work without per gate duration * Fix lint * Remove deleted pass from init modules * Update qasm2 import to use IfElse instead of c_if * Use if_test instead of c_if for backwards compat qpy tests * Update more tests * More test updates * Fix handling of lack of dt * More test upgrades * Update more tests * Fix DAGCircuit::compose() panic * Fix more tests * Fix lint * Fix clippy * Fix MARS pass tests * Fix timeline drawer core * Update last c_if usage in tests * Adjust qpy tests to use c_if in old versions * Fix typo in qpy backwards compat test changes * Fix register capture test * Fix the worst test to debug in the world * Update release notes * Fix qpy hard failures The tests fail because of a circuit equality issue, form experience it's differing bit lists in the if state blocks. * Fix rust tests * Fix rust tests * Fix scheduled circuit tests * Fix lint * Remove visual tests that are no longer valid * More test fixes * Time unit conversion only applies to delay now With the removal of per instruction durations the time unit conversion pass only should work with delays, because all the instructions have fixed unit durations in the target (seconds). * Fix lint * Update reference images with removed c_if * Try to fix equality failure in qpy tests * Fix small oversight in qpy tests * More qpy test tweaks * Add missing arg to qpy tests * Remove c_if references in docs * Remove unused imports * Update docs * Add target to legacy dd pass docs * Restore propagate_condition arg for compatibility * More docs updates * Add back test lift legacy condition * Remove unnecessary controlflow builder method * Code simplification * Add warning to qpy load about condition in payload becoming if_else * Remove unused import * Apply suggestions from code review Co-authored-by: Elena Peña Tapia <[email protected]> * Handle delay duration in legacy scheduler * Document no control-flow basic simulator * Apply suggestions from code review Co-authored-by: Elena Peña Tapia <[email protected]> * Fix errant commas * Remove dead condition check * Clarify reason for exception suppression * Simplify time-unit conversions * Restore overly eager test removal from test_circuit_operations * Restore dag dep drawer test * Restore text drawer tests * Restore removed tests in test_circuit_drawer * Control fold in restored test for variable terminal width in CI * Remove bugged tests in backend v1 primitives implementation Two primitives tests were returning incorrect results after being rewritten to use IfElseOp instead of c_if. This is likely pointing to a bug in the primitive implementation or an aer bug. But since those classes are deprecated and the tests will be removed as part of the larger backend v1 primitive implementation removal in #13877 anyway this commit opts to just delete these tests now. --------- Co-authored-by: Elena Peña Tapia <[email protected]> Co-authored-by: Jake Lishman <[email protected]>
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
mod: primitives
Related to the Primitives module
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This commit removes the deprecated implementation of the v1 primitives interface. These were deprecated in the 1.2 release and have been superseded by the implementation of the v2 primtives interface.
Details and comments