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

Refactor IonTrapTwoQubitPass to use visitor pattern #496

Open
1tnguyen opened this issue Nov 22, 2021 · 3 comments
Open

Refactor IonTrapTwoQubitPass to use visitor pattern #496

1tnguyen opened this issue Nov 22, 2021 · 3 comments

Comments

@1tnguyen
Copy link
Member

Using visitor pattern to implement the CNOT -> XX decomposition in IonTrapTwoQubitPass IRTransformation
to improve code readability and maintainability.

e.g., decompose 2-qubit gates into CNOT gates then revisit, etc.

@stevescia
Copy link

Hi, i'd would like to work on this issue as an assignee ; i have started the coding using the gitpod environment, following the vistor pattern; i'm currently looking at how totest the new code..

@1tnguyen
Copy link
Member Author

1tnguyen commented Nov 7, 2022

Thanks @stevescia. I've assigned this to you. There is an existing test for this feature.

@stevescia
Copy link

Thien, I have the basics of the visitor pattern implemented and the unittests pass.

I am seeing that the cnot visitor is being triggered by the "XX" instruction, leading to additional instructions being added to the composite.. not sure if this is a bug, or an expected side offect of the visit instructions inside AllGateVisitor.hpp for the xx gate. please advise if something can be impl'd to avoid this trigger.

i worked around the above with a name check, in the CNOT visitor like:

    if (currInst->name() != std::string("CNOT"))
    {
        // found "XX" name; don't continue
        return;
    }
    
    // cnot visitor code continues 

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

No branches or pull requests

2 participants