|
Ran
|
Jobs
1
|
Files
950
|
Run time
3min
|
Badge
README BADGES
|
push
github
Fix deadlock in Optimize1qGatesDecomposition (#16592) (#16645) * Fix deadlock in Optimize1qGatesDecomposition This commit fixes an oversight in the new multithreaded Optimize1qGatesDecomposition pass introduced in #15667 that could cause a deadlock with the Python GIL when using custom 1q gates. If there are custom gates defined in Python then we need Python to get the matrix of that custom gate. However, when running in a multithreaded context Python only allows one thread to interact with the interpreter at a time via the GIL. When operating in parallel the pass was not releasing the GIL from the parent thread running the pass. This meant that the children threads would wait to acquire the GIL to call Python but never be able to get the lock because the parent thread that spawned it never released the GIL. This commit fixes that issue by adding a dedicate entrypoint for calling the pass via Python and having that entrypoint release the GIL prior to launching an parallel threads. It then reacquires the GIL before modifying the output DAG which might need Python for working with the custom gates. This mirrors the pattern used in the other parallel passes that work in a similar way such as `UnitarySynthesis` and `TwoQubitPeepholeOptimization`. Fixes #16591 * Fix clippy warning (cherry picked from commit 2440bbb99) Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
58 of 71 new or added lines in 1 file covered. (81.69%)
27 existing lines in 5 files now uncovered.112826 of 128764 relevant lines covered (87.62%)
995464.79 hits per line
| Lines | Coverage | ∆ | File |
|---|---|---|---|
| 13 |
74.65
|
-1.4% | crates/transpiler/src/passes/optimize_1q_gates_decomposition.rs |
| Lines | Coverage | ∆ | File |
|---|---|---|---|
| 8 |
74.02
|
-0.29% | crates/circuit/src/parameter/symbol_expr.rs |
| 7 |
91.26
|
-1.29% | crates/qasm2/src/lex.rs |
| 6 |
97.63
|
0.47% | crates/qasm2/src/parse.rs |
| 5 |
74.65
|
-1.4% | crates/transpiler/src/passes/optimize_1q_gates_decomposition.rs |
| 1 |
90.36
|
0.0% | crates/circuit/src/parameter/parameter_expression.rs |
| ID | Job ID | Ran | Files | Coverage | |
|---|---|---|---|---|---|
| 1 | 30016770968.1 | 950 |
87.62
|
GitHub Action Run |
| Coverage | ∆ | File | Lines | Relevant | Covered | Missed | Hits/Line |
|---|