Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: Can only build replacement circuits for basic gates: QControlBox #585

Open
ACE07-Sev opened this issue Sep 4, 2024 · 3 comments

Comments

@ACE07-Sev
Copy link

Greetings there,

Hope you are well. I am trying to add tket2 to my library, and noticed that it doesn't support QControlBox. May I know when this would be added?

@ACE07-Sev
Copy link
Author

For the moment, I found that by setting rebase=False resolves the issue.

@ss2165
Copy link
Member

ss2165 commented Sep 25, 2024

Hello, could you say a bit more about how you were using tket2, which function were you calling?

@ACE07-Sev
Copy link
Author

Greetings there,

Hope you are well. Gosh, I'm really embarrassed, I actually forgot to add the reproduction code. Really sorry about that. I believe I was running this:

from pytket import Circuit, OpType
from pytket.circuit import Op, QControlBox
from tket2.circuit import Tk2Circuit, render_circuit_mermaid
from tket2.passes import badger_pass


setattr(
    Tk2Circuit,
    "_repr_markdown_",
    lambda self: f"```mermaid\n{render_circuit_mermaid(self)}\n```"
)

c = Circuit(3)
CX = QControlBox(Op.create(OpType.X), 1)
c.add_qcontrolbox(CX, [0, 1])

badger_pass(rebase=False).apply(c)

But now I'm getting a new error (which I wasn't getting before):

thread '<unnamed>' panicked at tket2-py/src/optimiser.rs:32:73:
called `Result::unwrap()` on an `Err` value: Deserialisation(Syntax("unknown variant `CustomOp`, expected one of `Module`, `FuncDefn`, `FuncDecl`, `AliasDecl`, `AliasDefn`, `Const`, `Input`, `Output`, `Call`, `CallIndirect`, `LoadConstant`, `LoadFunction`, `DFG`, `Extension`, `Tag`, `DataflowBlock`, `ExitBlock`, `TailLoop`, `CFG`, `Conditional`, `Case`"))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants