-
Notifications
You must be signed in to change notification settings - Fork 26
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
🐛 Missmatches in current implmentation to publication #256
Comments
Thanks for opening this issue. I'll try to look into it in more detail over the next couple of days. Could you provide me with a little more context on the difference in results you are seeing? |
I checked against the original publication, and I find the following differences based on the benchmarks shown on the publication. 3_17_13.qasm: 59 vs. 60 I currently see no reason to argue that the results in the publication are not correct. Maybe there is a bug in the permutation function that SWAPs some qubits even though that is not necessary for physical connectivity reasons? |
Thanks for the details. Now that I see the numbers, I think I remember the cause for the difference. In the paper, the coupling map for the IBM QX4 device shown in Figure 2 is:
whereas
Note the reversed direction of the last edge of the coupling map. The results in the paper were generated based on the coupling map shown in the paper. This can also be seen in the original code repository at https://github.com/iic-jku/minimal_ibm_qx_mapping/blob/e41de077a1c1096be74a9bcdd9ced35228bd69d5/minimal_ibm_qx_mapping/main.cpp#L79-L86. If you are using the Python interface of QMAP, using the old Architecture is as easy as from mqt import qmap
circ = ...
arch = qmap.Architecture(
5,
{
(1, 0),
(2, 0),
(2, 1),
(3, 2),
(3, 4),
(4, 2)
},
)
qc_mapped, res = qmap.compile(qc, arch, method="exact") Please let us know if you can replicate the results based on the above suggestions. |
I already included that "mismatch", however, results are still not the optimal ones as in the publication. |
Signed-off-by: Lukas Burgholzer <[email protected]>
I constructed a MVE as follows: ` n_qubits = 4 arch = qmap.Architecture( qmap.compile(circ, arch, method="exact", post_mapping_optimizations=False) However, there is a valid solution that adds 11 gates and therefore the mapped circuit has 19 gate operations in total after mapping. Is this all correct and helps? |
Thanks for the effort. That certainly helps. I added the circuit you found as an additional regression test to #264. |
#264) ## Description Fixes #256. The underlying cause of the performance regression was an oversight in the addition of the SWAP limitation feature for the ASPDAC 2021 paper. The implementation did not properly handle directed architectures in various cases: - due to the unidirectional edges, the longest shortest path search would sometimes return paths that were too long. That alone wouldn't be a problem, but makes the performance suboptimal. This is fixed by making sure that the search for the longest shortest path considers edges in the coupling graph as bidirectional. - More critically, the coupling limit computation only computes the cost of moving any two qubits next to each other. However, in directed architectures, this might not be enough to make a two-qubit gate executable. The simplest case, where this can be seen is a directed two-qubit architecture and a circuit with two controlled-H gates that have flipped controls and targets. Obviously, a SWAP is required in that case, but the old coupling limit computation would result in a limit of zero. This is fixed by incrementing the coupling limit by one in case of directed architectures. - SWAP limits were activated even if `settings.swapReduction == SwapReduction::None`, which also led to the limit being set to zero. This was fixed by adjusting the condition for enabling swap reduction. - Last but not least, the solver optimization for directed architectures was not ideal and has been changed to using weighted clauses instead of separate minimisation calls. ## Checklist: <!--- This checklist serves as a reminder of a couple of things that ensure your pull request will be merged swiftly. --> - [x] The pull request only contains commits that are related to it. - [x] I have added appropriate tests and documentation. - [x] I have made sure that all CI jobs on GitHub pass. - [x] The pull request introduces no new warnings and follows the project's style guidelines.
This problem should be fixed now that #264 is merged. The PR description also contains a detailed description of what has been fixed. Could you maybe confirm that this fixes your problems by trying out the latest |
I will check on Monday. |
I'll release a new version probably tomorrow or on Monday the latest. Still want to get in #268 before the next release. |
v2.1.3 is out and should be on PyPI over the course of the next hour 🥳 |
Happy to report that the issue seems to be fixed :) |
mqt.qmap version
mqt-qmap 2.1.2 via pip
OS
Ubuntu
Python version
No response
C++ compiler
No response
Additional environment information
No response
Description
Please find below an (incomplete) list of benchmarks where the current implementation of the exact mapping algorithm shows differences when reproducing the results of Wille et al. (IBM QX4 arch):
Expected behavior
I would expect the same results as mentioned in the paper.
How to Reproduce
Run listed benchmarks above with exact mapper for arch graph resembling IBM QX4 (asymmetric) connectivity and compare with results of publication.
The text was updated successfully, but these errors were encountered: