Skip to content

Conversation

@dwierichs
Copy link
Contributor

@dwierichs dwierichs commented Sep 1, 2025

Context:
There are multiple decompositions of MulticontrolledX that use auxiliary wires.

Description of the Change:
If the auxiliary wires are of work_wire_type="zeroed", we may replace Toffoli gates acting on them by TemporaryAND gates.

Benefits:
Cheaper decompositions

Possible Drawbacks:
N/A

Related GitHub Issues:
[sc-95311]

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2025

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.
@codecov
Copy link

codecov bot commented Sep 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.39%. Comparing base (9ea5986) to head (102ca66).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8172      +/-   ##
==========================================
- Coverage   99.39%   99.39%   -0.01%     
==========================================
  Files         554      554              
  Lines       57462    57481      +19     
==========================================
+ Hits        57117    57135      +18     
- Misses        345      346       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
Copy link
Contributor

@astralcai astralcai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to add a changelog entry.

Copy link
Contributor Author

@dwierichs dwierichs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving some hopefully useful comments.

@andrijapau andrijapau self-requested a review September 9, 2025 13:03
@Alex-Preciado Alex-Preciado requested review from mudit2812 and removed request for andrijapau September 12, 2025 16:02
Copy link
Contributor

@mudit2812 mudit2812 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the very informative comments @dwierichs . I'm ready to approve, but I consider the global import suggestion to be blocking, so will hold off for now.

@dwierichs dwierichs enabled auto-merge September 15, 2025 15:23
@dwierichs dwierichs added this pull request to the merge queue Sep 16, 2025
Merged via the queue into master with commit 0b18c7f Sep 16, 2025
54 checks passed
@dwierichs dwierichs deleted the clean_mcx branch September 16, 2025 15:18
mudit2812 added a commit that referenced this pull request Sep 18, 2025
commit d6e9c08
Author: ringo-but-quantum <github-ringo-but-quantum@xanadu.ai>
Date:   Thu Sep 18 09:51:46 2025 +0000

    [no ci] bump nightly version

