Verbatim Compilation with OpenQASM 3.0 - Amazon Braket

Verbatim Compilation with OpenQASM 3.0

When you run a quantum circuit on quantum computers from Rigetti, and IonQ, you can direct the compiler to run your circuits exactly as defined, without any modifications. This feature is known as verbatim compilation. With Rigetti devices, you can specify precisely what gets preserved—​either an entire circuit or only specific parts of it. To preserve only specific parts of a circuit, you’ll need to use native gates within the preserved regions. Currently, IonQ only supports verbatim compilation for the entire circuit, so every instruction in the circuit needs to be enclosed in a verbatim box.

With OpenQASM, you can specify a verbatim pragma around a box of code that is untouched and not optimized by the low-level compilation routine of the hardware. The following code example shows how to use the #pragma braket verbatim.

OPENQASM 3; bit[2] c; #pragma braket verbatim box{ rx(0.314159) $0; rz(0.628318) $0, $1; cz $0, $1; } c[0] = measure $0; c[1] = measure $1;

For more information on verbatim compilation, see the Verbatim compilation sample notebook.