You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove condition/c_if, duration, and unit from instructions (#13506)
* 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]>
0 commit comments