-
Notifications
You must be signed in to change notification settings - Fork 2
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 conditional barriers #119
Comments
Here is example Qasm:
|
I believe the issue is because we are skipping barriers in PHIR, we do have a todo at pytket-phir/pytket/phir/phirgen.py Lines 216 to 219 in 427c7e0
case tk.BarrierOp():
# TODO(kartik): confirm with Ciaran/spec
# https://github.com/CQCL/phir/blob/main/spec.md
logger.debug("Skipping Barrier instruction") I wasn't sure what the right behavior should be as the spec doesn't mention it. Could you suggest what instruction should be emitted? I can update both the spec and phirgen for this issue. Here's the PHIR being generated right now: {
'format': 'PHIR/JSON',
'version': '0.1.0',
'metadata': {'source': 'pytket-phir v0.3.1.dev2'},
'ops': [
{'data': 'qvar_define', 'data_type': 'qubits', 'variable': 'q', 'size': 2},
{'data': 'cvar_define', 'data_type': 'u32', 'variable': 'm', 'size': 2},
{'//': 'H q[0];'},
{'qop': 'H', 'angles': None, 'args': [['q', 0]]},
{'//': 'IF ([m[0], m[1]] == 0) THEN IF ([m[0], m[1]] == 0) THEN Barrier q[0], q[1];'},
{'block': 'if', 'condition': {'cop': '==', 'args': ['m', 0]}, 'true_branch': [None]},
{'//': 'CX q[0], q[1];'},
{'qop': 'CX', 'angles': None, 'args': [[['q', 0], ['q', 1]]]},
{'//': 'Measure q[0] --> m[0];'},
{'qop': 'Measure', 'returns': [['m', 0]], 'args': [['q', 0]]},
{'//': 'Measure q[1] --> m[1];'},
{'qop': 'Measure', 'returns': [['m', 1]], 'args': [['q', 1]]}
]
} Another related issue #55 |
Should fix https://github.com/CQCL/phir/issues/53 Requires CQCL/phir#56 Also requires support for barrier instructions in pecos
When I try to run the qasm with conditional barriers like
if(m==0) barrier q[0], q[1];
usingqasm_to_phir()
it raisesValidationError
.It also might be useful to introduce a barrier into PHIR...
The text was updated successfully, but these errors were encountered: