munich-quantum-toolkit / munich-quantum-toolkit/debugger

🐛 Custom Gate Definitions don't follow OpenQASM standard

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

Nobody has claimed this yet.

bug c++
Dominant language
C++
Stars
21
Forks
7
Avg merge
9h 28m
Merged PRs (30d)
42

Description

Environment information

Any environment

Description

Two aspects of the OpenQASM standard are not respected by the current implementation for custom gates:

  • Custom gate definitions cannot access underlying registers, only the qubits that were passed to them. The current implementation assumes this is possible, so dome of the parsing and data dependency logic is incorrect, and assertions can access quantum registers even in custom gate definitions.
  • Custom gate definitions should also support angle parameters, which, at the moment, they don't.
Expected behavior

Something like this should not work:

qreg q[3];
gate test t {
    assert-ent t, q[0];
}

Something like this should work:

gate test(x) t {
    ...
}
How to Reproduce

Run the two code snippets above in the debugger.

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 running the two OpenQASM snippets in the debugger and tracing the custom-gate parsing and data-dependency logic mentioned in the report. Done means register access from inside a custom gate is rejected while angle parameters in custom gate definitions are accepted.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
quantum-computing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.