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.
Problem Statement
The
fuse-single-qubit-unitary-runs(#1672) pass currently composes concreteEigenmatrices, so it can only fuse gates whose unitary matrix is known at compile time (see the note inmlir/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:
arithops, analogous to how the quaternion-basedmerge-single-qubit-rotation-gatespass already merges rotation runs over symbolic values.atan2/argfor angle extraction), either by emitting those asmath/`arith´ ops or by restricting symbolic fusion to gate families with a closed-form symbolic merge.