Skip to content

Add support for empty rules in graph-decomposition#2765

Merged
maliasadi merged 3 commits intomainfrom
gdecomp_empty_rule
Apr 27, 2026
Merged

Add support for empty rules in graph-decomposition#2765
maliasadi merged 3 commits intomainfrom
gdecomp_empty_rule

Conversation

@maliasadi
Copy link
Copy Markdown
Member

@maliasadi maliasadi commented Apr 27, 2026

Context:
Add support for empty rules in graph-decomposition.

Description of the Change:

Benefits:

import pennylane as qp

from catalyst import qjit
from catalyst.jax_primitives import decomposition_rule
from catalyst.passes import graph_decomposition


@decomposition_rule(op_type=qp.PauliX)
def x_to_rx(_wire: int):
    pass

@qjit(capture=True)
@graph_decomposition(
    gate_set={qp.RX, qp.RY},
    fixed_decomps={qp.PauliX: x_to_rx},
)
@qp.qnode(qp.device("lightning.qubit", wires=2))
def circuit():
    qp.PauliX(0)
    qp.PauliX(1)
    qp.RX(0.5, wires=0)

    # register custom decomposition rules
    x_to_rx(int)

    return qp.state()

qp.specs(circuit, level="device")().resources.gate_types
{'RX': 1}

Related GitHub Issues:
[sc-116539]

@maliasadi maliasadi requested a review from kipawaa April 27, 2026 20:07
Copy link
Copy Markdown
Contributor

@kipawaa kipawaa left a comment

Choose a reason for hiding this comment

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

Great addition, thank you!

@maliasadi maliasadi requested a review from astralcai April 27, 2026 20:23
Copy link
Copy Markdown
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.

Looks straightforward enough, thanks!

@maliasadi maliasadi merged commit 1e784d7 into main Apr 27, 2026
42 checks passed
@maliasadi maliasadi deleted the gdecomp_empty_rule branch April 27, 2026 20:32
@maliasadi maliasadi added this to the delightning milestone Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants