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

Use OnceLock to cache a NormalOperation in Target #13995

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

raynelfss
Copy link
Contributor

@raynelfss raynelfss commented Mar 11, 2025

Summary

The following commits replace the op_object attribute of NormalOperation with a OnceLock to allow the python version to be either built dynamically or cached from its original source.

Details and comments

As we plan to use PackedOperation to add instructions to a Target in Rust. We should not require having a python instance to exist within. The following commits fix that by ensuring that a python instruction is not required, and if so it can be built based on a PackedOperation's internal data.

This should not have any visible effects on the current implementations, but can be proven to work via the added unit-tests.

- As we plan to use `PackedOperation` to add instructions to a `Target` in Rust. We should not require having a python instance exists within. The following commits fix that by ensuring that a python instruction is not required, and if so it can be built based on a `PackedOperation`'s internal data.
- This should not have any visible effects on the current implementations, but can be proven to work via the added unit-tests.
@raynelfss raynelfss requested a review from a team as a code owner March 11, 2025 18:47
@qiskit-bot
Copy link
Collaborator

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

  • @Qiskit/terra-core

@raynelfss raynelfss changed the title Add: Use OnceLock to cache a NormalOperation in Target Use OnceLock to cache a NormalOperation in Target Mar 11, 2025
@raynelfss raynelfss added Changelog: None Do not include in changelog Rust This PR or issue is related to Rust code in the repository mod: transpiler Issues and PRs related to Transpiler labels Mar 11, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 13795835470

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 10 of 55 (18.18%) changed or added relevant lines in 1 file are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.03%) to 88.101%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/accelerate/src/target_transpiler/mod.rs 10 55 18.18%
Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 3 92.98%
Totals Coverage Status
Change from base Build 13792557824: -0.03%
Covered Lines: 72658
Relevant Lines: 82471

💛 - Coveralls

@raynelfss raynelfss added this to the 2.1.0 milestone Mar 11, 2025
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 Rust This PR or issue is related to Rust code in the repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants