mirror-gates
mirror-decomposition integrated routing for algorithm gate efficiency
Science Score: 75.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 2 DOI reference(s) in README -
✓Academic publication links
Links to: arxiv.org, zenodo.org -
○Academic email domains
-
✓Institutional organization owner
Organization pitt-joneslab has institutional domain (sites.pitt.edu) -
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.3%) to scientific vocabulary
Keywords
Repository
mirror-decomposition integrated routing for algorithm gate efficiency
Basic Info
Statistics
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 3
- Releases: 4
Topics
Metadata Files
README.md
MIRAGE
Quantum Circuit Decomposition and Routing Collaborative Design using Mirror Gates
📌 Project Overview
- Objective: Optimize quantum transpilation by unifying the layout and routing stages with gate decomposition.
- Strategy: Employ the mirror gate of $\texttt{U}$, represented as $\texttt{U} \cdot \texttt{SWAP}$, to achieve more cost-efficient routing without altering decomposition costs. In certain cases, it can even reduce decomposition expenses.
🌟 Key Features
- Mirage Algorithm: Defined in
src/mirror_gates/mirage.py
📊 Results & Comparisons
- Experiments: Detailed in
src/notebooks/results - Findings: Our methodology considerably reduces circuit depth and swap count when compared with conventional techniques across multiple topologies.
🚀 Getting Started
To use as a standalone transpiler plugin, install using
pip install -e git+https://github.com/Pitt-JonesLab/mirror-gates#egg=mirror-gates[core]
Then get started by exploring the main demo located at src/mirror_gates/notebooks/bench.ipynb.
💻🐒 Usage
python
from qiskit.transpiler import CouplingMap
coupling_map = CouplingMap.from_grid(6, 6)
1. Use as a Qiskit-Plugin
Integrate MIRAGE into your existing transpilation pipeline:
python
from qiskit import transpile
mirage_qc = transpile(
qc, # input circuit
optimization_level = 3, # default: Qiskit's highest level
coupling_map=coupling_map,
basis_gates= ["u", "xx_plus_yy", "id"],
routing_method="mirage",
layout_method="sabre_layout_v2",
)
2. Use Mirage as a complete pass manager.
Handles all pre-, post-processing stages described in our paper:
python
from mirror_gates.pass_managers import Mirage
mirage = Mirage(
coupling_map, # coupling map
name="Mirage-$\sqrt{\texttt{iSWAP}}$", # transpile_benchy and figure labels)
parallel=True, # run trials in parallel or serial
cx_basis=False, # turning on sets CNOT as the basis gate,
# (can take arbitrary basis but parameters are not configured that way yet)
cost_function="depth", # switch to "basic" for counting SWAPs
fixed_aggression=None, # force aggression level on all iterations
layout_trials=None, # how many independent layout trials to run (20)
fb_iters=None, # how many forward-backward iterations to run (4)
swap_trials=None, # how many independent routing trials to run (20)
no_vf2=False, # keep False to use VF2 for finding complete layouts
logger=None, # from logging moduel
)
mirage_qc = mirage.run(circuit=qc)
[!WARNING]
[!WARNING]
In the current version of Qiskit, there's no direct support for ( \sqrt{iSWAP} ) as a basis gate. As a workaround, I've been using XX+YY, which provides a partial solution but isn't fully optimized.
However, there's an ongoing pull request in Qiskit that introduces a new gate, SiSwapGate, which represents ( \sqrt{iSWAP} ). This PR also brings in optimized decomposition methods for the gate. I've previously implemented a similar logic, but the PR suggests there might have been some inaccuracies in the paper I referenced.
To benefit from the advancements in the PR, I'm temporarily using a fork of the PR in this project. By leveraging the fork, when you use the SiSwapGate, you'll notice a more efficient decomposition compared to the XX+YY workaround.
Please note that this is a provisional solution. I'll transition back to the main Qiskit repository once the PR is merged and the SiSwapGate with its decomposition methods becomes officially available.
📋 Prerequisites
Monodromy Dependency: This needs lrs. To install:
sudo apt install lrslib
Package Dependencies: By default, two other packages are dependencies:
- transpile_benchy: Manages circuit benchmarks, data analytics, and plotting.
- monodromy (fork): modified for Qiskit AnalysisPass integration.
⚠️ Setup: Running
make initsets up the required environment and tools. It also clones required repositories.- Optional: If you want to leverage the additional features from transpilebenchy, especially its submodules for circuit benchmarking, run
make dev-init. This will clone and set up transpilebenchy with its complete functionalities.
- Optional: If you want to leverage the additional features from transpilebenchy, especially its submodules for circuit benchmarking, run
Dive Deeper into the Code 💻🐒
- Please report any issues. (Currently the most unstable part is related to the parallel processing. 😺)
- The main logic of the MIRAGE pass is in
src/mirror_gates/mirage.pywhich includesParallelMirage, and the classMirage, a subclass ofqiskit.transpiler.passes.SabreSwapto handle serial passes. - The main pass manager is defined in
src/mirror_gates/pass_managers.py. - Circuit benchmarks are defined as
.txtfiles insrc/mirror_gates/circuits/. These are loaded into atranspile_benchy.Libraryobject. - For more details, see code documentation or contact me.
Additional utility commands available in the Makefile:
- make format: Formats the codebase.
- make clean: Cleans up temporary and unnecessary files.
- make test: Runs tests to ensure code functionality.
- For more information about the repository structure, visit my python-template.
📚 Reference
bibtex
@article{McKinney_MIRAGE_Quantum_Circuit_2023,
author = {McKinney, Evan and Hatridge, Michael and Jones, Alex K},
doi = {10.48550/arXiv.2308.03874},
journal = {arXiv preprint arXiv:2308.03874},
title = {{MIRAGE: Quantum Circuit Decomposition and Routing Collaborative Design using Mirror Gates}},
year = {2023}
}
Owner
- Name: Research Artifacts of Alex K Jones' Lab - University of Pittsburgh
- Login: Pitt-JonesLab
- Kind: organization
- Location: United States of America
- Website: https://sites.pitt.edu/~akjones
- Repositories: 2
- Profile: https://github.com/Pitt-JonesLab
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: McKinney
given-names: Evan
orcid: https://orcid.org/0000-0002-4865-5458
title: "mirror-gates"
version: 0.2.0
date-released: 2023-08-07
url: "https://github.com/Pitt-JonesLab/mirror-gates"
preferred-citation:
type: article
authors:
- family-names: McKinney
given-names: Evan
- family-names: Hatridge
given-names: Michael
- family-names: Jones
given-names: Alex K
doi: 10.48550/arXiv.2308.03874
journal: "arXiv preprint arXiv:2308.03874"
title: "MIRAGE: Quantum Circuit Decomposition and Routing Collaborative Design using Mirror Gates"
year: 2023
GitHub Events
Total
Last Year
Dependencies
- actions/checkout v3 composite
- actions/setup-python v4 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite