Skip to content

✨ Add canonicalization pattern for DCX inverse cancellation in QCO dialect #1393

@burgholzer

Description

@burgholzer

Description

Add a canonicalization pattern to eliminate redundant DCX operations in the QCO dialect. A DCX operation followed by a DCX operation with swapped targets is equivalent to the identity and can be removed.

Background

The DCX (double-controlled-X) gate's inverse is the DCX gate with swapped targets. This means:

  • DCX(q0, q1) followed by DCX(q1, q0) cancels out

Proposed Solution

Implement a canonicalization pattern similar to the existing patterns for SWAP and ECR operations that:

  1. Detects consecutive DCX operations with swapped targets
  2. Removes both operations by replacing with pass-through qubits

References

Implementation Location

The pattern should be added in mlir/lib/Dialect/QCO/IR/Operations/StandardGates/DCXOp.cpp and hasCanonicalizer = 1 should be added to DCXOp in mlir/include/mlir/Dialect/QCO/IR/QCOOps.td.
Labels: enhancement, MLIR
Assignee: burgholzer

Metadata

Metadata

Assignees

No one assigned

    Labels

    MLIRAnything related to MLIRenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions