Skip to content

Releases: microsoft/qsharp

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

v1.10.1

01 Nov 21:07
b700869
Compare
Choose a tag to compare

We are excited to release v1.10 of the Azure Quantum Development Kit! This month's release includes several new features and improvements including:

Code editing improvements

Code editing is now greatly improved. A couple of examples of the many improvements:

  • Context aware completions (#1947) show only the relevant completions for the location. For example, only showing types when in a type position:

    image
  • Namespace member (#1947) completion lists are now provided when drilling into namespaces:

    image
  • User Defined Type (#1954) member completions are now populated

    image

And much more! Parser error recovery has also been greatly improved so that editor assistance is available whilst mid-edit in many more scenarios.

Noisy simulation

You can now add Pauli noise to simulations run from Python or VS Code (#1971, #1975, #1980). This can help model the results of running on a real quantum machine for education purposes, and to help develop and test the effectiveness of error correction.

Below shows the results of configuring 5% bit-flip noise in VS Code and running a histogram on the GHZ sample. This would return only $\ket{000}$ and $\ket{111}$ shot results if run in a noise free simulation.

image

To see how to use noisy simulation in Python, check out the sample notebook at https://github.com/microsoft/qsharp/blob/main/samples/notebooks/noise.ipynb

Refreshed API docs interface

The in-editor Q# API documentation has had a UI refresh (#1978). This is accessed via the "Q#: Show API documentation" command in the command palette when editing a Q# file. The new UX allows you to quickly & easily search & navigate the APIs within your project, referenced projects, and the standard library.

image

File icons

The Q# file extension (.qs) now gets a unique icon in VS Code (#1976)

image

Custom measurements and resets

Previously you could define custom gates, but not custom measurement or reset operations. With #1967, #1981, and #1985 this is now possible. This allows for the definition and use of custom operations for quantum simulation and QIR code generation.

Samples for this feature will be added shortly, in the meantime see the test code at https://github.com/microsoft/qsharp/blob/v1.10.1/compiler/qsc/src/codegen/tests.rs#L529 for an example of how this may be used.

Python telemetry

In this release we have added telemetry to our qsharp Python package to collect minimal and anonymous metrics on feature usage and performance. This will allow us to focus our investments going forward on the most valuable areas. Please see the notes in the package readme for details on what is collected and how to disable it.

What's changed

And much more!! See the below list of changes in this release for the full details.

Full Changelog: v1.9.0...v1.10.1