Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Diagnostics

Every error and warning carries a code. The command line prints it with the source line it points at, the language server sends it to the editor, and Python raises it inside qirc.CompileError. qirc explain <code> prints a longer explanation of any of them, and a mistyped option, emit kind or gate name gets a suggestion of the nearest valid one.

Reading the source

CodeMeaning
QIR0001a character that cannot start any LLVM IR token
QIR0002a @, % or ! with no name after it
QIR0003a string literal that never closes
QIR0100a syntax error in LLVM IR or OpenQASM, such as a missing token, an unknown gate or an index out of range

Lowering

CodeMeaning
QIR0200an operation qirc cannot lower, such as a qubit that cannot be resolved at compile time or recursion with no bound
QIR0201the module has no entry point
QIR0202the program uses more qubits or results than qirc can address

Checking the program

CodeMeaning
QIR0300the Base Profile forbids branching
QIR0301the Base Profile forbids reading a measurement result
QIR0302a qubit outside the declared register
QIR0303a gate uses the same qubit twice
QIR0304a gate has the wrong number of parameters
QIR0305a gate has the wrong number of targets
QIR0306a result outside the declared results
QIR0307a branch to a block that does not exist
QIR0308a result read before it is measured

The profile comes from the qir_profiles attribute on the entry point, and the declared counts from required_num_qubits and required_num_results. A Base Profile program that needs branching can declare adaptive_profile instead.

Targeting

CodeMeaning
QIR0400the program cannot be routed onto the coupling map, usually because it needs more qubits than the map has or the map is not connected
QIR0401a warning that the gate set has no exact form for some gates, which are left as written; --epsilon approximates them instead
QIR0402--epsilon cannot approximate a rotation, because the set lacks h or t or the precision is below about 1e-10