Add array support to QIR bytecode#3219
Conversation
| if init is None: | ||
| continue | ||
| if not isinstance(init, pyqir.ArrayConstant): | ||
| continue |
There was a problem hiding this comment.
Is this the right behavior here? Seems it has an initializer, but it's not of the type expected... shouldn't it error? Why is just silently continuing the right behavior?
| if ( | ||
| isinstance(arr_ty, pyqir.ArrayType) | ||
| and isinstance(arr_ty.element, pyqir.IntType) | ||
| and arr_ty.element.width == 8 |
There was a problem hiding this comment.
Is this because we assume these are output recording labels? Can you add comments here as to why these are being ignored silently also.
| ): | ||
| continue | ||
|
|
||
| base_addr = len(self.constant_data) |
There was a problem hiding this comment.
I find this line confusing. The length of the constant data is the address? So if two constant arrays have the same length they will have the same base address? If it's not as it reads, please add comments to explain.
There was a problem hiding this comment.
Oh I see (I think) - the call below to _encode_array_elements moves the value of self.constant_data as it iterates. Maybe a note here on that to save having to read the rest of the file to understand what his is doing. Thanks.
This PR adds array support to the QIR bytecode consumed by the QIR simulators, closing the current gap in functionality for the RIFLA profile.