Support qreg + scalar qubit-index signatures in decompose-lowering (#2869)#2952
Support qreg + scalar qubit-index signatures in decompose-lowering (#2869)#2952jk20342 wants to merge 4 commits into
Conversation
Refactor handling of wire indices to support both packed tensor arguments and scalar arguments. Adjust logic to consume function inputs based on expected element counts.
Removed debug dump statements for decompFunc and callOperands.
Added a note about the `--decompose-lowering` pass fix.
|
one thing I didnt change since it was already a pre existing contract is the fact that assert is loading bearing under NDEBUG but could add an emitError + failure() to the PauliRot//Custom paths since MultiRZ already does it |
|
Hi @jk20342, welcome to the Catalyst project 👋 And thank you for opening a PR! Our team will have a look the submitted code, however one caveat is that this component (compiler decompositions) is heavily in flux right now, so we may or may not be able to merge your contribution. Please allow us some time to look into it. In the future, it would be safer to comment on the issue you are intending to tackle before work starts, that way we coordinate or provide missing context that may be necessary. Cheers :) |
thanks :) i normally contribute to pennylane rather then catalyst but this project seems quite interesting thanks for the info for future PRs :D |
Context:
decompose-lowering'sprepareCallOperandsassumed qreg-mode rules pack allwire indices into a single tensor (e.g.
tensor<2xi64>). Signatures of the form(qreg, *params, first_qubit_index, second_qubit_index, ...)- produced by opslike
quantum.paulirot- hit an out-of-boundsSmallVectoraccess and crashed.Description of the Change:
prepareCallOperandsnow maps wire indices to function inputs one at a time,letting each input type's element count decide how many indices it consumes
handles both a single packed
tensor<Nxi64>arg and separate scalartensor<i64>args. Also removed leftover debug
.dump()calls.Benefits:
Fixes the crash; qreg-mode rules with per-qubit index arguments now lower correctly.
Possible Drawbacks:
None known.
Related GitHub Issues:
Fixes #2869