Proposal: Hardware-Aware Distance Sorting Pass for Commuting QAOA Interactions
What should we add?
Hi Qiskit team,
I am a 16-year-old self-taught programmer. I recently transitioned from game dev (Luau) to Python (studying 4-5 hours a day) and I am currently grinding through linear algebra. My long-term goal is to contribute to pushing quantum computing into the FTQC era, which is why I started digging into how Qiskit handles routing.
While experimenting with compiling dense QAOA circuits on Heavy-Hex topologies, I noticed that when commuting $ZZ$-interactions are passed in a random order, the SABRE router experiences a combinatorial explosion. On larger scales (12-16 qubits), it injects a significant amount of extra SWAP gates.
I wrote a heuristic pre-compiler that queries the CouplingMap and sorts these commuting interactions by the shortest physical distance on the hardware before transpilation.
To ensure this wasn't an artifact of a specific seed, I ran a strict benchmark (Wilcoxon signed-rank tests, Holm-Bonferroni correction, multiple random seeds). On 16-qubit dense/all-to-all topologies, this distance-based sorting reduced both the Transpiled CX count and Circuit Depth by ~20% compared to standard optimization_level=3.
All benchmark code, statistical analysis, scaling plots, and a prototype TransformationPass can be found in my repo:
https://github.com/radiumQCO/QAOA-HeavyHex-Routing
My question:
I want to contribute this heuristic (e.g., QAOACommutingDistanceSorter) to Qiskit as a PR. However, since I am entirely self-taught and this is my first time interacting with a major open-source codebase, I lack enterprise architectural experience.
Is this pass something you would consider valuable for the transpiler pipeline? If so, I would appreciate direct architectural guidance on how to properly integrate it within your DAG framework.
(this is my very first time using GitHub for an open-source project, so I hope I set up this issue and my repo correctly).
Looking forward to your feedback.
Source: Qiskit/qiskit