annotate-invalid-gradient-functions fails on call chains deeper than 9 functions
Maintainers usually reply within 1 day
@JohannesWittmann9 is already working on this.
Since Nov 17, 2026.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start by locating AnnotateInvalidGradientFunctionsPass and its greedy pattern rewrite, then read how the pass visits functions and applies MLIR's iteration limit. Reproduce the failure with a measurement at the bottom of a call chain of at least 10 functions, comparing caller-before-callee and callee-before-caller order. Done means compilation succeeds regardless of function order; the issue names no test file, so find the relevant pass tests in the repository.
Written by the indexing model from the issue text.
Description
Description
AnnotateInvalidGradientFunctionsPass fails on modules where a measurement sits at the bottom of a call chain 9 or more calls deep. The pass seems to mark one more caller per iteration of the greedy pattern rewriter. Once the chain is longer than the default maximum number of iterations (10), the rewrite doesn’t converge and compilation fails. With callers defined before callees, the same chains (tested up to 50) pass, so the result depends on the order the functions are visited.
This introduces a bug in Qrisp, which is was fixing by removing the pass for the pipeline. This however is no long term solution so a fix in catalyst would be appropriate. (eclipse-qrisp/Qrisp#886)
Suggested fix
The GreedyPatternRewriter of MLIR stops after maximum number of iterations (defaults to 10) and I think the walk order matters. Currently I do not see a way of accessing the config of the GreedyPatternRewriter. So setting a different walking strategy or increased number of iterations would be my idea.
Notes
I would be happy to work on this, as it would help us with fixing our bug. 😄
- Dominant language
- Python
- Stars
- 234
- Forks
- 84
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 84
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PennyLaneAI/catalyst
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
PennyLaneAI/catalyst#3489 ·
Maintainers usually reply within 1 day
-
Fix platform tag for macOS wheelsMay be free again @sarehaskari17 claimed this 89 days ago, and no pull request is open. OpenCI/Build enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
PennyLaneAI/catalyst#2907 · 2 comments ·
Maintainers usually reply within 1 day
-
The docs page for `CompileOptions` is missing a description for the `target` attributePossibly taken @daxsh2803 claimed this 50 days ago. Opendocumentation
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
PennyLaneAI/catalyst#2653 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 78/100
PennyLaneAI/catalyst#3488 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 43/100
PennyLaneAI/catalyst#3487 ·
Maintainers usually reply within 1 day
All issues in PennyLaneAI/catalyst
Similar issues
-
bug good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
aws-samples/sample-spec-driven-presentation-maker#648 ·
Maintainers usually reply within 1 day
-
firestore: enable live window.yaml pipeline system tests once add_window_fields is in productionOpen
Difficulty 1/5 Under an hour Newbie friendliness 64/100
googleapis/google-cloud-python#19115 ·
Maintainers usually reply within 2 days
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day