-
Notifications
You must be signed in to change notification settings - Fork 101
QIR
Quantum Intermediate Representation (QIR) is a program representation based on LLVM IR. It is developed by the QIR Alliance at https://github.com/qir-alliance/qir-spec
The Q# compiler built as part of this repository can only compile Q# programs to QIR. As not all quantum hardware accepts jobs in QIR format, the tools built from this repository cannot target all hardware.
QIR specifies different profiles for different hardware capabilities. Currently, this toolset can only generate code for the 'base' profile, which does not allow for things such as mid-circuit measurement or performing classical computation at runtime. The adaptive profile is currently being specified, and we hope to have the compiler in this repo support it soon.
Q# code that runs in the local simulator is not limited to any subset of QIR described in a 'profile'. We refer to this as 'full' QIR. When developing Q# code, you can set the QIR profile to target via either the "Set the Azure Quantum QIR target profile" command (as shown below) or clicking on the editor status bar which will display the current target profile (either "QIR:Base" or "QIR:Full").
![image](https://private-user-images.githubusercontent.com/993909/268763047-f7f8441f-3356-431b-a27e-067bd76b7a7d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzNTE0MDgsIm5iZiI6MTczOTM1MTEwOCwicGF0aCI6Ii85OTM5MDkvMjY4NzYzMDQ3LWY3Zjg0NDFmLTMzNTYtNDMxYi1hMjdlLTA2N2JkNzZiN2E3ZC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjEyJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxMlQwOTA1MDhaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01NTlmN2I2NzE1YzFhNDhlOTZiODY4NWRlOGM5M2M4MmMwMTk4ZjdkNmE5N2VlM2RlZTVjMDEwYmM5YmZlY2U5JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.E-39_YferbJ4jKyHs29sQfM6xCB_57B0HJsAXQpR2R4)
If the current program cannot generate base profile compliant QIR code, you will get errors in the editor when targeting "QIR:Base". If the program is valid, you can view the generated QIR via the "Get QIR for the current Q# program" menu item (also shown in the clipping above).