Migrate --decompose-lowering to reference semantics - #3224
Merged
Merged
Conversation
… for gates that can be decomposable. Ensure closely followed implementation as in Quantum dialect
… decomposableGateInterface in Quantum dialect
Changelog generalized to include all PRs that implement DecomposableGateInterface across dialects Co-authored-by: Ali Asadi <10773383+maliasadi@users.noreply.github.com>
… for gates that can be decomposable. Ensure closely followed implementation as in Quantum dialect
… decomposableGateInterface in Quantum dialect
Changelog generalized to include all PRs that implement DecomposableGateInterface across dialects Co-authored-by: Ali Asadi <10773383+maliasadi@users.noreply.github.com>
…ate required in all corresponding DecompGate Interfaces
… GOID, into QRef. Update tests as well.
…ce' into paul0403/decompose_lowering_qref
paul0403
marked this pull request as ready for review
September 15, 2026 19:48
kipawaa
approved these changes
Sep 15, 2026
yde773786
force-pushed
the
decomp/qref-decomposable-interface
branch
from
September 16, 2026 14:38
ecf06c6 to
bffe31d
Compare
maliasadi
reviewed
Sep 16, 2026
maliasadi
reviewed
Sep 16, 2026
maliasadi
reviewed
Sep 16, 2026
maliasadi
reviewed
Sep 16, 2026
maliasadi
reviewed
Sep 16, 2026
maliasadi
approved these changes
Sep 16, 2026
maliasadi
added a commit
that referenced
this pull request
Sep 16, 2026
**Context:** As `--decompose-lowering` is moved to ref semantics (#3224) and the pass inlines a rule into the operator it decomposes by matching each rule function's arguments to the operator's signature, the pass reads a user-defined custom rule back as `func(qreg, param*, inWires*, ...)`. Two independent defects broke that pipeline for `Operator2` gates and crashed the pass with a `SmallVector` out-of-bounds / param-count assertion in `findParamTypeRange`: - args sorting/ordering in the frontend: the kwargs were serialized in a single sorted-by-name order `subroutine` traces through `jax.jit` which flattens keyword arguments in sorted-name order and a wire arg whose name sorts before a parameter's (e.g. `reg` < `x`) placed ahead of the param and mismatched the parameter/wire split. This is fixed now! - unused args in the pass: The qref `DecomposeLoweringPass` no longer erases unused rule args so I removed `removeUnusedFuncArgs` in this PR. A rule whose body does not use one of its args had that arg stripped from the function signature, after which the analyzer mistook the wire-index operand for the arg and read past the end of the arg list. **Related GitHub Issues:**
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context:
Although we are saying we just want functionality for Q3, but the qubit extract index walkback in
--decompose-loweringis just way too extreme to overlook.Description of the Change:
Migrate
--decompose-loweringto reference semantics.Benefits:
--decompose-loweringno longer performs a SSA qubit def-use chain walk back per gate instance.Note that we are not changing any signature of the rules, so all the stablehlo/extract index stuff is still present.
All this PR does is get rid of the qubit SSA value walkback.
[sc-129852]