-
Notifications
You must be signed in to change notification settings - Fork 294
Fixes and issue with sampling when kernel contains mid-circuit measurements #1619
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
Conversation
The current Python `MidCircuitMeasurementAnalyzer` visitor only supports certain expressions, e.g., `if val` but not `if val == True`, where `val = mz(q)`. Hence, it mis-identified some kernels as non-measurement feedback, i.e., not setting `qubitMeasurementFeedback=true`, causing wrong sampling mode being used. This PR: - Add more handling cases: variable name or variable subscript; CompareOp; handle variables in BoolOp and UnaryOp. - Add IR checks and target tests. Note: this is not an exhaustive handling of all possible scenarios.
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
|
IMO, this analysis shouldn't really be done on the AST. Can you create another issue to replace this ad hoc pattern matching with a dataflow analysis? (We need it for C++ as well.) |
|
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
Description
The current Python
MidCircuitMeasurementAnalyzervisitor only supports certain expressions, e.g.,if valbut notif val == boolVar, whereval = mz(q).Hence, it may mis-identify some kernels as non-measurement feedback, i.e., not setting
qubitMeasurementFeedback=true, causing wrong sampling mode being used.This PR:
Add more handling cases: variable name or variable subscript;
CompareOp; handle variables inBoolOpandUnaryOp.Add IR checks and target tests.
Note: this is not an exhaustive handling of all possible scenarios.
Resolves #1618