-
Notifications
You must be signed in to change notification settings - Fork 1
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
Reg2const arithmetic and tracking previously set ssa vars #8
Conversation
def _reg2ssa_var(self, bit_reg: BitRegister, int_size: int) -> Value: | ||
# A utility function to convert from a pytket | ||
# BitRegister to an SSA variable via pyqir types. | ||
reg_name = bit_reg[0].reg_name |
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.
Agree about the first; not quite sure about the second: can we assume a ClassicalExpBox
has no classical wires?
pytket_qir/generator.py
Outdated
if in_width > 0: | ||
com_bits = args[:in_width] | ||
args = args[in_width:] | ||
regname = com_bits[0].reg_name |
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.
Have you tried with latest pytket? This error was removed in CQCL/tket#589 .
Co-authored-by: Alec Edgington <54802828+cqc-alec@users.noreply.github.com>
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.
Could you please create a (low-priority) task to make SetBits
and ClassicalExpBox
support the trivial no-wires case? Ideally we should support this but maybe there are issues with pytket that prevent it.
Sure. But don't they already support it ? I thought from the examples above that setting them with empty registers was valid. Or, am I getting confused ? Thanks for the review. |
E.g. e0c46da I still don't get why we have to raise an exception here (I mean, I get it in terms of how the code works currently, but I don't see why it has to be that way). Anyway this is low-priority and shouldn't block merging this! |
Tbf, I don't understand very clearly either what you are expecting. I am a little confused between the new behaviour of the ops and handling it in the context of correctness here. Maybe best to discuss that in Slack ? |
This PR addresses the addition of two functionalities:
reg2const
arithmetic: this requires to keep track of registers set with a constant value through theSetBitsOp
for potential later reuse.This work also encompasses an architectural re-design of the package in three main parts:
pyqir
SimpleModule
to handle custom define quantum functions.