Required prerequisites
Describe the bug
When using qubit mapping pass with a topology that contains isolated qubits, it outputs invalid results.
Steps to reproduce the bug
- Device topology: 10 qubits, only edge {5,6}:
Number of nodes: 10
Number of edges: 1
0 --> {}
1 --> {}
2 --> {}
3 --> {}
4 --> {}
5 --> {}
6 --> {5}
7 --> {}
8 --> {}
9 --> {}
quake.wire_set @wires[2147483647]
func.func @bell() attributes {"cudaq-entrypoint", "cudaq-kernel"} {
%0 = quake.null_wire
%1 = quake.null_wire
%2 = quake.h %0 : (!quake.wire) -> !quake.wire
%3:2 = quake.x [%2] %1 : (!quake.wire, !quake.wire) -> (!quake.wire, !quake.wire)
%m0, %4 = quake.mz %3#0 : (!quake.wire) -> (!quake.measure, !quake.wire)
%m1, %5 = quake.mz %3#1 : (!quake.wire) -> (!quake.measure, !quake.wire)
quake.sink %4 : !quake.wire
quake.sink %5 : !quake.wire
return
}
cudaq-opt --assign-wire-indices '--qubit-mapping=device=file(disconnected.txt)' bell.mlir
The output still maps the Bell pair to physical qubits 0 and 1, even though they are not connected.
Expected behavior
-
We shouldn't allow an invalid mapping to succeed (i.e., gates between disconnected qubits)
-
The mapping pass can find the connected qubit region to map the qubits to.
Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
Environment
- CUDA-Q version:
main
- Python version: 3.11
- C++ compiler: gcc-12
- Operating system: Ubuntu 24.04
Suggestions
No response
Required prerequisites
Describe the bug
When using qubit mapping pass with a topology that contains isolated qubits, it outputs invalid results.
Steps to reproduce the bug
The output still maps the Bell pair to physical qubits 0 and 1, even though they are not connected.
Expected behavior
We shouldn't allow an invalid mapping to succeed (i.e., gates between disconnected qubits)
The mapping pass can find the connected qubit region to map the qubits to.
Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
Environment
mainSuggestions
No response