PennyLaneAI / PennyLaneAI/catalyst

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

Open
#2,767 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

compiler enhancement
Dominant language
Python
Stars
234
Forks
84
Avg merge
2d 15h
Merged PRs (30d)
66

Description

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())

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the graph_decomposition entry point and reproduce the failure using the Python example in the issue. Trace the underlying MLIR pass and GraphSolverFailedError handling; done means an unavailable path produces a concise handled error instead of an uncaught C++ exception and excessive output.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.