Skip to content

✨ Fuse single-qubit unitary runs with parametrized (dynamic-angle) gates #1764

Description

@simon1hofmann

Problem Statement

The fuse-single-qubit-unitary-runs (#1672) pass currently composes concrete Eigen matrices, so it can only fuse gates whose unitary matrix is known at compile time (see the note in mlir/include/mlir/Dialect/QCO/Transforms/Passes.td). Any single-qubit gate whose rotation angle is a dynamic SSA Value (e.g. a function argument or a loop-induction-derived parameter) cannot join a run and is left unfused. This means parametrized circuits — an important and not-yet-well-covered case in the community — miss out on single-qubit fusion entirely.

Proposed Solution

Extend the pass to fuse runs containing parametrized gates by composing them symbolically instead of numerically:

  • Build the composed single-qubit operation from SSA Values and emit the resulting angles as arith ops, analogous to how the quaternion-based merge-single-qubit-rotation-gates pass already merges rotation runs over symbolic values.
  • Handle the extra wrinkle that full Euler resynthesis needs more than multiplication (e.g. atan2/arg for angle extraction), either by emitting those as math/`arith´ ops or by restricting symbolic fusion to gate families with a closed-form symbolic merge.
  • Keep the existing constant-matrix fast path; fall back to symbolic composition only when an operand is dynamic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    MLIRAnything related to MLIRenhancementImprovement of existing feature

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions