Skip to content

Releases: microsoft/qsharp

v1.20.0

26 Aug 19:25
73ca361
Compare
Choose a tag to compare

Below are some of the highlights for the 1.20 release of the QDK.

QIR target profile selection redesign

In previous releases, the target QIR profile setting for code generation in VS Code was a global setting, and if switching between projects with different target profiles the user would need to remember to change the editor setting each time. This was cumbersome and a common source of confusion.

With this release, the target profile can be set per project. If working on a multi-file project with a qsharp.json manifest file, the target profile can be specified in the manifest file via the "targetProfile" property.

If working in a standalone Q# or OpenQASM file, the target profile can be specified via the @EntryPoint attribute in Q# files, or the qdk.qir.profile pragma in OpenQASM files. For example, to target a Q# file for base profile code generation:

@EntryPoint(Base)
operation Main() : Result[] {
    // ...
}

If submitting a job to the Azure Quantum service, upon submission the target profile will default to the capabilities of the target hardware if not otherwise specified.

See the QDK Profile Selection wiki page for more details and examples.

OpenQASM improvements

  • Arrays and complex numbers can now be passed as input and output.
  • Qubit aliases and array concatenation are now supported.
  • In VS Code, OpenQASM files now support:
    • Rename symbol (F2) for user-defined identifiers, gates, functions, etc; built-ins are not renameable.
    • Go to Definition (F12) and Find All References (Shift+F12).
  • The GitHub Copilot tools for the QDK now support OpenQASM (.qasm) files as well as Q#. You can simulate your program, generate a circuit diagram and generate resource estimates for Q# and OpenQASM programs right from the chat panel.

Python interop improvements

In addition to primitive types, arrays, and tuples, users can now pass Q# structs. For example, the following shows passing a python object to a Q# operation that takes struct:

Complex numbers are also supported, allowing the passing of Python complex literals and variables directly to Q# callables, e.g.

import qsharp

qsharp.eval("""
    import Std.Math.Complex;

    function SwapComponents(c: Complex) : Complex {
        new Complex { Real = c.Imag, Imag = c.Real }
    }
    """)

from qsharp.code import SwapComponents
assert SwapComponents(2 + 3j) == 3 + 2j

For more details on Python and Q# interop see our wiki page.

Richer Copilot help for Q# APIs

In this release, we added a new Copilot tool that can access the documentation generated by all the APIs available in the current project (included the standard library and referenced libraries). This lets Copilot see up-to-date information on the Q# libraries available and how to use them, improving Copilot's working knowledge of Q#. From generated Q# snippets to answering questions about available APIs, Copilot can use this to provide more accurate and up-to-date information.

Language service improvements

Numerous improvements to the language service have been made for correctness and completeness, especially around import and export declarations. The language service now also provides better diagnostics for QIR generation errors. Please log issues if you encounter any problems!

Other notable changes

Full Changelog: v1.19.0...v1.20.0

v1.19.0

25 Jul 20:25
02b037f
Compare
Choose a tag to compare

Below are some of the highlights for the 1.19 release of the QDK.

Simulating qubit loss

Simulation in the QDK can now model qubit loss, which can occur with some probability on some modalities.

For simulations run directly in VS Code, such as using the 'Histogram' CodeLens, this can be controlled via a VS Code setting. The screenshot below shows setting qubit loss to 0.5% and running a Bell pair simulation. For convenience, the VS Code setting is easily accessible from a link on the histogram window (shown in a red circle below).

image

The qubit loss probability can also be specified if running a simulation via the Python API.

result = qsharp.run("BellPair()", 100, qubit_loss=0.5)
display(qsharp_widgets.Histogram(result))

There is also a new Q# API for detecting a loss result:

operation CheckForLoss() : Unit {
    use q = Qubit();
    H(q);
    let res = MResetZ(q);
    if IsLossResult(res) {
        // Handle qubit loss here
    } else {
        // Handle Zero or One result
    }
}

You can find more details in the sample Jupyter Notebook at https://github.com/microsoft/qsharp/blob/main/samples/notebooks/noise.ipynb.

Debugger improvements

When debugging, previously if you navigated up the call stack using the area circled below, the Locals view would not change context to reflect the state of the variables in the selected stack frame. This has now been implemented.

image

Call stacks reported when a runtime error occurs now also show the source location for each frame in the call stack.

OpenQASM improvements

We have continued to improve support for OpenQASM. For example, you can now use readonly arrays as arguments to subroutines and the builtin sizeof function, which allows you to query the size of arrays.

def static_array_example(readonly array[int, 3, 4] a) {
    // The returned value for static arrays is const.
    const uint dim_1 = sizeof(a, 0);
    const uint dim_2 = sizeof(a, 1);
}

