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

feat(barrier): add support for barrier meta instruction #56

Merged
merged 4 commits into from
Feb 1, 2024
Merged

Conversation

qartik
Copy link
Member

@qartik qartik commented Jan 30, 2024

Also updates some deps.

@qartik qartik requested a review from qciaran January 30, 2024 16:15
@qartik qartik linked an issue Jan 30, 2024 that may be closed by this pull request
qartik added a commit to CQCL/pytket-phir that referenced this pull request Jan 30, 2024
Should fix https://github.com/CQCL/phir/issues/53

Requires CQCL/phir#56

Also requires support for barrier instructions in pecos
@@ -243,14 +261,14 @@ class MOp(Op):


QOp: TypeAlias = MeasOp | SQOp | TQOp
OpType: TypeAlias = FFCall | COp | QOp | MOp
OpType: TypeAlias = FFCall | COp | QOp | MOp | Barrier
Copy link
Member Author

@qartik qartik Jan 30, 2024

Choose a reason for hiding this comment

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

This is required to be able to treat Barrier as, e.g., an op under a conditional. See CQCL/pytket-phir#119

qartik added a commit to CQCL/pytket-phir that referenced this pull request Jan 30, 2024
Should fix https://github.com/CQCL/phir/issues/53

Requires CQCL/phir#56

Also requires support for barrier instructions in pecos
@qartik qartik self-assigned this Jan 30, 2024
qartik added a commit to CQCL/pytket-phir that referenced this pull request Jan 31, 2024
Should fix https://github.com/CQCL/phir/issues/53

Requires CQCL/phir#56

Also requires support for barrier instructions in pecos
@qciaran
Copy link
Collaborator

qciaran commented Feb 1, 2024

Normal blocks seem to be working well for me; however, conditional blocks give me a validation error. I am guessing the true and false branches of the if block need to accept "meta" or "block" instructions.

@qartik
Copy link
Member Author

qartik commented Feb 1, 2024

conditional blocks give me a validation error. I am guessing the true and false branches of the if block need to accept "meta" or "block" instructions.

That's surprising. I have your test included in my PR at https://github.com/CQCL/pytket-phir/pull/118/files#diff-d6e59c872f76d32d22d06c331425ef74680d731ed77c20029e26f5fcfe551491 and I don't see a validation error there.

Can you share more what example is failing?

@qciaran
Copy link
Collaborator

qciaran commented Feb 1, 2024

I am not using pytket-phir but instead testing a PHIR file directly.

If I set interp.phir_validation = True for this test https://github.com/PECOS-packages/PECOS/blob/fb01d5caab71c743353dac76a22ea60ed64441ef/tests/integration/test_phir.py#L292 everything is fine.

But doing the same for https://github.com/PECOS-packages/PECOS/blob/fb01d5caab71c743353dac76a22ea60ed64441ef/tests/integration/test_phir.py#L308 leads to a validation error. Maybe the fault it mine, though.

@qartik
Copy link
Member Author

qartik commented Feb 1, 2024

I am guessing the true and false branches of the if block need to accept "meta" or "block" instructions.

You were right, the failure is because of the "qparallel" blocks being inside the branches of the conditional. "meta" (really "barrier" only) is already included as part of OpType. Pushing a fix.

@qartik
Copy link
Member Author

qartik commented Feb 1, 2024

@qciaran if you try again, it should pass. Thanks for pointing this issue out even though it was unrelated to the "barrier" instruction.

Copy link
Collaborator

@qciaran qciaran left a comment

Choose a reason for hiding this comment

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

Works for me.

@qartik qartik added this pull request to the merge queue Feb 1, 2024
Merged via the queue into main with commit aedff0c Feb 1, 2024
4 checks passed
@qartik qartik deleted the add-barrier branch February 1, 2024 18:01
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.

add a Barrier operation
2 participants