PennyLaneAI / PennyLaneAI/catalyst
Possible optimization opportunity
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 234
- Forks
- 84
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 66
Description
Parse time increases with the number of instructions in the IR. There are some operations in the IR that could be cached. Instead of generating the same operation twice, just use the result of its value where appropriate. The functions safe_cast and extract_scalar in jax_primitives.py may be cached if they are used within the same function. It is unclear how valuable this caching may be since applying cse in MLIR should get rid of these. However, if there are many operations that can be cse'd directly generated by the MLIR code-gen in Python, it may be advantageous to cache these.
Contributor guide
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.
Research direction
Start in jax_primitives.py by reading safe_cast and extract_scalar and tracing their call sites within a single function. Measure parse time and inspect whether repeated operations are already removed by MLIR CSE; done means establishing whether caching provides a meaningful benefit and defining the affected scope.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers, performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100