Skip to content

Better error message when no path can be found in Graph decomposition #2767

@rniczh

Description

@rniczh

When the graph solver cannot find a path to the requested gate_set, the underlying MLIR pass throws an uncaught C++ exception. When this happens, you may see many lines on the screen before you reach the error message below.

[libc++abi: terminating due to uncaught exception of type
  DecompGraph::Core::GraphSolverFailedError: Decomposition rule not found for operator](libc++abi: terminating due to uncaught exception of type DecompGraph::Core::GraphSolverFailedError: Decomposition rule not found for operator 'Toffoli[w:3][p:0]')

Reproduce:

import pennylane as qp
from catalyst import qjit
from catalyst.passes import graph_decomposition

@qjit(capture=True)
@graph_decomposition(gate_set={qp.RX})
@qp.qnode(qp.device("lightning.qubit", wires=3))
def t(): 
    qp.Toffoli([0,1,2])
    return qp.state()

print(t())

Metadata

Metadata

Assignees

No one assigned

    Labels

    compilerPull requests that update the compilerenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions