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

Fix short circuit detection for basis translator (backport #12899) #12921

Merged
merged 1 commit into from
Aug 8, 2024

Commits on Aug 8, 2024

  1. Fix short circuit detection for basis translator (#12899)

    The BasisTranslator transpiler pass has a check at the very start that
    is designed to return fast if there is nothing to translate; in
    other words if the instructions in the circuit are already a subset of
    instructions supported by the target. This avoid doing a lot of
    unecessary work to determine this later during the operation of the
    pass. However, this check was not correctly constructed because of a
    type mismatch and would only ever get triggered if the input circuit was
    empty. The source basis is collected as a `Set[Tuple[str, int]]` where
    each tuple is the name and num of qubits for each operation in the
    circuit. While the target basis is just a `Set[str]` for the names
    supported on the target. This mismatch caused the subset check to never
    return True unless it was empty thereby bypassing the intent of the
    short circuit path. This commit fixes the logic by constructing a
    temporary set of just the source names to evaluate whether we should
    return early or not.
    
    (cherry picked from commit fa5510c)
    mtreinish authored and mergify[bot] committed Aug 8, 2024
    Configuration menu
    Copy the full SHA
    463cefc View commit details
    Browse the repository at this point in the history