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

Convert additional bit_indices to dag.find_bit in transpiler passes #10463

Merged
merged 6 commits into from
Jul 24, 2023

Conversation

enavarro51
Copy link
Contributor

@enavarro51 enavarro51 commented Jul 21, 2023

Summary

Adds further use of dag.find_bit in transpiler passes.

Details and comments

As a follow-up to #10128, this PR removes more of the bit_indices list comprehensions in 9 addtional modules and replaces them with dag.find_bit. There are 9 modules listed below that still do the bit_indices creation that could not be changed to use dag.find_bit. These fall into 2 categories.

These create the bit_indices and then pass them to a function that creates a modified inner map and then recurses.

qiskit/transpiler/passes/layout/sabre_layout.py
qiskit/transpiler/passes/basis/basis_translator.py
qiskit/transpiler/passes/utils/check_map.py
qiskit/transpiler/passes/utils/gates_basis.py
qiskit/transpiler/passes/utils/merge_adjacent_barriers.py
qiskit/transpiler/passes/utils/check_gate_direction.py
qiskit/transpiler/passes/utils/gate_direction.py

The second group passes the bit_indices to dag.replace_block_with_op which uses blocks of DAGOpNodes instead of a dag.

qiskit/transpiler/passes/layout/disjoint_utils.py
qiskit/transpiler/passes/routing/commuting_2q_gate_routing/pauli_2q_evolution_commutation.py

Also collapse_to_operation in qiskit/dagcircuit/collect_blocks.py could be changed, but there are tests that call it using DAGDependency, which does not currently have a find_bit.

@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

  • @enavarro51
  • @ElePT
  • @Qiskit/terra-core
  • @nkanazawa1989
  • @woodsp-ibm

@coveralls
Copy link

coveralls commented Jul 21, 2023

Pull Request Test Coverage Report for Build 5625126386

  • 20 of 41 (48.78%) changed or added relevant lines in 11 files are covered.
  • 9 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.01%) to 85.915%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/transpiler/passes/routing/algorithms/bip_model.py 0 2 0.0%
qiskit/visualization/dag_visualization.py 0 6 0.0%
qiskit/transpiler/passes/optimization/crosstalk_adaptive_schedule.py 0 13 0.0%
Files with Coverage Reduction New Missed Lines %
qiskit/transpiler/passes/optimization/crosstalk_adaptive_schedule.py 1 9.75%
crates/qasm2/src/lex.rs 8 90.89%
Totals Coverage Status
Change from base Build 5624176389: 0.01%
Covered Lines: 72864
Relevant Lines: 84809

💛 - Coveralls

Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the tidy-up, Ed - this looks neat and straightforward.

@jakelishman jakelishman added stable backport potential The bug might be minimal and/or import enough to be port to stable Changelog: None Do not include in changelog labels Jul 24, 2023
@jakelishman jakelishman added this to the 0.25.0 milestone Jul 24, 2023
@jakelishman jakelishman added this pull request to the merge queue Jul 24, 2023
Merged via the queue into Qiskit:main with commit d02a254 Jul 24, 2023
14 checks passed
mergify bot pushed a commit that referenced this pull request Jul 24, 2023
…10463)

* Use dag find_bit in additional places

* Fix dag viz

* Lint

* More lint and cleanup

(cherry picked from commit d02a254)
@jakelishman jakelishman added the mod: transpiler Issues and PRs related to Transpiler label Jul 24, 2023
github-merge-queue bot pushed a commit that referenced this pull request Jul 24, 2023
…10463) (#10481)

* Use dag find_bit in additional places

* Fix dag viz

* Lint

* More lint and cleanup

(cherry picked from commit d02a254)

Co-authored-by: Edwin Navarro <enavarro@comcast.net>
to24toro pushed a commit to to24toro/qiskit-terra that referenced this pull request Aug 3, 2023
…iskit#10463)

* Use dag find_bit in additional places

* Fix dag viz

* Lint

* More lint and cleanup
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 mod: transpiler Issues and PRs related to Transpiler stable backport potential The bug might be minimal and/or import enough to be port to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants