Mapping Circuits to Hardware: Adapting Quantum Algorithms for Physical Architectures

Table of Contents

  1. Introduction
  2. What Is Quantum Circuit Mapping?
  3. Why Mapping Matters for Real Devices
  4. Qubit Connectivity Constraints
  5. Coupling Maps and Hardware Topologies
  6. Gate Fidelity and Error Awareness
  7. Role of SWAP Gates in Mapping
  8. Logical-to-Physical Qubit Assignment
  9. Transpilation for Hardware Execution
  10. Mapping Algorithms and Strategies
  11. Lookahead and Heuristic Approaches
  12. Gate Reordering and Merging
  13. Cost Functions in Mapping
  14. Mapping Tools in Qiskit
  15. Mapping in t|ket> Compiler
  16. Native Gate Sets and Instruction Sets
  17. Real Hardware Examples (IBM, Rigetti, IonQ)
  18. Performance Implications of Mapping
  19. Visualizing Mapped Circuits
  20. Conclusion

1. Introduction

Mapping is the process of converting an ideal quantum circuit into a form that can be run on a specific piece of quantum hardware, considering its physical constraints.

2. What Is Quantum Circuit Mapping?

It’s the transformation of a circuit’s abstract layout into an executable version with gate scheduling, connectivity, and instruction set adapted to the target hardware.

3. Why Mapping Matters for Real Devices

  • Real qubits are limited in connectivity
  • Gate fidelities vary by location
  • SWAP operations introduce noise and delay

4. Qubit Connectivity Constraints

Most devices restrict 2-qubit operations to specific qubit pairs. For example, IBM Q uses coupling maps:

backend.configuration().coupling_map

5. Coupling Maps and Hardware Topologies

A coupling map defines which physical qubits can be entangled directly. Topologies include:

  • Linear (IonQ)
  • Grid (IBM)
  • Full (simulators)

6. Gate Fidelity and Error Awareness

Each gate has an associated fidelity. Mapping can prioritize routes with lower error.

7. Role of SWAP Gates in Mapping

SWAP gates move logical qubit states across the physical architecture to satisfy connectivity.

8. Logical-to-Physical Qubit Assignment

Initial layout maps circuit qubits to physical hardware qubits:

transpile(circuit, backend, initial_layout=[0, 1, 2])

9. Transpilation for Hardware Execution

Qiskit uses a transpiler:

from qiskit import transpile
transpiled = transpile(circuit, backend, optimization_level=3)

10. Mapping Algorithms and Strategies

Common methods:

  • SABRE (swap-based heuristic)
  • Dense subgraph mapping
  • Lookahead-based mapping

11. Lookahead and Heuristic Approaches

These balance gate commutativity and SWAP cost:

  • Optimize future circuit segments
  • Prioritize high-fidelity links

12. Gate Reordering and Merging

Reorder or fuse gates to reduce depth and SWAPs:

  • CX + CX = I (cancellation)
  • Merge single-qubit rotations

13. Cost Functions in Mapping

Metrics used to evaluate mapping:

  • Depth
  • Gate count
  • Total SWAPs
  • Estimated fidelity

14. Mapping Tools in Qiskit

Use pass managers and analysis tools:

from qiskit.transpiler import PassManager

15. Mapping in t|ket> Compiler

t|ket> provides advanced mapping passes:

  • PlacementPass
  • RoutingPass
  • RebaseToNativeGates

16. Native Gate Sets and Instruction Sets

Each device has a native set of gates (e.g., U3, CX). Mapping must rebase to this set.

17. Real Hardware Examples (IBM, Rigetti, IonQ)

  • IBM: 1D/2D grid with U/CX gates
  • Rigetti: Aspen topology
  • IonQ: all-to-all, but slow 2-qubit gates

18. Performance Implications of Mapping

Poor mapping = more SWAPs = more errors. Optimized mapping = shallower circuits = higher success rates.

19. Visualizing Mapped Circuits

Qiskit:

transpiled.draw('mpl')

Circuit depth and fidelity comparison pre/post mapping.

20. Conclusion

Mapping quantum circuits to hardware is a vital part of the compilation process. By optimizing qubit layout, reducing SWAPs, and targeting native gates, developers can ensure efficient and successful execution of quantum programs on real devices.