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

Make Target use interners to store gate names #14040

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

Conversation

raynelfss
Copy link
Contributor

Summary

This PR is built on top of #14039, and should not be merged before it. The following commits aim to add usage of interners for the gate names in the Target.

Details and comments

This PR is built on top of #14039, and should not be merged before it. The Target currently keeps up to 5 copies of the names of every gate instance, this is due to the many mappings present within that still need to keep a connection between the gate name and some other relation or attribute. By using interners, we ensure that we only keep one instance of each gate's name and we use indices to satisfy the correlation later on.

These changes are internal and should not affect how the target is used throughout our infrastructure.

- Fix trait bounds in certain methods of `Interner` to allow use of elements that satisfy the trait bounds of `Equivalent<T>` in `IndexMap`.
@raynelfss raynelfss added on hold Can not fix yet Changelog: None Do not include in changelog labels Mar 17, 2025
@raynelfss raynelfss added this to the 2.1.0 milestone Mar 17, 2025
@raynelfss raynelfss requested a review from a team as a code owner March 17, 2025 18:47
@qiskit-bot
Copy link
Collaborator

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

  • @Qiskit/terra-core

@coveralls
Copy link

coveralls commented Mar 17, 2025

Pull Request Test Coverage Report for Build 13931428842

Details

  • 226 of 300 (75.33%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.05%) to 88.021%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/transpiler/target.py 0 1 0.0%
crates/circuit/src/interner.rs 10 15 66.67%
crates/accelerate/src/target_transpiler/nullable_index_map.rs 12 26 46.15%
crates/accelerate/src/target_transpiler/mod.rs 204 258 79.07%
Totals Coverage Status
Change from base Build 13931261091: -0.05%
Covered Lines: 72733
Relevant Lines: 82631

💛 - Coveralls

@raynelfss raynelfss changed the title Target use interners Make Target use interners to store gate names Mar 17, 2025
- The `Target` usually keeps up to 5 copies of the names of every gate instance, this is due to the many mappings present within that still need to keep a connection betwen the gate name and some other relation or attribute. By using interners, we ensure that we only keep one instance of each gate's name and we use indices to satisfy the correlation later on.
- Make the `_gate_name_map` attribute private to rust, use the available api as an alternative.
- These changes are internal and should not affect how the target is used throughout our infrastructure.
@raynelfss raynelfss force-pushed the target-use-interners branch from 00efffa to 1861247 Compare March 18, 2025 19:04
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 on hold Can not fix yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants