-
Notifications
You must be signed in to change notification settings - Fork 72
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
Compiler outputs different programs non-deterministically #676
Comments
Are you able to upload the verbose output of quilc for both outputs to see what the compiler is up to? |
I have a similar problem. See attached script. Sometimes I get the answer reported in the last cell and sometimes the answer in the one before the last cell. I couldn't identify any pattern of when I get one answer or another. I noticed that if I use "device_name=40q-qvm" instead of "device_name=Aspen-9-qvm", the program is compiled differently (i.e. CZ gate is used instead of CPHASE(pi)) and there's no problem. Interestingly, both the program reported here and the one I used involve the XY gate. |
I've noticed this non-determinism more as-of-late as well, and it's irksome. I sometimes have to run the compiler 2-3 times to find the "best" one of the bunch, and I'm not yet sure of the source of the issue. |
I labeled this as a bug due to its woeful disregard of expectations, even though it may not be "wrong". @mimigdal It's almost surely due to some routines in the compiler which depend on non-determinism. Those are being looked into now. |
Thanks Robert, my wild guess is that this is due to numerical precision,
something like an if clause asking whether 0.999999997 is smaller or bigger
than 1.00000003. These are things that can change randomly from run to run.
I noticed that these problems are generated when the compiler tries to
substitute a CZ gate with the product of two XY gates. So, I would start
looking at the place where XY gates are first introduced by the compiler.
…On Mon, Oct 25, 2021, 14:54 Robert Smith ***@***.***> wrote:
I labeled this as a bug due to its woeful disregard of expectations, even
though it may not be "wrong".
@mimigdal <https://github.com/mimigdal> It's almost surely due to some
routines in the compiler which depend on non-determinism. Those are being
looked into now.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#676 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APEAB2UXRE25PRZ5ALTGYQDUIWYWHANCNFSM4SRLQRZA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
CC @macrologist |
This partially addresses one source of "nondeterminism" in quilc compilation (see quil-lang#676) that was due to a violation of referential transparency. Specifically, non destructive compilation was not non-destructive enough: compiling the same parsed-program instance twice did not successfuly copy measurement instances deeply, resulting in different outputs from compress-qubits, with downstream consequences.
This partially addresses one source of "nondeterminism" in quilc compilation (see #676) that was due to a violation of referential transparency. Specifically, non destructive compilation was not non-destructive enough: compiling the same parsed-program instance twice did not successfuly copy measurement instances deeply, resulting in different outputs from compress-qubits, with downstream consequences.
Compiling the following bell-state program via pyquil on "9q-square-qvm":
... using the following quilc ISA patched to remove CZ gates (force use of XY)
... generates two different native programs with seemingly non-deterministic behavior:
(most of the time)
(occasionally)
The text was updated successfully, but these errors were encountered: