Closed fdmalone closed 1 year ago
Any idea @tanujkhattar ?
I think I know what's going on. I'll send a fix soon.
Explanation: The root cause of the problem here is that during the interop, we allocate the named qubits that are expected as LEFT registers by the gates using signature.get_cirq_quregs
and also provide a cirq.ops.SimpleQubitManager()
to manage allocations / deallocations of additional qubits. We end up with this bug when the qubit manager we provided tries to deallocate the qubits we allocated separately using signature.get_cirq_quregs
.
Ideally, every qubit allocation / deallocation should be managed by the same qubit manager. So, we should either get rid of signature.get_cirq_quregs()
or find a way to inform our qubit manager to manage these externally allocated qubits so they can be deallocated by the qubit manager when a request comes.
https://github.com/quantumlib/Qualtran/pull/385 adds a InteropQubitManager
which does the latter. We can evolve the functionality of this InteropQubitManager
in subsequent PRs so that it can more natively allocate / deallocate named qubits based on register names and shapes but for now, the fix is sufficient to unblock the interop.
The following code throws an error:
I need to double check when this stopped working, but this code worked prior to the bump in cirq_ft versions.