PennyLaneAI / PennyLaneAI/catalyst

[Frontent] Review the topological sorting algorithm used in the two-staged tracing

Open
#284 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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 Box used for dependency tracking?

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.