-
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(phirgen): emit Skip mop instead of error on global phase #138
Conversation
3949c6f
to
b594781
Compare
The test failure seems to be related to #108 |
potential fix for #108
@qciaran asking you to review since I introduce an invalid/unknown "Skip" The issue with just ignoring the phase is that if the branches of the conditional are empty, we get an error during phir validation as phir model requires the branches to be non-empty. Now the output corresponding to Phase is: Comment(c='IF ([z_corr_3[0]] == 1) THEN IF ([z_corr_3[0]] == 1) THEN Phase(0.5);'),
IfBlock(metadata=None, block='if', condition=COp(metadata=None, cop='==', returns=None, args=[('z_corr_3', 0), 1]), true_branch=[MOp(metadata=None, mop='Skip', duration=None)], false_branch=None), EDIT: discussed with @qciaran. Will send corresponding PRs for supporting |
* feat(spec): introduce Skip mop See CQCL/pytket-phir#138 * feat(model): add validation for MOps
Since conditionals depend on classical bits in their condition, we should create shards for each of them, instead of completely ignoring any dependency that may occur on those classical bits. Fixes: #150 A side effect: We were previously emitting a Skip mop (introduced in #138) for conditional global phase operations, but not they correctly get filtered out by `_is_command_global_phase`
Since conditionals depend on classical bits in their condition, we should create shards for each of them, instead of completely ignoring any dependency that may occur on those classical bits. Fixes: #150 A side effect: We were previously emitting a Skip mop (introduced in #138) for conditional global phase operations, but now they correctly get filtered out by `_is_command_global_phase`
Since conditionals depend on classical bits in their condition, we should create shards for each of them, instead of completely ignoring any dependency that may occur on those classical bits. Fixes: #150 A side effect: We were previously emitting a Skip mop (introduced in #138) for conditional global phase operations, but now they correctly get filtered out by `_is_command_global_phase`
Since conditionals depend on classical bits in their condition, we should create shards for each of them, instead of completely ignoring any dependency that may occur on those classical bits. Fixes: #150 A side effect: We were previously emitting a Skip mop (introduced in #138) for conditional global phase operations, but now they correctly get filtered out by `_is_command_global_phase`
Description
We currently error out on (global) Phase, which is a problem as global phase is a harmless operation. I propose a no-op
mop
instruction"Skip"
instead to handle this scenario.Fixes #136
Type of change
Checklist: