Skip to content
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

fix: only rewrite arithmetic when targeting Aspen processors #1679

Merged
merged 10 commits into from
Oct 18, 2023

Conversation

notmgsk
Copy link
Contributor

@notmgsk notmgsk commented Oct 11, 2023

This MR changes when the rewrite_arithmetic functionality is used. We support two translation backends:

  • V1: legacy translation, which expects the client to have used rewrite_arithmetic, and does not support Ankaa (or later) processors; and
  • V2: modern translation, which expects the client to have not used rewrite_arithmetic.

Thus, to bridge the gap between the transition from V1 to V2, this MR only rewrites arithmetic if the target processor is of the Aspen family. If the user requests a backend that is not supported for the target processor, a warning is emitted and the correct backend is used instead.

When Aspen-M-3 goes offline, we can remove the checks introduced by this MR and instead require that V2 is always used.

Closes #1678

Below are plots for a program that should have period 2pi. In the first, the period is much larger.

Without fix:
ankaa-old

With fix:
ankaa-new

@rigetti-githubbot
Copy link

rigetti-githubbot commented Oct 12, 2023

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
6874 6015 88% 87% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
pyquil/api/_compiler.py 55% 🟢
TOTAL 55% 🟢

updated for commit: 42bdf8b by action🐍

pyquil/api/_compiler.py Outdated Show resolved Hide resolved
@notmgsk notmgsk marked this pull request as ready for review October 16, 2023 19:20
@notmgsk notmgsk requested a review from a team as a code owner October 16, 2023 19:20
@notmgsk notmgsk requested a review from BatmanAoD October 16, 2023 19:43
Copy link
Contributor

@kalzoo kalzoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unfortunate we have to do this, but this implementation looks right, thanks. We can all look forward to reverting this when Aspen-M-3 is retired!

Description should include a summary of your approach and rationale for quick review, both now and later (when we forget about this and wonder why we did it). Plot illustration is 👍

Also, the title becomes the commit message, and this is more than just Aspen-M-3, it's any Aspen.

Approved when comments addressed 🚢

pyquil/api/_compiler.py Outdated Show resolved Hide resolved
pyquil/api/_compiler.py Show resolved Hide resolved
pyquil/api/_compiler.py Outdated Show resolved Hide resolved
pyquil/api/_compiler.py Outdated Show resolved Hide resolved
@notmgsk notmgsk changed the title fix: only rewrite arithmetic when targeting Aspen-M-3 fix: only rewrite arithmetic when targeting Aspen processors Oct 18, 2023
@notmgsk notmgsk merged commit a73a896 into master Oct 18, 2023
@notmgsk notmgsk deleted the 1678-disable-rewrite-arithmetic branch October 18, 2023 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rewrite arithmetic if (and only if) the target QPU is Aspen-M-3
5 participants