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

XaccQuantum: Fix broken ccx (Toffoli) #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ausbin
Copy link
Collaborator

@ausbin ausbin commented Oct 8, 2024

The current handling of ccx has two problems in HEAD:

  1. It is defined with two qubit operands instead of three
  2. The implementation in XaccQuantum attempts to create an XACC instruction that does not exist

Problem 1 manifests as this assertion tripped inside QIR-EE:

$ build/bin/qir-xacc -i test/data/bell_ccx.ll --accelerator qpp
terminate called after throwing an instance of 'qiree::RuntimeError'
  what():  /home/austin/Documents/school/gatech/grad/qsvt/qiree/src/qiree/detail/FunctionChecker.hh:116:
qir-ee: runtime error: arg_size == irfunc_.arg_size() failed:
    incorrect QIR binding supplied: '__quantum__qis__ccx__body' has 3 arguments but QIR-EE expected 2
Aborted

Problem 2 pops up when XACC throws the following exception:

$ build/bin/qir-xacc -i test/data/bell_ccx.ll --accelerator qpp
terminate called after throwing an instance of 'std::runtime_error'
  what():  Invalid instruction name - CCX
Aborted

This commit fixes both issues.

The current handling of ccx has two problems in HEAD:

1. It is defined with two qubit operands instead of three
2. The implementation in XaccQuantum attempts to create an XACC
   instruction that does not exist

Problem ORNL-QCI#1 manifests as this assertion tripped inside QIR-EE:

    $ build/bin/qir-xacc -i test/data/bell_ccx.ll --accelerator qpp
    terminate called after throwing an instance of 'qiree::RuntimeError'
      what():  /home/austin/Documents/school/gatech/grad/qsvt/qiree/src/qiree/detail/FunctionChecker.hh:116:
    qir-ee: runtime error: arg_size == irfunc_.arg_size() failed:
        incorrect QIR binding supplied: '__quantum__qis__ccx__body' has 3 arguments but QIR-EE expected 2
    Aborted

Problem ORNL-QCI#2 pops up when XACC throws the following exception:

    $ build/bin/qir-xacc -i test/data/bell_ccx.ll --accelerator qpp
    terminate called after throwing an instance of 'std::runtime_error'
      what():  Invalid instruction name - CCX
    Aborted

This commit fixes both issues.
@ausbin ausbin requested a review from sethrj October 8, 2024 05:20
@sethrj sethrj added the bug Something isn't working label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants