PennyLaneAI / PennyLaneAI/catalyst

Make `cancel_inverses` also apply to gates through control flows

Open
#1,066 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

Currently cancel_inverses does not detect potential opportunities if they are separated across the boundary of control flow constructs, e.g. for(4){Hadamard} or Hadamard, if(cond){True: Identity, False: Hadamard}. Being able to detect these opportunities would be a good addition.

This issue is more general than cancel_inverses. We essentially want to have an analysis available without having to explicitly unroll loops or hoist conditionals, since these could be expensive and are not guaranteed to happen.

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 by tracing the cancel_inverses analysis and how the project represents control-flow constructs. Investigate the examples involving for(4){Hadamard} and conditional branches without explicitly unrolling loops or hoisting conditionals. Done means inverse opportunities are detected across these boundaries while preserving the requested general analysis.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.