commit 61ba7c3
Author: Astral Cai <astral.cai@xanadu.ai>
Date:   Wed Sep 17 12:11:01 2025 -0400

    Resolve some old todo comments (#8295)

    **Context:**

    **Description of the Change:**

    **Benefits:**

    **Possible Drawbacks:**

    **Related GitHub Issues:**

commit 7b4262c
Author: Pietropaolo Frisoni <pietropaolo.frisoni@xanadu.ai>
Date:   Wed Sep 17 11:59:37 2025 -0400

    Updating the documentation of `qml.device` (#8294)

    **Context:** The documentation of `qml.device` was outdated, so this PR
    updates it.

    **Description of the Change:** As above.

    **Benefits:** The example are compatible with latest PL.

    **Possible Drawbacks:** None that I can think of.

    **Related GitHub Issues:** #7992

    [sc-99473]

commit 404b192
Author: Andrija Paurevic <46359773+andrijapau@users.noreply.github.com>
Date:   Wed Sep 17 11:02:51 2025 -0400

    chore: add tests for nested `adjoint` and `ctrl` transforms with `autograph` (#8283)

    **Context:**

    Missing some important tests in the autograph module.

    **Description of the Change:**

    Add a test to make sure these functions get captured in the plxpr. We
    don't care about plxpr execution through PL anymore.

    **Benefits:** Robust code.

    [sc-99324]

    ---------

    Co-authored-by: Mudit Pandey <18223836+mudit2812@users.noreply.github.com>
    Co-authored-by: Astral Cai <astral.cai@xanadu.ai>

commit fb5b095
Author: Astral Cai <astral.cai@xanadu.ai>
Date:   Wed Sep 17 10:59:01 2025 -0400

    `has_decomps` and `list_decomps` work with operator instances (#8286)

    **Context:**
    These two helpers used to work with classes. As a result, one might see
    usage (e.g. this
    [commit](https://github.com/PennyLaneAI/pennylane/pull/8260/files#diff-9da436a44007b8abb8170447c6b939836bbb5920b1a05f26454fe3c3537aab30R523))
    like
    ```python
    has_decomp(type(op))
    ```

    **Description of the Change:**

    **Benefits:**
    Now we can simply
    ```python
    has_decomp(op)
    ```

    **Possible Drawbacks:**

    **Related GitHub Issues:**
    [sc-99425]

    ---------

    Co-authored-by: Yushao Chen (Jerry) <chenys13@outlook.com>
    Co-authored-by: Isaac De Vlugt <34751083+isaacdevlugt@users.noreply.github.com>

commit 3220785
Author: Astral Cai <astral.cai@xanadu.ai>
Date:   Wed Sep 17 10:33:00 2025 -0400

    Remove useless pylint suppressions (#8292)

    **Context:**

    **Description of the Change:**

    **Benefits:**

    **Possible Drawbacks:**

    **Related GitHub Issues:**

commit 7ee8274
Author: Utkarsh <utkarshazad98@gmail.com>
Date:   Wed Sep 17 23:24:20 2025 +0900

    Improvements to decompositions using `ChangeOpBasis` (#8207)

    **Context:** Updates the decomposition for the following templates:
    1. `Adder`
    2. `OutAdder`
    3. `Multiplier`
    4. `OutMultiplier`
    5. `PrepSelPrep`

    **Description of the Change:**
    1. Adds a `change_op_basis_resource_rep` for generating compressed
    resource representation for `ChangeOpBasis` operations.
    2. Modifies the relevant decompositions to now use
    `qml.change_op_basis`.

    **Benefits:**
    1. Cleaner decompositions that would lead to more efficient controlled
    decompositions.

    **Possible Drawbacks:** None

    **Related GitHub Issues:** [sc-98776], [sc-98777]

    ---------

    Co-authored-by: Astral Cai <astral.cai@xanadu.ai>

commit 357fdd8
Author: ringo-but-quantum <github-ringo-but-quantum@xanadu.ai>
Date:   Wed Sep 17 09:51:45 2025 +0000

    [no ci] bump nightly version

commit 135dab0
Author: Utkarsh <utkarshazad98@gmail.com>
Date:   Wed Sep 17 06:11:15 2025 +0900

    Port non-parametric resource operators (#8240)

    **Context:** Ports non-parametric resource operators to the `estimator`
    module

    **Description of the Change:** Following changes are done:
    1. `qml_estimator.rst`: Updated to list all the key objects for the
    module. Shifted stuff from `estimator/__init__.py` and consolidated them
    here.
    2. `conf.py`: Added two custom hooks to the Sphinx configuration. The
    first one acts when stubs are read. It checks for `qml.estimator.ops` in
    the path and attaches `:noindex:` directive to it. The second one acts
    after the stubs have been written as HTML, and adds links to the
    non-indexed stubs ONLY in the `qml_estimator` page.
    3. `ops/identity.py`: contains `Identity` and `GlobalPhase` (yes, I know
    this one is parametric, but it was easier to do).
    4. `ops/qubit/non_parametric_ops.py`: contains all the non-parametric
    resource operators.

    **Benefits:**

    **Possible Drawbacks:** only drawback for the new hooks for `sphinx`
    configuration is that one won't be able to cross-reference operators
    within the sub-module `qml.estimator.ops`. This side effect is limited
    to that one sub-module and doesn't affect anything else; in fact, other
    items in `qml.estimator` can still be cross-referenced.

    **Related GitHub Issues:**

    ---------

    Co-authored-by: Diksha Dhawan <40900030+ddhawan11@users.noreply.github.com>
    Co-authored-by: Diksha Dhawan <ddhawan@umich.edu>
    Co-authored-by: Andrija Paurevic <46359773+andrijapau@users.noreply.github.com>
    Co-authored-by: Christina Lee <christina@xanadu.ai>
    Co-authored-by: Austin Huang <austin.huang@xanadu.ai>
    Co-authored-by: Soran Jahangiri <40344468+soranjh@users.noreply.github.com>
    Co-authored-by: ANT0N <39093564+AntonNI8@users.noreply.github.com>

commit d11e442
Author: Andrija Paurevic <46359773+andrijapau@users.noreply.github.com>
Date:   Tue Sep 16 17:01:27 2025 -0400

    chore: improve type hinting in `workflow` module (#8284)

    **Context:**

    Easy PR to just add some type hints in our workflow module.

    **Benefits:** Better static type checking

    ---------

    Co-authored-by: Astral Cai <astral.cai@xanadu.ai>

commit 901171a
Author: Astral Cai <astral.cai@xanadu.ai>
Date:   Tue Sep 16 15:55:51 2025 -0400

    remove useless pylint disable (#8287)

    **Context:**

    **Description of the Change:**

    **Benefits:**

    **Possible Drawbacks:**

    **Related GitHub Issues:**

commit d2deac8
Author: David Wierichs <david.wierichs@xanadu.ai>
Date:   Tue Sep 16 21:22:16 2025 +0200

    Add unary iterator decomposition of `Select(..., partial=False)` (#8011)

    **Context:**
    #7658 added a keyword argument `partial` to `Select` and deactivates the
    unary iterator decomposition of `Select` for `partial=False`, because it
    assumes the partial Select property of the control state.

    **Description of the Change:**
    - Add a decomposition based on the unary iterator for `partial=False`.
    - Register the number of work wires as resource key of `Select`.
    - Condition unary iterator decomposition on the number of work wires
    being sufficiently large.

    **Benefits:**
    Feature parity of unary iterator decomposition of `Select`, compared to
    multi-control decomposition.

    **Possible Drawbacks:**
    N/A

    **Related GitHub Issues:**
    [sc-94729]

    ---------

    Co-authored-by: albi3ro <chrissie.c.l@gmail.com>
    Co-authored-by: Christina Lee <christina@xanadu.ai>
    Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
    Co-authored-by: Guillermo Alonso-Linaje <65235481+KetpuntoG@users.noreply.github.com>

commit 3cdcb63
Author: Diksha Dhawan <40900030+ddhawan11@users.noreply.github.com>
Date:   Tue Sep 16 12:51:19 2025 -0400

    Modified the signature for ResourceOperator class (#8279)

    **Context:**
    Modified the signature for controlled decomposition of ResourceOperator
    class.

    **Description of the Change:**

    **Benefits:**

    **Possible Drawbacks:**

    **Related GitHub Issues:**

    ---------

    Co-authored-by: Soran Jahangiri <40344468+soranjh@users.noreply.github.com>
    Co-authored-by: Christina Lee <christina@xanadu.ai>

commit 45107bf
Author: Christina Lee <christina@xanadu.ai>
Date:   Tue Sep 16 12:07:10 2025 -0400

    Include jax version in about (#8277)

    **Context:**

    We are really picky about jax versions, so the jax version should be
    included in the `qml.about()` to help us debug issues.

    **Description of the Change:**

    **Benefits:**

    **Possible Drawbacks:**

    **Related GitHub Issues:**

    ---------

    Co-authored-by: Mudit Pandey <18223836+mudit2812@users.noreply.github.com>
    Co-authored-by: Andrija Paurevic <46359773+andrijapau@users.noreply.github.com>

commit 0b18c7f
Author: David Wierichs <david.wierichs@xanadu.ai>
Date:   Tue Sep 16 16:56:38 2025 +0200

    Use `TemporaryAND` in `MulticontrolledX` decompositions (#8172)

    **Context:**
    There are multiple decompositions of `MulticontrolledX` that use
    auxiliary wires.

    **Description of the Change:**
    If the auxiliary wires are of `work_wire_type="zeroed"`, we may replace
    `Toffoli` gates acting on them by `TemporaryAND` gates.

    **Benefits:**
    Cheaper decompositions

    **Possible Drawbacks:**
    N/A

    **Related GitHub Issues:**
    [sc-95311]

    ---------

    Co-authored-by: Astral Cai <astral.cai@xanadu.ai>

commit 4d21739
Author: runora95 <59572091+runora95@users.noreply.github.com>
Date:   Tue Sep 16 10:28:03 2025 -0400

    removing push trigger from nightly RC builds (#8282)

    **Context:**
    RC branch nightly builds were added recently but mistakenly include a
    trigger to run on push.

    **Description of the Change:**
    Removing `push` trigger from RC nightly build.

    **Benefits:**
    prevent accidental uploads.

    **Possible Drawbacks:**

    **Related GitHub Issues:**

commit b5613cb
Author: ringo-but-quantum <github-ringo-but-quantum@xanadu.ai>
Date:   Tue Sep 16 09:51:35 2025 +0000

    [no ci] bump nightly version

commit 9ea5986
Author: Austin Huang <austin.huang@xanadu.ai>
Date:   Tue Sep 16 00:48:58 2025 -0400

    Add resource config class to Pennylane core (#8259)

    **Context:**
    We are moving the resource config class from labs to pennylane.

    **Description of the Change:**
    Add resource_config.py and test_resource_config.py to
    pennylane.estimator. Since we do not have the templates, we do not add
    them and their related tests.

    **Benefits:**

    **Possible Drawbacks:**

    **Related GitHub Issues:**
    [sc-96876]

    ---------

    Co-authored-by: Diksha Dhawan <ddhawan@umich.edu>
    Co-authored-by: Diksha Dhawan <40900030+ddhawan11@users.noreply.github.com>
    Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
    Co-authored-by: Christina Lee <christina@xanadu.ai>
    Co-authored-by: Andrija Paurevic <46359773+andrijapau@users.noreply.github.com>
    Co-authored-by: Soran Jahangiri <40344468+soranjh@users.noreply.github.com>
    Co-authored-by: ANT0N <39093564+AntonNI8@users.noreply.github.com>
    Co-authored-by: obliviateandsurrender <utkarshazad98@gmail.com>

commit 104b5e8
Author: Mehrdad Malek <39844030+mehrdad2m@users.noreply.github.com>
Date:   Mon Sep 15 22:46:20 2025 -0400

    Add data movement operations to StableHLO dialect (#8217)

    **Context:**
    Adding some of data movement operations to StableHLO dialect.

    **Description of the Change:**

    Operations:
    - [x] Add BroadcastInDimOp
    - [x] Add ConcatenateOp
    - [x] Add GatherOp
    - [x] Add ReshapeOp
    - [x] Add ScatterOp
    - [x] Add SliceOp

    traits:
    - [x] Add SliceArraysSameSizeTrait

    Attributes:
    - [x] ScatterDimensionNumbers
    - [x] GatherDimensionNumbers

    **Benefits:**

    **Possible Drawbacks:**

    **Related GitHub Issues:**
    [sc-98427]

    ---------

    Co-authored-by: Mudit Pandey <18223836+mudit2812@users.noreply.github.com>

commit c2f3714
Author: Pietropaolo Frisoni <pietropaolo.frisoni@xanadu.ai>
Date:   Mon Sep 15 21:11:03 2025 -0400

    `SampleMP.process_samples` does not raise an error when the observable is multiplied by a complex coefficient (#8271)

    **Context:** If an observable is multiplied by a complex coefficient,
    the `indices` array created within `process_raw_samples` as `indices =
    samples @ powers_of_two` might be created with complex values. This
    creates issues when we try to use them as actual indices.

    **Description of the Change:** We move the conversion to the requested
    `dtype` selected by the user just before returning, so we avoid any
    possible implicit casting unintentionally performed under the hood in
    the execution workflow.

    **Benefits:** `process_samples` works with complex values when the
    `dtype` argument is specified

    **Possible Drawbacks:** None that I can think of.

    **Related GitHub Issues:** None

commit 58570ba
Author: Andrija Paurevic <46359773+andrijapau@users.noreply.github.com>
Date:   Mon Sep 15 16:27:05 2025 -0400

    fix: allow autograph to work on wrapped `adjoint` and `ctrl` functions (#8215)

    **Context:**

    ```python
    import pennylane as qml

    qml.capture.enable()

    dev = qml.device("default.qubit", wires=5)

    def adjoint_fn(y):
        if y < 2:
            qml.RX(y, 0)
            qml.RY(y, 0)
        else:
            qml.RY(y, 0)
            qml.RZ(y, 0)

        qml.Hadamard(0)

    @qml.qnode(dev)
    def f(x):
        qml.adjoint(adjoint_fn)(x)
        return qml.expval(qml.Z(0))

    qml.capture.run_autograph(f)(1.5)
    ```
    previously failed. Now it correctly returns a result.

    **Description of the Change:**

    Changes which function gets selected for the convert call patch. This
    follows what Catalyst does.

    **Benefits:** Mimic Catalyst.

    **Possible Drawbacks:** None identified.

    **Related GitHub Issues:** Fixes #6992

    [sc-84934]

    ---------

    Co-authored-by: Mudit Pandey <18223836+mudit2812@users.noreply.github.com>
mudit2812 pushed a commit that referenced this pull request Sep 18, 2025
**Context:**
There are multiple decompositions of `MulticontrolledX` that use
auxiliary wires.

**Description of the Change:**
If the auxiliary wires are of `work_wire_type="zeroed"`, we may replace
`Toffoli` gates acting on them by `TemporaryAND` gates.

**Benefits:**
Cheaper decompositions

**Possible Drawbacks:**
N/A

**Related GitHub Issues:**
[sc-95311]

---------

Co-authored-by: Astral Cai <astral.cai@xanadu.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants