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

Fence instruction incorrectly typed inside measurement calibration #1798

Closed
2 tasks done
mhodson-rigetti opened this issue Aug 13, 2024 · 0 comments · Fixed by #1799
Closed
2 tasks done

Fence instruction incorrectly typed inside measurement calibration #1798

mhodson-rigetti opened this issue Aug 13, 2024 · 0 comments · Fixed by #1799
Labels
bug 🐛 An issue that needs fixing. urgent Priority assistance requested

Comments

@mhodson-rigetti
Copy link
Contributor

mhodson-rigetti commented Aug 13, 2024

Pre-Report Checklist

  • I am running the latest versions of pyQuil and the Forest SDK
  • I checked to make sure that this bug has not already been reported

Issue Description and reproduction recipe

With pyquil==4.14.0 the following occurs:

from pyquil import Program
from pyquil.quilbase import Gate

program = Program("""
FENCE
DEFCAL TEST 1:
    FENCE 0
DEFCAL MEASURE 0 addr:
    FENCE 0
""")

print("Instruction (top level):")

instruction = program.instructions[0]
print(f"instruction = {instruction}")

fence_is_gate = isinstance(instruction, Gate)
print(f"fence_is_gate = {fence_is_gate}")

print()

calibration = program.calibrations[0]

print("Instruction (inside gate calibration):")

instruction = calibration.instructions[0]
print(f"instruction = {instruction}")

fence_is_gate = isinstance(instruction, Gate)
print(f"fence_is_gate = {fence_is_gate}")

print()

calibration = program.measure_calibrations[0]

print("Instruction (inside measurement calibration):")

instruction = calibration.instructions[0]
print(f"instruction = {instruction}")

fence_is_gate = isinstance(instruction, Gate)
print(f"fence_is_gate = {fence_is_gate}")

print()

Erroneous output

Instruction (top level):
instruction = FENCE
fence_is_gate = False

Instruction (inside gate calibration):
instruction = FENCE
fence_is_gate = False

Instruction (inside measurement calibration):
instruction = Fence(Fence { qubits: [Fixed(0)] })
fence_is_gate = True

The FENCE instruction, when embedded in a measurement calibration, comes through with some sort of malformed type which makes it equivalent to a Gate, but then if you treat it as such of course the relevant members are missing.

I am unsure if this is an issue in the pyquil inheritance from quil-py or deeper in the Rust bindings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue that needs fixing. urgent Priority assistance requested
Projects
None yet
1 participant