Skip to content

collapsing a chain of gates #5775

@ajavadia

Description

@ajavadia

There are a few compiler passes right now related to peephole optimization:

We should unify these into one general pass which is able to walk the circuit and collect+consolidate these gates. This should rely on the DAGDependency graph otherwise it will miss some opportunities when gates commute but are not next to each other. This should also accept a filter function that tells the pass to collect those gates that meet a certain condition (I believe retworkx can already do this). The filter functions could be:

  • gate.num_qubits == 1
  • gate.num_qubits <= 2
  • gate.is_clifford
  • etc.

Also I think we should just combine the collection phase with the consolidation phase. We can call it CollapseChains. I haven't found a use case for collecting a chain of gates but not collapsing them into an equivalent unitary.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions