PennyLaneAI / PennyLaneAI/catalyst
[Frontent] Review the topological sorting algorithm used in the two-staged tracing
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 234
- Forks
- 84
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 66
Description
The future improvement reminder issue. The nested tape tracer introduced by https://github.com/PennyLaneAI/catalyst/pull/240 relies on the topological sorting which might need reviewing. The sorting is used as the final step in the merging of two lists of JAX equations: one list containing classical equation and the other one induced by the quantum tape. Currently the sorting uses JAX variables for building dependencies which may lead to correct yet ill-ordered flow of equations.
Some questions worth answering:
- Could/should we preserve the original flow of equations as close as possible?
- Could we simplify the sorting algorithm by removing
Boxused for dependency tracking?
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 with frontend/catalyst/utils/jax_extras.py around line 163 and review the nested tape tracer introduced by pull request #240. Trace how the classical and quantum-tape equation lists are merged, then determine whether original equation flow should be preserved and whether Box-based dependency tracking can be removed; completion requires a decided and validated sorting approach.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100