softwareQinc / staq

Full-stack quantum processing toolkit
https://iopscience.iop.org/article/10.1088/2058-9565/ab9359/pdf
MIT License
154 stars 28 forks source link

Ambiguous results from staq -S -f quil -o quil_output.txt add_3_5.qasm #6

Closed DevelopDaily closed 4 years ago

DevelopDaily commented 4 years ago

When staq -S -f quil -o quil_output.txt add_3_5.qasm is run, the result is produced in the quil_output.txt file. But the execution also crashes with this exception:

Quil instruction set has no support for local ancillas

Is the result in the quil_output.txt valid? I mean, a result is usually considered invalid if a crash happens. If it is valid, an info log should be used instead of an exception.

By the way, thanks for the previous fix. That works fine now.

meamy commented 4 years ago

The result in quil_output.txt in this case should not be considered valid. It may (or may not be) syntactically valid Quil code, but it won't correctly implement the given program (add_3_5.qasm).

You can get around this by adding an --inline or -i pass, which will allocate appropriate ancillas. Ideally the Quil compiler would do this automatically, so we'll have to think of the best way to handle that. Leaving this open for now.

DevelopDaily commented 4 years ago

Good to know. Thanks.

Since the -i is included in the pass -m or -O2, now I run with them when Quil or Cirq, which does not support ancillae either, is used.