-
Notifications
You must be signed in to change notification settings - Fork 48
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
Critical Assertion in replace_TK2_2CX fails #672
Comments
Hi, thank you for raising an issue for this. Can I ask which OS you are using? This may be a platform dependent issue as I do not get the assertion failure when I run your code snippet on my mac. |
Hi, thank you very much for your fast response. I actually do also use a mac with MacOs 13.0.1. Not sure if it helps, but I use pytket-qiskit v0.31.0, qiskit-terra v0.22.2 and qiskit v0.39.2. |
Hi, I am not sure of the exact reason for the assertion failure in this case as I can't reproduce the error. I suspect it comes from small parameter values in the phase estimation circuit. I think we should investigate this behaviour further. After discussing this I think we will remove this assertion in a future release and make it warning instead. Its possible to change the target gateset of the
Do you still get the error message if you target TK2 gates? I think this may bypass the |
Hi, for me there was a threshold regarding Thanks for that suggestion, it avoids the error message. Would you be able to give an estimate in how far the added parameter affects the resulting optimization quality? |
Hi, I would have thought that increasing the number of evaluation qubits may reproduce the error as well. However I can increase the number up to 90 without seeing the issue which surprised me. Regarding targetting TK2 vs CX.... If I run your original code snippet targeting CX gates with If Instead I target TK2 gates with the same example I get the following #total gates = 1017 The improvement in gate count/depth with TK2 is expected as it is a parameterised gate and therefore more expressive than CX. As for which one is better I suppose it depends on the emulator/device that you're using. TK2 gates were added as an intermediate step to target the Quantinuum device gate set whereas CX gates are native to IBM devices. |
When applying
FullPeepholeOptimise
to a quantum circuit with a quantum phase estimation part using a large number of measurement qubits (and therefore very small phase rotations), a critical assertion inreplace_TK2_2CX
(CircUtils.cpp in line 238) fails:[2022-12-01 14:34:12] [tket] [critical] Assertion 'equiv_0(params[2], 4, 1e-6)' (/Users/runner/.conan/data/tket/1.0.31/tket/stable/build/<...>/Circuit/CircUtils.cpp : replace_TK2_2CX : 238) failed. Aborting.
I am using the FullPeepholeOptimise in a script to generate many quantum circuits and in that case the resulting
std::abort()
from the failed assertion is quite unfortunate, because I cannot treat/catch it.The following code can be used to reproduce the result (python v3.9, pytket v1.9.0):
I converted the qiskit quantum circuit to contain only openQASM 2.0 gates such that any custom gates are avoided when
qiskit_to_tk
is applied and transpile it to the IonQ native gate set using pytket. If I skip therebase
step, the assert does not fail.Maybe a higher tolerance within the
replace_TK2_2CX
assertion statement could solve the problem?The text was updated successfully, but these errors were encountered: