Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptive Profile QIR generation #1294

Closed
64 tasks done
cesarzc opened this issue Mar 21, 2024 · 0 comments
Closed
64 tasks done

Adaptive Profile QIR generation #1294

cesarzc opened this issue Mar 21, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@cesarzc
Copy link
Contributor

cesarzc commented Mar 21, 2024

The work to generate QIR that is compliant with the Adaptive Profile specification can be divided into a few major categories.

Runtime Capabilities Analysis (RCA)

RCA is the process of determining the capabilities a quantum kernel needs to be able to run a particular program. RCA also identifies program elements that can be pre-computed before execution on a quantum kernel and does not consider these elements when determining the capabilities.

Runtime Capabilities Check Pass

Once RCA has identified the capabilities needed to run a particular program, it can be used to check whether the program can run on a particular target, and if not, provide compile-time feedback to the user about why.

Partial Evaluation

Partial evaluation is the process of generating a residual program by evaluating all purely classical computations. It starts with an entry expression for a program in the Flattened Intermediate Representation (FIR), uses RCA to identify purely classical computations and produces a program in the Residualized Intermediate Representation (RIR).

RIR Transformation Passes

Some patterns might require enough complexity to eliminate or transform that they are better separated into RIR -> RIR transformation passes. This allows both the Partial Evaluation that precedes this step and the QIR Generation that follows to remain focused on their specific complexities.

QIR Generation

Once the compiler has performed partial evaluation and transformed the program into RIR, the compiler uses it as input to the code generation step, which produces specification-compliant QIR in text form.

Integration

As the other four major pieces are completed, they can start being integrated into the rest of the QDK.

End-to-end Testing

  • Test correctness of program execution on QIR targets

Release

Related Items

@cesarzc cesarzc added the enhancement New feature or request label Mar 21, 2024
github-merge-queue bot pushed a commit that referenced this issue Apr 8, 2024
)

In order to support adaptive profile selection in VS we have to add
`Adaptive` as a compilation attribute in the std lib. This is a
workaround until we design a full solution to address #996. This PR adds
adaptive as a profile.

Functionality to enable adaptive profile VSCode is hidden behind a
config value, as is using the preview QIR code generation from VSCode.

QIR generation for Adaptive/Unrestricted from Python will continue to
raise exceptions.

Adaptive is a profile allowed in the Python APIs, but warnings will be
issued to users indicating that this functionality is in preview.

The language service will surface RCA errors in VSCode and Python, but
not the Notebooks (will be handled in a follow up PR).
Other integration features are being tracked in #1294 and this PR is not
expected to have all functionality enabled.

---------

Co-authored-by: Alex Hansen <[email protected]>
Co-authored-by: Stefan J. Wernli <[email protected]>
Co-authored-by: Mine Starks <[email protected]>
@cesarzc cesarzc closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants