Skip to content

QDK Profile Selection

Scott Carda edited this page Aug 26, 2025 · 3 revisions

QIR Profiles describe what coding features different compilation targets can support. These profiles are needed during compilation to QIR to know what kind of QIR to generate. Profiles used to be selected as workspace settings in VS Code, but this has changed and that setting no longer exists.

The selection of profiles is now done in one of three ways depending on your scenario: Q# project setting, Q# @EntryPoint argument, or QASM profile pragma.

Q# Project Setting

When working with Q# projects that contain a qsharp.json file, you can set the target QIR profile by setting an optional "targetProfile" field in the JSON. Valid arguments to this field are the four supported profiles: "adaptive_ri", "adaptive_rif", "base", and "unrestricted". For example:

{
    "targetProfile": "base"
}

Q# @EntryPoint Argument

When working in a single Q# file outside of a project, you can set the target QIR profile by giving the @EntryPoint attribute an optional argument. These arguments are the names of the four supported profiles, case-agnostic. You will need to use the @EntryPoint attribute for this. For example:

@EntryPoint(Adaptive_RI)
operation Main() : Unit {}

QASM Profile Pragma

When working with QASM files, you can specify the QIR profile with the qdk.qir.profile pragma followed by the name of the profile, case-agnostic. For example:

OPENQASM 3;
#pragma qdk.qir.profile adaptive_rif

Note that the pragma, along with all non-comment content in a QASM file, has to come after the OPENQASM 3 line.

Unspecified Profile

In all these scenarios, the specification of the profile is optional. If a profile is not specified, the compilation will assume the least restrictive profile needed for the action taken. For example, generating a circuit visual locally has no special requirements, so a profile of Unrestricted will be used, but generating QIR locally requires at Adaptive_RIF capabilities, so Adaptive_RIF will be used if no profile is specified. The same is true for Azure submission: whatever the required capabilities of the target are determines the profile used in the submission, if no profile is otherwise specified.

Notes

Trying to mix the various ways of specifying QIR profile, or using the wrong way for the scenario you are in will result in error. For example, specifying profile via the @EntryPoint argument when working in a Q# project will be an error.

Clone this wiki locally