diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml deleted file mode 100644 index 143313aa57e..00000000000 --- a/.github/workflows/automerge.yml +++ /dev/null @@ -1,38 +0,0 @@ -# This action allows using the automerge label to automatically merge in pull requests that have been reviewed and that pass -# status checks (similar to the autocomplete functionality of Azure DevOps). -name: automerge -on: - pull_request: - # Note that we only support automerge on branches that have required checks. - branches: - - main - - feature/* - types: - - labeled - - unlabeled - - synchronize - - opened - - edited - - ready_for_review - - reopened - - unlocked - pull_request_review: - # Note that we only support automerge on branches that have required checks. - branches: - - main - - feature/* - types: - - submitted - check_suite: - types: - - completed - status: {} -jobs: - automerge: - runs-on: ubuntu-latest - steps: - - name: automerge - uses: "pascalgn/automerge-action@4536e8847eb62fe2f0ee52c8fa92d17aa97f932f" - env: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - MERGE_METHOD: squash diff --git a/AdvantageBenchmark/privateBuild/host.csproj b/AdvantageBenchmark/privateBuild/host.csproj index 8d5f842e956..f6576ae8481 100644 --- a/AdvantageBenchmark/privateBuild/host.csproj +++ b/AdvantageBenchmark/privateBuild/host.csproj @@ -1,4 +1,4 @@ - + diff --git a/AdvantageBenchmark/releasedBuild/quantum/quantum.csproj b/AdvantageBenchmark/releasedBuild/quantum/quantum.csproj index c12da957ec4..aa2a2ab5f59 100644 --- a/AdvantageBenchmark/releasedBuild/quantum/quantum.csproj +++ b/AdvantageBenchmark/releasedBuild/quantum/quantum.csproj @@ -1,4 +1,4 @@ - + diff --git a/global.json b/global.json new file mode 100644 index 00000000000..f9fa3ed4ed8 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "msbuild-sdks": { + "Microsoft.Quantum.Sdk": "0.15.210324735-alpha" + } +} diff --git a/src/Qir/Runtime/build-qir-runtime.ps1 b/src/Qir/Runtime/build-qir-runtime.ps1 index d9e8f6e06df..f9c1ee2aa06 100644 --- a/src/Qir/Runtime/build-qir-runtime.ps1 +++ b/src/Qir/Runtime/build-qir-runtime.ps1 @@ -6,3 +6,18 @@ if (-not (Build-CMakeProject $PSScriptRoot "QIR Runtime")) { throw "At least one project failed to compile. Check the logs." } + +# Copy the results of runtime compilation and the corresponding headers to the drops folder so +# they can be included in pipeline artifacts. +$qirDropsFolder = (Join-Path $Env:DROPS_DIR QIR) +$qirDropsBin = (Join-Path $qirDropsFolder bin) +$qirDropsInclude = (Join-Path $qirDropsFolder include) +if (-not (Test-Path $qirDropsFolder)) { + New-Item -Path $qirDropsFolder -ItemType "directory" + New-Item -Path $qirDropsBin -ItemType "directory" + New-Item -Path $qirDropsInclude -ItemType "directory" +} +$qirBinaries = (Join-Path $PSScriptRoot build $Env:BUILD_CONFIGURATION bin *) +$qirIncludes = (Join-Path $PSScriptRoot public *) +Copy-Item $qirBinaries $qirDropsBin +Copy-Item $qirIncludes $qirDropsInclude \ No newline at end of file diff --git a/src/Qir/Samples/StandaloneInputReference/qsharp/qir-standalone-input-reference.csproj b/src/Qir/Samples/StandaloneInputReference/qsharp/qir-standalone-input-reference.csproj index cb77ce14d52..9c141f761d3 100644 --- a/src/Qir/Samples/StandaloneInputReference/qsharp/qir-standalone-input-reference.csproj +++ b/src/Qir/Samples/StandaloneInputReference/qsharp/qir-standalone-input-reference.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/src/Qir/Tests/FullstateSimulator/qsharp/qir-test-simulator.csproj b/src/Qir/Tests/FullstateSimulator/qsharp/qir-test-simulator.csproj index 7e736af46ba..95dacab3142 100644 --- a/src/Qir/Tests/FullstateSimulator/qsharp/qir-test-simulator.csproj +++ b/src/Qir/Tests/FullstateSimulator/qsharp/qir-test-simulator.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/src/Qir/Tests/QIR-dynamic/qsharp/qir-test-random.csproj b/src/Qir/Tests/QIR-dynamic/qsharp/qir-test-random.csproj index 7e736af46ba..95dacab3142 100644 --- a/src/Qir/Tests/QIR-dynamic/qsharp/qir-test-random.csproj +++ b/src/Qir/Tests/QIR-dynamic/qsharp/qir-test-random.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/src/Qir/Tests/QIR-static/qir-test-math.cpp b/src/Qir/Tests/QIR-static/qir-test-math.cpp index b544ce5c6a1..545d869c436 100644 --- a/src/Qir/Tests/QIR-static/qir-test-math.cpp +++ b/src/Qir/Tests/QIR-static/qir-test-math.cpp @@ -116,6 +116,12 @@ TEST_CASE("QIR: Math.DrawRandomInt", "[qir.math][qir.Math.DrawRandomInt]") REQUIRE(0 == strcmp(exc.what(), Quantum::Qis::Internal::excStrDrawRandomVal)); } + // Test equal minimum and maximum: + for(uint64_t num: { -5, 0, 3 } ) + { + REQUIRE(Microsoft__Quantum__Testing__QIR__Math__TestDrawRandomInt__body(num, num) == num); + } + // There is a strong difference in the opinions about how the random number generator must be tested. // More or less agreed-upon items are: // * The test must be 100% deterministic, i.e. must not fail, even with a very low probability. diff --git a/src/Qir/Tests/QIR-static/qsharp/qir-gen.csproj b/src/Qir/Tests/QIR-static/qsharp/qir-gen.csproj index 7e736af46ba..95dacab3142 100644 --- a/src/Qir/Tests/QIR-static/qsharp/qir-gen.csproj +++ b/src/Qir/Tests/QIR-static/qsharp/qir-gen.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/src/Qir/Tests/QIR-tracer/qsharp/tracer-qir.csproj b/src/Qir/Tests/QIR-tracer/qsharp/tracer-qir.csproj index b1204402fee..28851db2b95 100644 --- a/src/Qir/Tests/QIR-tracer/qsharp/tracer-qir.csproj +++ b/src/Qir/Tests/QIR-tracer/qsharp/tracer-qir.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/src/Simulation/QCTraceSimulator.Tests/Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj b/src/Simulation/QCTraceSimulator.Tests/Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj index c98eb6272f9..7487816bd2c 100644 --- a/src/Simulation/QCTraceSimulator.Tests/Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj +++ b/src/Simulation/QCTraceSimulator.Tests/Tests.Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/Simulation/QSharpCore/Microsoft.Quantum.QSharp.Core.csproj b/src/Simulation/QSharpCore/Microsoft.Quantum.QSharp.Core.csproj index d1377eef1db..dc81d3a7563 100644 --- a/src/Simulation/QSharpCore/Microsoft.Quantum.QSharp.Core.csproj +++ b/src/Simulation/QSharpCore/Microsoft.Quantum.QSharp.Core.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/Simulation/QSharpFoundation/Microsoft.Quantum.QSharp.Foundation.csproj b/src/Simulation/QSharpFoundation/Microsoft.Quantum.QSharp.Foundation.csproj index 52dba66d82a..61086c0577c 100644 --- a/src/Simulation/QSharpFoundation/Microsoft.Quantum.QSharp.Foundation.csproj +++ b/src/Simulation/QSharpFoundation/Microsoft.Quantum.QSharp.Foundation.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/Simulation/QSharpFoundation/Random/Intrinsic.qs b/src/Simulation/QSharpFoundation/Random/Intrinsic.qs index df6dc83534e..2232e824088 100644 --- a/src/Simulation/QSharpFoundation/Random/Intrinsic.qs +++ b/src/Simulation/QSharpFoundation/Random/Intrinsic.qs @@ -17,7 +17,7 @@ namespace Microsoft.Quantum.Random { /// probability. /// /// # Remarks - /// Fails if `max <= min`. + /// Fails if `max < min`. /// /// # Example /// The following Q# snippet randomly rolls a six-sided die: @@ -45,7 +45,7 @@ namespace Microsoft.Quantum.Random { /// uniform probability. /// /// # Remarks - /// Fails if `max <= min`. + /// Fails if `max < min`. /// /// # Example /// The following Q# snippet randomly draws an angle between $0$ and $2 \pi$: diff --git a/src/Simulation/QSharpFoundation/Random/Uniform.qs b/src/Simulation/QSharpFoundation/Random/Uniform.qs index 34c65b39e5e..4e818c4a91f 100644 --- a/src/Simulation/QSharpFoundation/Random/Uniform.qs +++ b/src/Simulation/QSharpFoundation/Random/Uniform.qs @@ -20,7 +20,7 @@ namespace Microsoft.Quantum.Random { /// interval from `min` to `max` with uniform probability. /// /// # Remarks - /// Fails if `max <= min`. + /// Fails if `max < min`. /// /// # Example /// The following Q# snippet randomly draws an angle between $0$ and $2 \pi$: @@ -34,7 +34,7 @@ namespace Microsoft.Quantum.Random { function ContinuousUniformDistribution( min : Double, max : Double ) : ContinuousDistribution { - Fact(max > min, $"Max must be larger than min, but {max} <= {min}."); + Fact(max >= min, $"Max must be greater than or equal to min, but {max} < {min}."); return ContinuousDistribution(Delay(DrawRandomDouble, (min, max), _)); } @@ -52,7 +52,7 @@ namespace Microsoft.Quantum.Random { /// range from `min` to `max` with uniform probability. /// /// # Remarks - /// Fails if `max <= min`. + /// Fails if `max < min`. /// /// # Example /// The following Q# snippet randomly rolls a six-sided die: @@ -64,7 +64,7 @@ namespace Microsoft.Quantum.Random { /// # See Also /// - Microsoft.Quantum.DrawRandomDouble function DiscreteUniformDistribution(min : Int, max : Int) : DiscreteDistribution { - Fact(max > min, $"Max must be larger than min, but {max} <= {min}."); + Fact(max >= min, $"Max must be greater than or equal to min, but {max} < {min}."); return DiscreteDistribution(Delay(DrawRandomInt, (min, max), _)); } diff --git a/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/HoneywellExe.csproj b/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/HoneywellExe.csproj index 987e278c078..5871ff2ff88 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/HoneywellExe.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/HoneywellExe/HoneywellExe.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj b/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj index 5c063998b54..d7d7a1a54c1 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/IntrinsicTests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/Random/Tests.qs b/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/Random/Tests.qs index aff82adbc8a..c646960b606 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/Random/Tests.qs +++ b/src/Simulation/Simulators.Tests/TestProjects/IntrinsicTests/Random/Tests.qs @@ -74,10 +74,25 @@ namespace Microsoft.Quantum.Tests { @Test("QuantumSimulator") @Test("ToffoliSimulator") operation CheckDrawRandomIntObeysRanges() : Unit { - let randomInt = DrawRandomInt(0, 45); + mutable randomInt = DrawRandomInt(0, 45); if (randomInt > 45 or randomInt < 0) { fail $"DrawRandomInt(0, 45) returned {randomInt}, outside the allowed range."; } + + set randomInt = DrawRandomInt(0, 0); + if (randomInt > 0 or randomInt < 0) { + fail $"DrawRandomInt(0, 0) returned {randomInt}, outside the allowed range."; + } + + set randomInt = DrawRandomInt(-3, -3); + if (randomInt > -3 or randomInt < -3) { + fail $"DrawRandomInt(-3, -3) returned {randomInt}, outside the allowed range."; + } + + set randomInt = DrawRandomInt(3, 3); + if (randomInt > 3 or randomInt < 3) { + fail $"DrawRandomInt(3, 3) returned {randomInt}, outside the allowed range."; + } } /// # Summary diff --git a/src/Simulation/Simulators.Tests/TestProjects/IonQExe/IonQExe.csproj b/src/Simulation/Simulators.Tests/TestProjects/IonQExe/IonQExe.csproj index 3b186e08215..b7174ebb94c 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/IonQExe/IonQExe.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/IonQExe/IonQExe.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/src/Simulation/Simulators.Tests/TestProjects/Library with Spaces/Library with Spaces.csproj b/src/Simulation/Simulators.Tests/TestProjects/Library with Spaces/Library with Spaces.csproj index 8b1fbf8c2a3..9c8c6fd2480 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/Library with Spaces/Library with Spaces.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/Library with Spaces/Library with Spaces.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 false diff --git a/src/Simulation/Simulators.Tests/TestProjects/Library1/Library1.csproj b/src/Simulation/Simulators.Tests/TestProjects/Library1/Library1.csproj index 48b812702f8..1f7acf76a3b 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/Library1/Library1.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/Library1/Library1.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 diff --git a/src/Simulation/Simulators.Tests/TestProjects/Library2/Library2.csproj b/src/Simulation/Simulators.Tests/TestProjects/Library2/Library2.csproj index 48b812702f8..1f7acf76a3b 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/Library2/Library2.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/Library2/Library2.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 diff --git a/src/Simulation/Simulators.Tests/TestProjects/QCIExe/QCIExe.csproj b/src/Simulation/Simulators.Tests/TestProjects/QCIExe/QCIExe.csproj index 98e4d30c374..2648435540a 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/QCIExe/QCIExe.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/QCIExe/QCIExe.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/src/Simulation/Simulators.Tests/TestProjects/QSharpExe/QSharpExe.csproj b/src/Simulation/Simulators.Tests/TestProjects/QSharpExe/QSharpExe.csproj index dc408dca7c1..62480f0c4b9 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/QSharpExe/QSharpExe.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/QSharpExe/QSharpExe.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj b/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj index 349020ac927..36a8baf3953 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/TargetedExe/TargetedExe.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/src/Simulation/Simulators.Tests/TestProjects/UnitTests/UnitTests.csproj b/src/Simulation/Simulators.Tests/TestProjects/UnitTests/UnitTests.csproj index 5dfcfa22e2a..2ca92152c99 100644 --- a/src/Simulation/Simulators.Tests/TestProjects/UnitTests/UnitTests.csproj +++ b/src/Simulation/Simulators.Tests/TestProjects/UnitTests/UnitTests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/src/Simulation/Simulators.Tests/Tests.Microsoft.Quantum.Simulators.csproj b/src/Simulation/Simulators.Tests/Tests.Microsoft.Quantum.Simulators.csproj index ad5665079a5..0826716cabc 100644 --- a/src/Simulation/Simulators.Tests/Tests.Microsoft.Quantum.Simulators.csproj +++ b/src/Simulation/Simulators.Tests/Tests.Microsoft.Quantum.Simulators.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/Simulation/Simulators.Type1.Tests/Tests.Microsoft.Quantum.Simulators.Type1.csproj b/src/Simulation/Simulators.Type1.Tests/Tests.Microsoft.Quantum.Simulators.Type1.csproj index b17ad34d8fb..71409c5094f 100644 --- a/src/Simulation/Simulators.Type1.Tests/Tests.Microsoft.Quantum.Simulators.Type1.csproj +++ b/src/Simulation/Simulators.Type1.Tests/Tests.Microsoft.Quantum.Simulators.Type1.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/Simulation/Simulators.Type2.Tests/Tests.Microsoft.Quantum.Simulators.Type2.csproj b/src/Simulation/Simulators.Type2.Tests/Tests.Microsoft.Quantum.Simulators.Type2.csproj index 74d4ccd7a52..603f2743d26 100644 --- a/src/Simulation/Simulators.Type2.Tests/Tests.Microsoft.Quantum.Simulators.Type2.csproj +++ b/src/Simulation/Simulators.Type2.Tests/Tests.Microsoft.Quantum.Simulators.Type2.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/Simulation/Simulators.Type3.Tests/Tests.Microsoft.Quantum.Simulators.Type3.csproj b/src/Simulation/Simulators.Type3.Tests/Tests.Microsoft.Quantum.Simulators.Type3.csproj index 7c20b5b5144..a4d0ebfcfa6 100644 --- a/src/Simulation/Simulators.Type3.Tests/Tests.Microsoft.Quantum.Simulators.Type3.csproj +++ b/src/Simulation/Simulators.Type3.Tests/Tests.Microsoft.Quantum.Simulators.Type3.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj b/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj index 2d6c28e2ea4..fc0ebd9fa52 100644 --- a/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj +++ b/src/Simulation/Simulators/Microsoft.Quantum.Simulators.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/Simulation/Simulators/QuantumSimulator/SimulatorBase.cs b/src/Simulation/Simulators/QuantumSimulator/SimulatorBase.cs index c84cb17936f..8ef72b66aa0 100644 --- a/src/Simulation/Simulators/QuantumSimulator/SimulatorBase.cs +++ b/src/Simulation/Simulators/QuantumSimulator/SimulatorBase.cs @@ -469,16 +469,16 @@ public DrawRandomInt(SimulatorBase m) : base(m) => public override Func<(long, long), long> __Body__ => arg => { var (min, max) = arg; - if (max <= min) + if (max < min) { - throw new ExecutionFailException($"Max must be greater than min, but {max} <= {min}."); + throw new ExecutionFailException($"Max must be greater than or equal to min, but {max} < {min}."); } return sim.RandomGenerator.NextLong(min, max); }; } /// - /// Implements the DrawRandomInt operation from the + /// Implements the DrawRandomDouble operation from the /// Microsoft.Quantum.Random namespace. /// public class DrawRandomDouble : Random.DrawRandomDouble @@ -490,9 +490,9 @@ public DrawRandomDouble(SimulatorBase m) : base(m) => public override Func<(double, double), double> __Body__ => arg => { var (min, max) = arg; - if (max <= min) + if (max < min) { - throw new ExecutionFailException($"Max must be greater than min, but {max} <= {min}."); + throw new ExecutionFailException($"Max must be greater than or equal to min, but {max} < {min}."); } var delta = max - min; return min + delta * sim.RandomGenerator.NextDouble(); diff --git a/src/Simulation/Type1Core/Microsoft.Quantum.Type1.Core.csproj b/src/Simulation/Type1Core/Microsoft.Quantum.Type1.Core.csproj index 01cd806308e..596f3d916e2 100644 --- a/src/Simulation/Type1Core/Microsoft.Quantum.Type1.Core.csproj +++ b/src/Simulation/Type1Core/Microsoft.Quantum.Type1.Core.csproj @@ -1,10 +1,8 @@ - - + Type1 Targeting support for the Q# programming language. true - diff --git a/src/Simulation/Type2Core/Microsoft.Quantum.Type2.Core.csproj b/src/Simulation/Type2Core/Microsoft.Quantum.Type2.Core.csproj index a361e1e571f..04be8cf4395 100644 --- a/src/Simulation/Type2Core/Microsoft.Quantum.Type2.Core.csproj +++ b/src/Simulation/Type2Core/Microsoft.Quantum.Type2.Core.csproj @@ -1,4 +1,4 @@ - + diff --git a/src/Simulation/Type3Core/Microsoft.Quantum.Type3.Core.csproj b/src/Simulation/Type3Core/Microsoft.Quantum.Type3.Core.csproj index 58a9ad93720..68057cc6f92 100644 --- a/src/Simulation/Type3Core/Microsoft.Quantum.Type3.Core.csproj +++ b/src/Simulation/Type3Core/Microsoft.Quantum.Type3.Core.csproj @@ -1,4 +1,4 @@ - +