Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Q# - Preview feature: Compilation to QIR (issue 3) #1034

@bettinaheim

Description

@bettinaheim

Project Overview

We are working on adding support for compiling Q# to QIR and executing it. QIR is a convention for how to represent quantum programs in LLVM. We aim to ultimately move the Q# compiler to be fully LLVM-based.

While the support and integration is not yet complete, we have set up an example for how to compile a Q# project to QIR and execute it on our full state simulator for early adventurers who are excited to give it a try!

This GitHub issue is one of two tasks that we have defined for Unitary Hack 2021.

Task

Find a Q# program that doesn't compile correctly into QIR or unexpectedly fails when executing the QIR on the full state simulator due to an issue with the generated QIR that hasn't been filed yet, and file the issue.
Then create a PR to add a link to the created issue to the readme.

Instructions

Clone this repo and check out the unitaryhack branch. Make sure you have Clang 11 and dotnet 3.1 installed. Open the folder examples/QIR/Development in VS Code, and install the QDK extension if you have not already. Navigate to Terminal -> New Terminal and enter the command dotnet build. It may take a while until the command finishes since it will be downloading the LLVM libraries. After that, type dotnet run; you should now see the text "Executed successfully!".

Now you are all set to get started! Open Program.qs and experiment with all sorts of language constructs and patterns in Q# and see if you can get the compiler to fail. If the command dotnet run no longer succeeds, you have achieved your mission to beat the compiler!

Note:
The project has been set up to be compiled using the source code version of the compiler and QIR emission; if you make edits to the QIR generation capability, you will see those reflected in how the Development project is compiled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    unitaryhackCreated for UnitaryHack 2021

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions