Skip to content

Commit b703b84

Browse files
Merge branch 'main' into fix-for-loop-negative-indexset
2 parents e33da38 + 252ad7b commit b703b84

4 files changed

Lines changed: 22 additions & 10 deletions

File tree

.mergify.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ pull_request_rules:
77
backport:
88
branches:
99
- stable/2.5
10+
11+
merge_queue:
12+
# Disallow Mergify from posting an "add this to the queue?" comment.
13+
# We don't use the Mergify queue at all, only the GitHub-native one.
14+
queue_controls_comment: false

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/transpiler/src/target/mod.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,12 @@ pub struct Target {
233233
pub concurrent_measurements: Option<Vec<Vec<PhysicalQubit>>>,
234234
gate_map: IndexMap<String, TargetProperties>,
235235
global_operations: HashMap<u32, HashSet<String>>,
236-
qarg_gate_map: HashMap<Qargs, HashSet<String>>,
236+
// This uses `IndexMap` not because it's necessary for determinism (though it will help), but so
237+
// it retains the specific iteration order it is constructed with. The order `qargs` are
238+
// encountered during construction are _usually_ going to be quite structured, and structure
239+
// here means that graphs built from qargs (like the coupling graph) will have their edges
240+
// ordered in much cache- and branch-prediction-friendlier orders than if they are randomised.
241+
qarg_gate_map: IndexMap<Qargs, HashSet<String>>,
237242
has_angle_bounds: bool,
238243
}
239244

@@ -326,7 +331,7 @@ impl Target {
326331
concurrent_measurements,
327332
gate_map: IndexMap::default(),
328333
global_operations: HashMap::default(),
329-
qarg_gate_map: HashMap::default(),
334+
qarg_gate_map: IndexMap::default(),
330335
has_angle_bounds: false,
331336
})
332337
}
@@ -847,10 +852,7 @@ impl Target {
847852
);
848853
}
849854
self.gate_map = gate_map;
850-
self.qarg_gate_map = state
851-
.get_item("qarg_gate_map")?
852-
.unwrap()
853-
.extract::<HashMap<Qargs, HashSet<String>>>()?;
855+
self.qarg_gate_map = state.get_item("qarg_gate_map")?.unwrap().extract()?;
854856
self.global_operations = state
855857
.get_item("global_operations")?
856858
.unwrap()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
performance:
3+
- |
4+
Fixed a performance regression only in v2.5.0rc1 when running :class:`.VF2Layout` and
5+
:class:`.VF2PostLayout` on large coupling maps with very high-degree connectivity.

0 commit comments

Comments
 (0)