Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Oxidize
UnitarySynthesis
pass (#13141)
* Inital attempt at oxidizing unitary synthesis. * Add cacache pygates feature to accelerate * Use sabre target to speed up preferred_direction * Adapt code to changes in PackedInstruction * Use target in preferred_direction * Some cleanup * More cleanup * Apply inline suggestions from Matt's code review Co-authored-by: Matthew Treinish <[email protected]> * Apply remaining review suggestions: * Fix details after applying inline suggestions * Keep TwoQubitWeilDecomposition attributes private. Add getter. * Initialize new_blocks using size hint * Remove basis_set as it's not used if there is a target. * Use ref_qubits ([PhysicalQubit; 2]) instead of wire_map (IndexMap<Qubit, Physicalqubit>) * Define static GOODBYE_SET as suggested * Use ImportOnceCell for XXDecomposer and XXEmbodiments to avoid importing in a loop. * Set preferred_direction without making it mutable. * Fix check_goodbye * Privatize assets * Use the add_global_phase method instead of the private function. * Add qs_decomposition to imports * Simplify flip_bits * Use NormalOperation to pass around decomposer gate and params info * First attempt at attaching synth circuits directly * Second attempt at attaching synth circuits directly * Use edge set for coupling map * Avoid exposing internals from NullableIndexMap * Use unitary_to_gate_sequence_inner instead of optimize_1q_gates_decomposition. * Use concat! in long error message. * Use dag.apply_operation_back in 1q case. Additional cleanup. * Don't return ref to float in two qubit decomposer. * Use PyList as input type for coupling_edges (previous approach was innefficient) * Avoid using UnitarySynthesisReturn type, avoid intermediate dag creation in all cases except XXDecomposer. * Refactor appending to out_dag, remove unnecesary clones. * Cosmetic changes. Reduce indentation. * Squash bug * Fix clippy * Add qsd test * Avoid making unnecessary variables public * Use OperationRef instead of exposing discriminant * Rename DAGCircuit::substitue_node to py_substitute_node Co-authored-by: Raynel Sanchez <[email protected]> * Restore name in Python world * Rewrite using flatten Co-authored-by: Raynel Sanchez <[email protected]> * Apply suggestions from Ray's code review Co-authored-by: Raynel Sanchez <[email protected]> * Adjust suggestions from code review. Apply remaining feedback: * Use circuit_to_dag from crates/circuit/converters.rs * Simplify iteration over coupling edges * Replace cumbersome call_method_bound with call_bound * Apply ownership suggestion from Ray Co-authored-by: Raynel Sanchez <[email protected]> * Finish applying ownership suggestion from Ray * Changes to synth_error function: remove error that wasn't handled, deal with new panic calling operation_from_name * Undo flatten * Fix style * Add getters and setters for TwoQubitGateSequence, expose new, keep struct attributes private. * Apply Ray's suggestion to use unwrap_operation Co-authored-by: Raynel Sanchez <[email protected]> * Use ExtraInstructionAttributes::default() * Apply suggestion to avoid intermediate collection * Use target::contains_key * Apply suggestion to use iter() instead of keys() Co-authored-by: Raynel Sanchez <[email protected]> * Final touches * Final touches * Replace panics with unreachable * Format * Apply suggestions from Matt's code review Co-authored-by: Matthew Treinish <[email protected]> * Fix suggestions from Matt's code review * Apply remaining suggestions * Apply final suggestions from code review * Lint: Use `unwrap_or_default()`. --------- Co-authored-by: Matthew Treinish <[email protected]> Co-authored-by: Raynel Sanchez <[email protected]>
- Loading branch information