Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve synthesis of controlled circuits with controlled gates within #13566

Open
alexanderivrii opened this issue Dec 16, 2024 · 0 comments
Open
Assignees
Labels
mod: transpiler Issues and PRs related to Transpiler type: feature request New feature or request
Milestone

Comments

@alexanderivrii
Copy link
Contributor

What should we add?

Consider the following example (inspired by https://arxiv.org/pdf/2412.07372):

inner = QuantumCircuit(5)
inner.append(MCXGate(4), [0, 1, 2, 3, 4])
controlled_inner_gate = inner.to_gate().control(2)
qc1 = QuantumCircuit(15)
qc1.append(controlled_inner_gate, [0, 1, 2, 3, 4, 5, 6])
qct1 = transpile(qc1, basis_gates=["cx", "u"])
print(qct1.count_ops())

qc2 = QuantumCircuit(15)
qc2.append(MCXGate(6), [0, 1, 2, 3, 4, 5, 6])
qct2 = transpile(qc2, basis_gates=["cx", "u"])
print(qct2.count_ops())

Conceptually, both qc1 and qc2 are exactly the same, each containing a single MCX gate with 6 control qubits. However, the output is very different: for qc1 we have OrderedDict({'u': 1272, 'cx': 1142}), and for qc2 we have OrderedDict({'u': 40, 'cx': 30}). The reason is that for qc2 we directly synthesis the controlled-MCX gate over 6 qubits and internally use the synthesis algorithm that uses available idle qubits. On the other hand, for qc1, we first synthesize the MCX gate over 4 qubits, obtain a decomposition, control each gate with two controls, and decompose each of these controlled gates.

We should either improve the synthesis of controlled/annotated gates directly, or do a reduction inside the OptimizeAnnotated pass and include the latter in the transpiler flow.

@alexanderivrii alexanderivrii added the type: feature request New feature or request label Dec 16, 2024
@alexanderivrii alexanderivrii added this to the 2.0.0 milestone Dec 16, 2024
@ShellyGarion ShellyGarion added the mod: transpiler Issues and PRs related to Transpiler label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mod: transpiler Issues and PRs related to Transpiler type: feature request New feature or request
Projects
Status: To do
Development

No branches or pull requests

3 participants