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

[WIP] Perform BarrierBeforeFinalMeasurements analysis in parallel #13411

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

Conversation

mtreinish
Copy link
Member

Summary

With #13410 removing the non-threadsafe structure from our circuit
representation we're now able to read and iterate over a DAGCircuit from
multiple threads. This commit is the first small piece doing this, it
moves the analysis portion of the BarrierBeforeFinalMeasurements pass to
execute in parallel. The pass checks every node to ensure all it's
decedents are either a measure or a barrier before reaching the end of
the circuit. This commit iterates over all the nodes and does the check
in parallel.

Details and comments

TODO:

OnceLock is a thread-safe version of OnceCell that enables us to use
PackedInstruction from a threaded environment. There is some overhead
associated with this, primarily in memory as the OnceLock is a larger
type than a OnceCell. But the tradeoff is worth it to start leverage
multithreading for circuits.

Fixes Qiskit#13219
With Qiskit#13410 removing the non-threadsafe structure from our circuit
representation we're now able to read and iterate over a DAGCircuit from
multiple threads. This commit is the first small piece doing this, it
moves the analysis portion of the BarrierBeforeFinalMeasurements pass to
execure in parallel. The pass checks every node to ensure all it's
decendents are either a measure or a barrier before reaching the end of
the circuit. This commit iterates over all the nodes and does the check
in parallel.
@mtreinish mtreinish added performance Rust This PR or issue is related to Rust code in the repository labels Nov 8, 2024
@mtreinish mtreinish added this to the 2.0.0 milestone Nov 8, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 11742707517

Details

  • 21 of 25 (84.0%) changed or added relevant lines in 8 files are covered.
  • 5 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.01%) to 88.936%

Changes Missing Coverage Covered Lines Changed/Added Lines %
crates/circuit/src/dag_node.rs 1 2 50.0%
crates/circuit/src/dag_circuit.rs 5 8 62.5%
Files with Coverage Reduction New Missed Lines %
crates/qasm2/src/lex.rs 5 92.73%
Totals Coverage Status
Change from base Build 11740041897: 0.01%
Covered Lines: 79066
Relevant Lines: 88902

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance 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.

2 participants