def dyn_array_example(readonly array[int, #dim = 2] a) {
    // The 2nd argument is inferred to be 0 if missing.
    uint dim_1 = sizeof(a);
    uint dim_2 = sizeof(a, 1);
}

This release also adds many other built-in functions, as well as pragmas to specify the semantics and code generation for box statements.

For more examples of the OpenQASM support see the samples at https://github.com/microsoft/qsharp/tree/main/samples/OpenQASM or the Jupyter Notebook at https://github.com/microsoft/qsharp/blob/main/samples/notebooks/openqasm.ipynb.

Test improvements

A challenge when writing tests for code intended to run on hardware was that the test code would also be restricted to what could run on hardware. For example, if the target profile is set to base then mid-circuit measurements and result comparisons are not possible, which limits the validation a test can do. Trying to verify a measurement result in a test would previously result in errors such as using a bool value that depends on a measurement result is not supported by the configured target profile.

In this release we have relaxed the checks performed on code marked with the @Test attribute, so such code is valid regardless of the target hardware profile:

image

Azure Quantum job reporting

When submitting jobs to Azure using the VS Code "Quantum Workspaces" explorer view, previously jobs would use the v1 reporting format, which does not include details for each shot's results. The default format for job submission in this release is now v2, which includes the results of each shot.

We also added an additional icon beside successfully completed jobs so the results may be shown as a histogram or as the raw text. The below screenshot shows fetching both formats from a completed job.

image

Other notable changes

Full Changelog: v1.18.0...v1.19.0

v1.18.0

24 Jun 18:27
fed61c0
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.17.0...v1.18.0

v1.17.0

28 May 15:39
f7569f4
Compare
Choose a tag to compare

We are excited to announce the v1.17 release of the Azure Quantum Development Kit. Highlights of this release include:

OpenQASM support

We've added extensive support for the OpenQASM language. This provides editor support (syntax highlighting, intellisense, semantic errors), simulation, integration with Q#, and QIR code generation, amongst other features.

image

See the wiki page at https://github.com/microsoft/qsharp/wiki/OpenQASM for more details.

Copilot improvements

We've improved the GitHub Copilot integration with this release. See the details at https://github.com/microsoft/qsharp/wiki/Make-the-most-of-the-QDK-and-VS-Code-agent-mode

Circuit editor improvements

We have further improved the ability to edit circuit diagrams. See the detail at https://github.com/microsoft/qsharp/wiki/Circuit-Editor

What's Changed

Full Changelog: v1.16.0...v1.17.0

v1.16.0

01 May 20:00
9851719
Compare
Choose a tag to compare

We are excited to release v1.16 of the Quantum Development Kit. The big features of this release are:

Copilot integration

With VS Code Copilot integration you can now use Copilot to to assist with many tasks such as writing code, generating tests, connecting to an Azure Quantum workspace, submit jobs to run on hardware, and more!

image

See the wiki page at https://github.com/microsoft/qsharp/wiki/Make-the-most-of-the-QDK-and-VS-Code-agent-mode for more info, as well as tips and best practices.

Circuit Editor

You can now add .qsc files to your project which provide a drag-and-drop circuit editor user interface to create quantum operations, which can then be called from your Q# code.

image

See the wiki page at https://github.com/microsoft/qsharp/wiki/Circuit-Editor for more details.

What's Changed

Other notable changes are listed below

New Contributors

Full Changelog: v1.15.0...v1.16.0

v1.15.0

31 Mar 19:50
92ffe30
Compare
Choose a tag to compare

Notable Changes

New QuantumArithmetic library

This release is the first to add the QuantumArithmetic library by @fedimser to the list of suggested libraries! Check out more about the library at https://github.com/fedimser/quant-arith-re.

Measurement and qubit reuse decompositions handled in QIR generation

This change addresses a long-standing point of confusion regarding how programs compiled for QIR Base profile are displayed in places like the circuit visualizer. By delaying application of decompositions for deferred measurement and avoidance of qubit reuse to the QIR generation step, the stdlib implementation of measurement no longer needs to have a different implementation for Base profile vs other profiles. This should make the displayed circuits match the written code more often. See #2230 for more details.

Other Changes

New Contributors

Full Changelog: v1.14.0...v1.15.0

v1.14.0

28 Feb 00:24
a6b04b1
Compare
Choose a tag to compare

Notable Changes

Full Changelog: v1.13...v1.14.0

v1.13

31 Jan 18:45
515b087
Compare
Choose a tag to compare

We are excited to release v1.13 of the Azure Quantum Development Kit! Here are some highlights of features included in this month's release:

@Test Attribute and VS Code Test Explorer Integration

#2095 Introduced a new attribute, @Test, which identifies unit tests written in Q#. By integrating with the Text Explorer feature in VS Code, you can now explore, run, and review Q# unit test execution:
image
See the wiki page on Testing Q# Code in VS Code for more information.

"Q#: Add Project Reference" VS Code Command Enhancements

#2079 enhanced the VS Code command for adding references to a Q# project, available when editing a qsharp.json file:
image
When invoking the command, you'll now see a choice to either import from GitHub or search the currently opened workspace for other Q# projects. When choosing GitHub, you'll get a suggestion of known libraries and their available versions to choose from, and the corresponding external project reference snippet will automatically be added to your current qsharp.json:
image
image

More Python Interoperability for Callables

#2091 added more support for using Python functions that wrap Q# callables across our Python package APIs. This makes it easier to pass Python arguments into Q# for features like resource estimation with qsharp.estimate(), running multiple shots with qsharp.run(), compiling to QIR with qsharp.compile(), or generating circuits with qsharp.circuit():
image
For more information on using Q# callables directly in Python, see the Invoking Q# Callables from Python wiki page.

Adaptive Profile Floating-Point Computation Extension

#2078 added support for an additional QIR Adaptive profile extension: floating-point computation. By choosing QIR Adaptive RIF as your compilation profile, you can enable Reset, Integer computation, and Floating-point computation for code generation. This allows you to write programs where the values of variables with Q# type Double can be dyanmically calculated from measurement results at runtime, and the output QIR will include arithmetic and comparison instructions corresponding to your code, enabling even more adaptive algorithms.
image

Note that this profile extension must be supported by the target backend or runtime environment for the resulting code to execute. See the QIR specification section on Classical Computation extensions to the Adaptive profile for more details.

Other Notable Features and Fixes

New Contributors

Full Changelog: v1.12...v1.13

v1.12

20 Dec 20:46
939e2aa
Compare
Choose a tag to compare

We are excited to release v1.12 of the Azure Quantum Development Kit! Here are some highlights of features included in this month's release:

Python interoperability improvements

You can now import and invoke your Q# callables for simulation directly from Python as functions. Your callables defined in %%qsharp magic cells, through calls to qsharp.eval, or loaded from projects in qsharp.init can now be imported from the qsharp.code module:

import qsharp

qsharp.eval("""
    operation Superposition() : Result {
        use q = Qubit();
        H(q);
        Std.Diagnostics.DumpMachine();
        MResetZ(q)
    }
    """)

from qsharp.code import Superposition
result = Superposition()

For more details and current limitations, see Invoking Q# callables from Python in the wiki.

Syntax for capturing state dumps from DumpMachine or DumpRegister and operation matrices from DumpOperation calls in your Q# code has also been improved (see #2042)

Deprecation of set keyword

The set keyword used for updating mutable values is now deprecated, so where you previously had to use set x += 1 you can now just write x += 1. In addition, the compiler includes a new lint that defaults to "allow" that you can use to warn or error on usage of set in your code (see #2062).

ApplyUnitary operation for simulation

When running against the simulator, your Q# code can call ApplyUnitary and pass a unitary matrix represented by a Std.Math.Complex[][] along with an array of qubit targets and have the simulator directly apply that unitary to the current sparse state vector.

Increase minimum versions for Python and Ubuntu

Starting with v1.12, the minimum supported Python version for the qsharp package is Python 3.9. Along with this change, the minimum compatible version of Ubuntu has been increased to 22.04 (see #2061)

Full Changelog: v1.11.1...v1.12

v1.11.1

05 Dec 18:53
ac1704c
Compare
Choose a tag to compare

We are excited to release v1.11.1 of the Azure Quantum Development Kit! This month's release includes features and bug fixes, such as:

Configure Pauli Noise Dynamically within Q#

You can now use the ConfigurePauliNoise function to dynamically update noise settings during simulation, allowing samples, exercises, or test code to directly set noise used in testing (#1997).

Stabilization of the Microsoft.Quantum.Unstable libraries

The Arithmetic, StatePreparation, and TableLookup libraries have been stabilized and are now available under Std. Several samples and libraries have been updated to reflect the new location, while the Microsoft.Quantum.Unstable namespace will be preserved for backward compatibility (#2022, #2043).

Support for Qiskit v1.3.0

Changes made to the Qiskit target class in v1.3.0 that broke interoperability with the qsharp Python package are now handled dynamically allowing use of both v1.2 and v1.3 versions of Qiskit (#2050).

Other Notable Changes

New Contributors

Full Changelog: v1.10.1...v1.11.1