Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CriticalHeuristic to SABRE routing heuristics #13016

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Commits on Aug 22, 2024

  1. feat: Add CriticalHeuristic to SABRE routing heuristics

    This commit introduces a new heuristic, `CriticalHeuristic`, to the SABRE routing algorithm in Qiskit. The `CriticalHeuristic` prioritizes routing decisions based on the criticality of quantum operations, as determined by their descendant count in the circuit's Directed Acyclic Graph (DAG).
    
    ### Changes in heuristic.rs:
    - **CriticalHeuristic Added**:
      - Introduced a new `CriticalHeuristic` struct that ranks quantum gates by the number of descendants they have, assigning a higher priority to gates with more descendants.
      - The `CriticalHeuristic` is implemented with `weight` and `scale` parameters, allowing users to control the heuristic's impact during the routing process.
    
    ### Changes in route.rs:
    - **Descendant Ranking Map**:
      - Added a new `descendants_rank` field in the `RoutingState` struct to store the ranking of nodes based on the number of descendants. This map is populated only when the `CriticalHeuristic` is enabled.
      - Introduced a new method `populate_descendants_rank_map` that calculates and ranks nodes based on their number of descendants, storing the results in the `descendants_rank` map.
    
    - **CriticalHeuristic Integration**:
      - In the `choose_best_swap` method, the `CriticalHeuristic` now evaluates potential swaps by considering how they enable the routing of gates with high descendant rankings. Swaps that allow the routing of more critical operations are favored.
      - The `update_route` method and the main routing loop in `swap_map_trial` have been updated to integrate the `CriticalHeuristic`, ensuring that routing decisions consider the criticality of operations when this heuristic is used.
    
    ### Notes:
    - This enhancement gives users the ability to prioritize critical paths during the routing process, potentially leading to more optimized circuits by reducing the risk of bottlenecks and minimizing overall circuit depth.
    - We may need to rethink the scoring strategy for the `CriticalHeuristic` based on benchmarking results to ensure it performs optimally across different circuit types and sizes.
    henryzou50 committed Aug 22, 2024
    Configuration menu
    Copy the full SHA
    923db3b View commit details
    Browse the repository at this point in the history

Commits on Nov 4, 2024

  1. Configuration menu
    Copy the full SHA
    45be543 View commit details
    Browse the repository at this point in the history