From 3bf085b352c1116f9866ee78daf4564e1b7e557e Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Tue, 12 Jul 2022 11:19:53 -0700 Subject: [PATCH 01/12] Pass Assembly Constants in to GenerateBitcode --- src/Core/Compiler/CompilerService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Core/Compiler/CompilerService.cs b/src/Core/Compiler/CompilerService.cs index 1e5434d722..a3db74616a 100644 --- a/src/Core/Compiler/CompilerService.cs +++ b/src/Core/Compiler/CompilerService.cs @@ -414,6 +414,12 @@ string WrapInNamespace(Snippet s) => var (qsCompilation, assemblyConstants) = this.UpdateCompilation(sources, metadata.QsMetadatas, logger, compileAsExecutable, executionTarget, capability, parent: perfTask); logger.WarningCodesToIgnore.Remove(QsCompiler.Diagnostics.WarningCode.EntryPointInLibrary); + var assebmlyConstants = new Dictionary + { + [AssemblyConstants.TargetCapability] = capability?.Name, + [AssemblyConstants.ProcessorArchitecture] = executionTarget + }; + if (logger.HasErrors || qsCompilation == null) return null; try @@ -454,7 +460,7 @@ string WrapInNamespace(Snippet s) => var tempPath = Path.GetTempFileName(); var bcFile = CompilationLoader.GeneratedFile(tempPath, Path.GetDirectoryName(tempPath), ".bc", ""); var diagnostics = new List(); - CompilationSteps.GenerateBitcode(qsCompilation, capability, bcFile, diagnostics: diagnostics); + CompilationSteps.GenerateBitcode(qsCompilation, assebmlyConstants, bcFile, diagnostics: diagnostics); foreach (var diagnostic in diagnostics) { Logger?.Log( From 1225d74501876d401c41bf85e6aad437aeb8819a Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Tue, 12 Jul 2022 15:20:11 -0700 Subject: [PATCH 02/12] Get the processor architecture from the execution target. --- src/Core/Compiler/CompilerService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Core/Compiler/CompilerService.cs b/src/Core/Compiler/CompilerService.cs index a3db74616a..351343a1cf 100644 --- a/src/Core/Compiler/CompilerService.cs +++ b/src/Core/Compiler/CompilerService.cs @@ -414,10 +414,16 @@ string WrapInNamespace(Snippet s) => var (qsCompilation, assemblyConstants) = this.UpdateCompilation(sources, metadata.QsMetadatas, logger, compileAsExecutable, executionTarget, capability, parent: perfTask); logger.WarningCodesToIgnore.Remove(QsCompiler.Diagnostics.WarningCode.EntryPointInLibrary); + string processorArchitecture = "Any"; + if (!(executionTarget is null) && executionTarget.ToLower() == "microsoft.simulator.fullstate") + { + processorArchitecture = AssemblyConstants.MicrosoftSimulator; + } + var assebmlyConstants = new Dictionary { [AssemblyConstants.TargetCapability] = capability?.Name, - [AssemblyConstants.ProcessorArchitecture] = executionTarget + [AssemblyConstants.ProcessorArchitecture] = processorArchitecture }; if (logger.HasErrors || qsCompilation == null) return null; From 0fab00439e569a0d9ed6a5363355a6c92ee99a0d Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Thu, 25 Aug 2022 10:12:51 -0700 Subject: [PATCH 03/12] versions --- src/AzureClient/AzureClient.csproj | 2 +- src/Core/Core.csproj | 10 +++--- .../ExecutionPathTracer.csproj | 2 +- src/Kernel/Kernel.csproj | 2 +- .../Mock.Chemistry/Mock.Chemistry.csproj | 4 +-- .../Mock.Standard/Mock.Standard.csproj | 4 +-- .../ProjectA.csproj | 2 +- .../ProjectB.csproj | 2 +- .../Workspace.ProjectReferences.csproj | 4 +-- src/Tool/appsettings.json | 36 +++++++++---------- 10 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/AzureClient/AzureClient.csproj b/src/AzureClient/AzureClient.csproj index 8ec0e7b71c..d27b44c804 100644 --- a/src/AzureClient/AzureClient.csproj +++ b/src/AzureClient/AzureClient.csproj @@ -17,7 +17,7 @@ - + diff --git a/src/Core/Core.csproj b/src/Core/Core.csproj index b16c693670..93154d33d0 100644 --- a/src/Core/Core.csproj +++ b/src/Core/Core.csproj @@ -40,11 +40,11 @@ - - - - - + + + + + diff --git a/src/ExecutionPathTracer/ExecutionPathTracer.csproj b/src/ExecutionPathTracer/ExecutionPathTracer.csproj index 88a26d93f3..781c02e8f0 100644 --- a/src/ExecutionPathTracer/ExecutionPathTracer.csproj +++ b/src/ExecutionPathTracer/ExecutionPathTracer.csproj @@ -32,7 +32,7 @@ - + diff --git a/src/Kernel/Kernel.csproj b/src/Kernel/Kernel.csproj index a43f63ca8c..d9abf59131 100644 --- a/src/Kernel/Kernel.csproj +++ b/src/Kernel/Kernel.csproj @@ -26,7 +26,7 @@ - + diff --git a/src/MockLibraries/Mock.Chemistry/Mock.Chemistry.csproj b/src/MockLibraries/Mock.Chemistry/Mock.Chemistry.csproj index e8617bccaa..eb35739f80 100644 --- a/src/MockLibraries/Mock.Chemistry/Mock.Chemistry.csproj +++ b/src/MockLibraries/Mock.Chemistry/Mock.Chemistry.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 @@ -6,6 +6,6 @@ - + diff --git a/src/MockLibraries/Mock.Standard/Mock.Standard.csproj b/src/MockLibraries/Mock.Standard/Mock.Standard.csproj index e8617bccaa..eb35739f80 100644 --- a/src/MockLibraries/Mock.Standard/Mock.Standard.csproj +++ b/src/MockLibraries/Mock.Standard/Mock.Standard.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 @@ -6,6 +6,6 @@ - + diff --git a/src/Tests/Workspace.ProjectReferences.ProjectA/ProjectA.csproj b/src/Tests/Workspace.ProjectReferences.ProjectA/ProjectA.csproj index 56acd3af2d..3b91e6a23c 100644 --- a/src/Tests/Workspace.ProjectReferences.ProjectA/ProjectA.csproj +++ b/src/Tests/Workspace.ProjectReferences.ProjectA/ProjectA.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 diff --git a/src/Tests/Workspace.ProjectReferences.ProjectB/ProjectB.csproj b/src/Tests/Workspace.ProjectReferences.ProjectB/ProjectB.csproj index 3f697e86eb..ea2c974af5 100644 --- a/src/Tests/Workspace.ProjectReferences.ProjectB/ProjectB.csproj +++ b/src/Tests/Workspace.ProjectReferences.ProjectB/ProjectB.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 diff --git a/src/Tests/Workspace.ProjectReferences/Workspace.ProjectReferences.csproj b/src/Tests/Workspace.ProjectReferences/Workspace.ProjectReferences.csproj index 5adbf01cc4..31e975009d 100644 --- a/src/Tests/Workspace.ProjectReferences/Workspace.ProjectReferences.csproj +++ b/src/Tests/Workspace.ProjectReferences/Workspace.ProjectReferences.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 @@ -7,7 +7,7 @@ - + diff --git a/src/Tool/appsettings.json b/src/Tool/appsettings.json index 15a88a77b8..dca6076b6d 100644 --- a/src/Tool/appsettings.json +++ b/src/Tool/appsettings.json @@ -6,23 +6,23 @@ }, "AllowedHosts": "*", "DefaultPackageVersions": [ - "Microsoft.Quantum.Compiler::0.25.218240", - "Microsoft.Quantum.CSharpGeneration::0.25.218240", - "Microsoft.Quantum.QirGeneration::0.25.218240", - "Microsoft.Quantum.Development.Kit::0.25.218240", - "Microsoft.Quantum.Simulators::0.25.218240", - "Microsoft.Quantum.Xunit::0.25.218240", - "Microsoft.Quantum.Standard::0.25.218240", - "Microsoft.Quantum.Standard.Visualization::0.25.218240", - "Microsoft.Quantum.Chemistry::0.25.218240", - "Microsoft.Quantum.Chemistry.Jupyter::0.25.218240", - "Microsoft.Quantum.MachineLearning::0.25.218240", - "Microsoft.Quantum.Numerics::0.25.218240", - "Microsoft.Quantum.Katas::0.25.218240", - "Microsoft.Quantum.Research::0.25.218240", - "Microsoft.Quantum.Providers.IonQ::0.25.218240", - "Microsoft.Quantum.Providers.Honeywell::0.25.218240", - "Microsoft.Quantum.Providers.QCI::0.25.218240", - "Microsoft.Quantum.Providers.Rigetti::0.25.218240" + "Microsoft.Quantum.Compiler::0.25.227074-beta", + "Microsoft.Quantum.CSharpGeneration::0.25.227074-beta", + "Microsoft.Quantum.QirGeneration::0.25.227074-beta", + "Microsoft.Quantum.Development.Kit::0.25.227074-beta", + "Microsoft.Quantum.Simulators::0.25.227074-beta", + "Microsoft.Quantum.Xunit::0.25.227074-beta", + "Microsoft.Quantum.Standard::0.25.227074-beta", + "Microsoft.Quantum.Standard.Visualization::0.25.227074-beta", + "Microsoft.Quantum.Chemistry::0.25.227074-beta", + "Microsoft.Quantum.Chemistry.Jupyter::0.25.227074-beta", + "Microsoft.Quantum.MachineLearning::0.25.227074-beta", + "Microsoft.Quantum.Numerics::0.25.227074-beta", + "Microsoft.Quantum.Katas::0.25.227074-beta", + "Microsoft.Quantum.Research::0.25.227074-beta", + "Microsoft.Quantum.Providers.IonQ::0.25.227074-beta", + "Microsoft.Quantum.Providers.Honeywell::0.25.227074-beta", + "Microsoft.Quantum.Providers.QCI::0.25.227074-beta", + "Microsoft.Quantum.Providers.Rigetti::0.25.227074-beta" ] } From 2b82bdc2fc56fd00c464b347f7b99e3f3b87d2ed Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 26 Aug 2022 11:29:16 -0700 Subject: [PATCH 04/12] Removed special handling for Microsoft simulator for cloud jobs. --- src/AzureClient/AzureClient.cs | 41 +--------------------------------- 1 file changed, 1 insertion(+), 40 deletions(-) diff --git a/src/AzureClient/AzureClient.cs b/src/AzureClient/AzureClient.cs index 085505dad1..3503fdae58 100644 --- a/src/AzureClient/AzureClient.cs +++ b/src/AzureClient/AzureClient.cs @@ -649,46 +649,7 @@ async Task ReadHttp() using var stream = job.OutputDataUri.IsFile ? File.OpenRead(job.OutputDataUri.LocalPath) : await ReadHttp(); - if (this.ActiveTarget?.TargetId?.StartsWith(MicrosoftSimulator) ?? false) - { - var (messages, result) = ParseSimulatorOutput(stream); - channel?.Stdout(messages); - return result.ToExecutionResult(); - } - else - { - return stream.ToHistogram(channel, Logger).ToExecutionResult(); - } - } - - private static (string Messages, string Result) ParseSimulatorOutput(Stream stream) - { - var outputLines = new List(); - using (var reader = new StreamReader(stream)) - { - var line = String.Empty; - while ((line = reader.ReadLine()) != null) - { - outputLines.Add(line.Trim()); - } - } - - // N.B. The current simulator output format is just text and it does not distinguish - // between the result of the operation and other kinds of output. - // Attempt to parse the output to distinguish the result from the rest of the output - // until the simulator output format makes it easy to do so. - var resultStartLine = outputLines.Count() - 1; - if (outputLines[resultStartLine].EndsWith('"')) - { - while (!outputLines[resultStartLine].StartsWith('"')) - { - resultStartLine -= 1; - } - } - - var messages = String.Join('\n', outputLines.Take(resultStartLine)); - var result = String.Join(' ', outputLines.Skip(resultStartLine)); - return (messages, result); + return stream.ToHistogram(channel, Logger).ToExecutionResult(); } /// From bfb6bbf372ff8d928dae600199a68f36fdbf8280 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Mon, 29 Aug 2022 13:52:43 -0700 Subject: [PATCH 05/12] Added test for IQ# change --- src/Tests/AzureClientTests.cs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/Tests/AzureClientTests.cs b/src/Tests/AzureClientTests.cs index ab0f5a00a0..0eae07a1d3 100644 --- a/src/Tests/AzureClientTests.cs +++ b/src/Tests/AzureClientTests.cs @@ -330,6 +330,37 @@ public void TestJobExecution() Assert.IsNotNull(histogram); } + [TestMethod] + public void TestMicrosoftSimulatorJobExecution() + { + var services = Startup.CreateServiceProvider("Workspace"); + var azureClient = services.GetRequiredService(); + + // connect + var targets = ExpectSuccess>(ConnectToWorkspaceAsync(azureClient)); + Assert.IsFalse(targets.Any()); + + // add a target + var azureWorkspace = azureClient.ActiveWorkspace as MockAzureWorkspace; + Assert.IsNotNull(azureWorkspace); + azureWorkspace?.AddProviders("microsoft"); + + // set the active target + var target = ExpectSuccess(azureClient.SetActiveTargetAsync(new MockChannel(), "microsoft.simulator")); + Assert.AreEqual("microsoft.simulator", target.TargetId); + + // execute the job and verify that the results are retrieved successfully + var submissionContext = new AzureSubmissionContext() + { + OperationName = "Tests.qss.HelloAgain", + InputParameters = AbstractMagic.ParseInputParameters("count=3 name=\"testing\""), + ExecutionTimeout = 5, + ExecutionPollingInterval = 1, + }; + var histogram = ExpectSuccess(azureClient.ExecuteJobAsync(new MockChannel(), submissionContext, CancellationToken.None)); + Assert.IsNotNull(histogram); + } + [TestMethod] public void TestJobExecutionWithArrayInput() { From a26e9bd63ddf6b76d3ef4b10d4092d23a189e821 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Tue, 30 Aug 2022 14:30:03 -0700 Subject: [PATCH 06/12] Differentiate logic based on job.OutputDataFormat --- src/AzureClient/AzureClient.cs | 48 +++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/src/AzureClient/AzureClient.cs b/src/AzureClient/AzureClient.cs index 3503fdae58..8572a7f43b 100644 --- a/src/AzureClient/AzureClient.cs +++ b/src/AzureClient/AzureClient.cs @@ -8,6 +8,7 @@ using System.IO; using System.Net; using System.Net.Http; +using System.Runtime.InteropServices.ComTypes; using System.Threading; using Azure.Core; @@ -649,7 +650,52 @@ async Task ReadHttp() using var stream = job.OutputDataUri.IsFile ? File.OpenRead(job.OutputDataUri.LocalPath) : await ReadHttp(); - return stream.ToHistogram(channel, Logger).ToExecutionResult(); + + if (job.OutputDataFormat == "microsoft.qir-results.v1") + { + var (messages, result) = ParseSimulatorOutput(stream); + channel?.Stdout(messages); + return result.ToExecutionResult(); + } + else if (job.OutputDataFormat == "microsoft.quantum-results.v1") + { + return stream.ToHistogram(channel, Logger).ToExecutionResult(); + } + else + { + channel?.Stderr($"Job ID {job.Id} has unsupported output format: {job.OutputDataFormat}"); + return AzureClientError.JobOutputDownloadFailed.ToExecutionResult(); + } + } + + private static (string Messages, string Result) ParseSimulatorOutput(Stream stream) + { + var outputLines = new List(); + using (var reader = new StreamReader(stream)) + { + var line = String.Empty; + while ((line = reader.ReadLine()) != null) + { + outputLines.Add(line.Trim()); + } + } + + // N.B. The current simulator output format is just text and it does not distinguish + // between the result of the operation and other kinds of output. + // Attempt to parse the output to distinguish the result from the rest of the output + // until the simulator output format makes it easy to do so. + var resultStartLine = outputLines.Count() - 1; + if (outputLines[resultStartLine].EndsWith('"')) + { + while (!outputLines[resultStartLine].StartsWith('"')) + { + resultStartLine -= 1; + } + } + + var messages = String.Join('\n', outputLines.Take(resultStartLine)); + var result = String.Join(' ', outputLines.Skip(resultStartLine)); + return (messages, result); } /// From df9cca342ecce949c5712047a56310efd5b14aaa Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Wed, 31 Aug 2022 11:30:14 -0700 Subject: [PATCH 07/12] Add output format to cloud job mocks. --- src/AzureClient/AzureClient.cs | 16 ++++++++++++++-- src/AzureClient/Mocks/MockCloudJob.cs | 8 +++++--- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/AzureClient/AzureClient.cs b/src/AzureClient/AzureClient.cs index 8572a7f43b..0b711e299d 100644 --- a/src/AzureClient/AzureClient.cs +++ b/src/AzureClient/AzureClient.cs @@ -24,6 +24,18 @@ namespace Microsoft.Quantum.IQSharp.AzureClient { + /// + /// Supported output data formats for QIR. + /// + internal static class OutputFormat + { + public const string QirResultsV1 = "microsoft.qir-results.v1"; + + public const string QuantumResultsV1 = "microsoft.quantum-results.v1"; + + public const string ResourceEstimatesV1 = "microsoft.resource-estimates.v1"; + } + /// public class AzureClient : IAzureClient { @@ -651,13 +663,13 @@ async Task ReadHttp() ? File.OpenRead(job.OutputDataUri.LocalPath) : await ReadHttp(); - if (job.OutputDataFormat == "microsoft.qir-results.v1") + if (job.OutputDataFormat == OutputFormat.QirResultsV1) { var (messages, result) = ParseSimulatorOutput(stream); channel?.Stdout(messages); return result.ToExecutionResult(); } - else if (job.OutputDataFormat == "microsoft.quantum-results.v1") + else if (job.OutputDataFormat == OutputFormat.QuantumResultsV1) { return stream.ToHistogram(channel, Logger).ToExecutionResult(); } diff --git a/src/AzureClient/Mocks/MockCloudJob.cs b/src/AzureClient/Mocks/MockCloudJob.cs index 63a20f3cbe..2dfd98d0b9 100644 --- a/src/AzureClient/Mocks/MockCloudJob.cs +++ b/src/AzureClient/Mocks/MockCloudJob.cs @@ -55,12 +55,13 @@ public float? EstimatedTotal /// internal class MockJobDetails : JobDetails { - public MockJobDetails(string containerUri, string inputDataFormat, string providerId, string target) + public MockJobDetails(string containerUri, string inputDataFormat, string providerId, string target, string outputDataFormat) : base(containerUri: containerUri, inputDataFormat: inputDataFormat, providerId: providerId, target: target) { + OutputDataFormat = outputDataFormat; } private MockCostEstimate? costEstimate; @@ -110,14 +111,15 @@ internal class MockCloudJob : CloudJob private string _id; private string? _outputFile; - public MockCloudJob(string? id = null) + public MockCloudJob(string? id = null, string outputFormat = OutputFormat.QuantumResultsV1) : base( new MockAzureWorkspace("mockSubscriptionId", "mockResourceGroupName", "mockWorkspaceName", "mockLocation"), new MockJobDetails( containerUri: string.Empty, inputDataFormat: string.Empty, providerId: string.Empty, - target: string.Empty + target: string.Empty, + outputDataFormat: outputFormat )) { _id = id ?? Guid.NewGuid().ToString(); From 394091cec27c3d2c2445b09eaac5994ce98e1c95 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Wed, 31 Aug 2022 12:00:21 -0700 Subject: [PATCH 08/12] Got a test working --- src/AzureClient/AzureClient.cs | 2 +- src/AzureClient/Mocks/MockCloudJob.cs | 11 ++++++++++- src/Tests/AzureClientTests.cs | 20 +++++++++----------- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/AzureClient/AzureClient.cs b/src/AzureClient/AzureClient.cs index 0b711e299d..5dcef255db 100644 --- a/src/AzureClient/AzureClient.cs +++ b/src/AzureClient/AzureClient.cs @@ -648,7 +648,7 @@ public async Task GetJobResultAsync(IChannel? channel, string? } } - private async Task CreateOutput(CloudJob job, IChannel? channel, CancellationToken cancellationToken) + internal async Task CreateOutput(CloudJob job, IChannel? channel, CancellationToken cancellationToken) { async Task ReadHttp() { diff --git a/src/AzureClient/Mocks/MockCloudJob.cs b/src/AzureClient/Mocks/MockCloudJob.cs index 2dfd98d0b9..6c21c9bd20 100644 --- a/src/AzureClient/Mocks/MockCloudJob.cs +++ b/src/AzureClient/Mocks/MockCloudJob.cs @@ -137,7 +137,16 @@ public override Uri OutputDataUri { var path = Path.GetTempFileName(); using var outputFile = new StreamWriter(path); - outputFile.WriteLine(@"{'Histogram':['0',0.5,'1',0.5]}"); + if (OutputDataFormat == OutputFormat.QirResultsV1) + { + outputFile.WriteLine("\"This is a message.\""); + outputFile.WriteLine("\"The is a two-line"); + outputFile.WriteLine("string result.\""); + } + else + { + outputFile.WriteLine(@"{'Histogram':['0',0.5,'1',0.5]}"); + } _outputFile = path; } diff --git a/src/Tests/AzureClientTests.cs b/src/Tests/AzureClientTests.cs index 0eae07a1d3..2a91dcab72 100644 --- a/src/Tests/AzureClientTests.cs +++ b/src/Tests/AzureClientTests.cs @@ -331,10 +331,10 @@ public void TestJobExecution() } [TestMethod] - public void TestMicrosoftSimulatorJobExecution() + public void TestJobOutputFormats() { var services = Startup.CreateServiceProvider("Workspace"); - var azureClient = services.GetRequiredService(); + var azureClient = (AzureClient)services.GetRequiredService(); // connect var targets = ExpectSuccess>(ConnectToWorkspaceAsync(azureClient)); @@ -349,16 +349,14 @@ public void TestMicrosoftSimulatorJobExecution() var target = ExpectSuccess(azureClient.SetActiveTargetAsync(new MockChannel(), "microsoft.simulator")); Assert.AreEqual("microsoft.simulator", target.TargetId); - // execute the job and verify that the results are retrieved successfully - var submissionContext = new AzureSubmissionContext() - { - OperationName = "Tests.qss.HelloAgain", - InputParameters = AbstractMagic.ParseInputParameters("count=3 name=\"testing\""), - ExecutionTimeout = 5, - ExecutionPollingInterval = 1, - }; - var histogram = ExpectSuccess(azureClient.ExecuteJobAsync(new MockChannel(), submissionContext, CancellationToken.None)); + var qirResultsJob = new MockCloudJob(null, OutputFormat.QirResultsV1); + var quantumResultsJob = new MockCloudJob(null, OutputFormat.QuantumResultsV1); + + var histogram = ExpectSuccess(azureClient.CreateOutput(quantumResultsJob, new MockChannel(), CancellationToken.None)); Assert.IsNotNull(histogram); + + var stringOutput = ExpectSuccess(azureClient.CreateOutput(qirResultsJob, new MockChannel(), CancellationToken.None)); + Assert.IsNotNull(stringOutput); } [TestMethod] From 20ca1ef3126c78638b49967ac9482ddb08315bef Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 9 Sep 2022 17:26:15 -0700 Subject: [PATCH 09/12] small changes --- src/Core/Compiler/CompilerService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Core/Compiler/CompilerService.cs b/src/Core/Compiler/CompilerService.cs index d85b4e2a10..f5da0f7805 100644 --- a/src/Core/Compiler/CompilerService.cs +++ b/src/Core/Compiler/CompilerService.cs @@ -414,8 +414,8 @@ string WrapInNamespace(Snippet s) => var (qsCompilation, assemblyConstants) = this.UpdateCompilation(sources, metadata.QsMetadatas, logger, compileAsExecutable, executionTarget, capability, parent: perfTask); logger.WarningCodesToIgnore.Remove(QsCompiler.Diagnostics.WarningCode.EntryPointInLibrary); - string processorArchitecture = "Any"; - if (!(executionTarget is null) && executionTarget.ToLower() == "microsoft.simulator.fullstate") + var processorArchitecture = "Any"; + if (string.Compare(executionTarget, "microsoft.simulator.fullstate", StringComparison.InvariantCultureIgnoreCase) == 0) { processorArchitecture = AssemblyConstants.MicrosoftSimulator; } From 0e4218f4ee7f85e055703014462598de0687e178 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 9 Sep 2022 17:53:03 -0700 Subject: [PATCH 10/12] combine uses of assemblyConstants --- src/Core/Compiler/CompilerService.cs | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/Core/Compiler/CompilerService.cs b/src/Core/Compiler/CompilerService.cs index f5da0f7805..f8a3c37ef9 100644 --- a/src/Core/Compiler/CompilerService.cs +++ b/src/Core/Compiler/CompilerService.cs @@ -304,9 +304,17 @@ public IEnumerable IdentifyElements(string source, ITaskRepo ? TargetPackageAssemblyPaths(executionTarget, capability?.Name) : Enumerable.Empty(); Logger.LogDebug("Using target package assemblies:\n{TargetAssemblies}", string.Join("\n", targetPackages)); + + var processorArchitecture = executionTarget ?? string.Empty; + if (string.Compare(executionTarget, "microsoft.simulator.fullstate", StringComparison.InvariantCultureIgnoreCase) == 0) + { + processorArchitecture = AssemblyConstants.MicrosoftSimulator; + } + var assemblyConstants = new Dictionary { - [AssemblyConstants.ProcessorArchitecture] = executionTarget ?? string.Empty, + [AssemblyConstants.ProcessorArchitecture] = processorArchitecture, + [AssemblyConstants.TargetCapability] = capability?.Name ?? string.Empty, [AssemblyConstants.TargetPackageAssemblies] = string.Join(";", targetPackages.Where(s => !string.IsNullOrWhiteSpace(s))) }; @@ -414,18 +422,6 @@ string WrapInNamespace(Snippet s) => var (qsCompilation, assemblyConstants) = this.UpdateCompilation(sources, metadata.QsMetadatas, logger, compileAsExecutable, executionTarget, capability, parent: perfTask); logger.WarningCodesToIgnore.Remove(QsCompiler.Diagnostics.WarningCode.EntryPointInLibrary); - var processorArchitecture = "Any"; - if (string.Compare(executionTarget, "microsoft.simulator.fullstate", StringComparison.InvariantCultureIgnoreCase) == 0) - { - processorArchitecture = AssemblyConstants.MicrosoftSimulator; - } - - var assebmlyConstants = new Dictionary - { - [AssemblyConstants.TargetCapability] = capability?.Name, - [AssemblyConstants.ProcessorArchitecture] = processorArchitecture - }; - if (logger.HasErrors || qsCompilation == null) return null; try @@ -466,7 +462,7 @@ string WrapInNamespace(Snippet s) => var tempPath = Path.GetTempFileName(); var bcFile = CompilationLoader.GeneratedFile(tempPath, Path.GetDirectoryName(tempPath), ".bc", ""); var diagnostics = new List(); - CompilationSteps.GenerateBitcode(qsCompilation, assebmlyConstants, bcFile, diagnostics: diagnostics); + CompilationSteps.GenerateBitcode(qsCompilation, (IDictionary)assemblyConstants, bcFile, diagnostics: diagnostics); foreach (var diagnostic in diagnostics) { Logger?.Log( From 0b3d4898415f27fbe4de838dea17fd386840a8c6 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Tue, 13 Sep 2022 16:39:07 -0700 Subject: [PATCH 11/12] use beta packages --- src/AzureClient/AzureClient.csproj | 2 +- src/Core/Core.csproj | 10 +++--- .../ExecutionPathTracer.csproj | 2 +- src/Kernel/Kernel.csproj | 2 +- .../Mock.Chemistry/Mock.Chemistry.csproj | 4 +-- .../Mock.Standard/Mock.Standard.csproj | 4 +-- src/Tests/NugetPackagesTests.cs | 2 +- .../ProjectA.csproj | 2 +- .../ProjectB.csproj | 2 +- .../Workspace.ProjectReferences.csproj | 4 +-- src/Tool/appsettings.json | 34 +++++++++---------- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/AzureClient/AzureClient.csproj b/src/AzureClient/AzureClient.csproj index 488051cc3c..1c92bb2d8c 100644 --- a/src/AzureClient/AzureClient.csproj +++ b/src/AzureClient/AzureClient.csproj @@ -17,7 +17,7 @@ - + diff --git a/src/Core/Core.csproj b/src/Core/Core.csproj index ad41df1fc9..28d25410d9 100644 --- a/src/Core/Core.csproj +++ b/src/Core/Core.csproj @@ -40,11 +40,11 @@ - - - - - + + + + + diff --git a/src/ExecutionPathTracer/ExecutionPathTracer.csproj b/src/ExecutionPathTracer/ExecutionPathTracer.csproj index d94aa9e468..03c1edcb2f 100644 --- a/src/ExecutionPathTracer/ExecutionPathTracer.csproj +++ b/src/ExecutionPathTracer/ExecutionPathTracer.csproj @@ -32,7 +32,7 @@ - + diff --git a/src/Kernel/Kernel.csproj b/src/Kernel/Kernel.csproj index 6536971c0d..a83d99aebc 100644 --- a/src/Kernel/Kernel.csproj +++ b/src/Kernel/Kernel.csproj @@ -26,7 +26,7 @@ - + diff --git a/src/MockLibraries/Mock.Chemistry/Mock.Chemistry.csproj b/src/MockLibraries/Mock.Chemistry/Mock.Chemistry.csproj index 71715316ff..48b55b5242 100644 --- a/src/MockLibraries/Mock.Chemistry/Mock.Chemistry.csproj +++ b/src/MockLibraries/Mock.Chemistry/Mock.Chemistry.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 @@ -6,6 +6,6 @@ - + diff --git a/src/MockLibraries/Mock.Standard/Mock.Standard.csproj b/src/MockLibraries/Mock.Standard/Mock.Standard.csproj index 71715316ff..48b55b5242 100644 --- a/src/MockLibraries/Mock.Standard/Mock.Standard.csproj +++ b/src/MockLibraries/Mock.Standard/Mock.Standard.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 @@ -6,6 +6,6 @@ - + diff --git a/src/Tests/NugetPackagesTests.cs b/src/Tests/NugetPackagesTests.cs index 9dcc79bf74..8212234e56 100644 --- a/src/Tests/NugetPackagesTests.cs +++ b/src/Tests/NugetPackagesTests.cs @@ -20,7 +20,7 @@ public class NugetPackagesTests /// We use a known-good version to avoid breaking IQ# tests due to changes in Libraries /// also, to make sure an end-to-end QDK build does not have circular build dependencies /// between Libraries and IQ#. - public static readonly NuGetVersion QDK_LIBRARIES_VERSION = NuGetVersion.Parse("0.25.228311"); + public static readonly NuGetVersion QDK_LIBRARIES_VERSION = NuGetVersion.Parse("0.26.230521-beta"); public NugetPackages Init() { diff --git a/src/Tests/Workspace.ProjectReferences.ProjectA/ProjectA.csproj b/src/Tests/Workspace.ProjectReferences.ProjectA/ProjectA.csproj index fc6b368125..5e32036553 100644 --- a/src/Tests/Workspace.ProjectReferences.ProjectA/ProjectA.csproj +++ b/src/Tests/Workspace.ProjectReferences.ProjectA/ProjectA.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 diff --git a/src/Tests/Workspace.ProjectReferences.ProjectB/ProjectB.csproj b/src/Tests/Workspace.ProjectReferences.ProjectB/ProjectB.csproj index 0ca6a578cc..54a6277b6f 100644 --- a/src/Tests/Workspace.ProjectReferences.ProjectB/ProjectB.csproj +++ b/src/Tests/Workspace.ProjectReferences.ProjectB/ProjectB.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 diff --git a/src/Tests/Workspace.ProjectReferences/Workspace.ProjectReferences.csproj b/src/Tests/Workspace.ProjectReferences/Workspace.ProjectReferences.csproj index d61ce37f6b..678268c915 100644 --- a/src/Tests/Workspace.ProjectReferences/Workspace.ProjectReferences.csproj +++ b/src/Tests/Workspace.ProjectReferences/Workspace.ProjectReferences.csproj @@ -1,4 +1,4 @@ - + netstandard2.1 @@ -7,7 +7,7 @@ - + diff --git a/src/Tool/appsettings.json b/src/Tool/appsettings.json index 211b812aca..5e822ba1cd 100644 --- a/src/Tool/appsettings.json +++ b/src/Tool/appsettings.json @@ -6,23 +6,23 @@ }, "AllowedHosts": "*", "DefaultPackageVersions": [ - "Microsoft.Quantum.Compiler::0.25.228311", - "Microsoft.Quantum.CSharpGeneration::0.25.228311", - "Microsoft.Quantum.QirGeneration::0.25.228311", + "Microsoft.Quantum.Compiler::0.26.230521-beta", + "Microsoft.Quantum.CSharpGeneration::0.26.230521-beta", + "Microsoft.Quantum.QirGeneration::0.26.230521-beta", "Microsoft.Quantum.Development.Kit::0.25.228311", - "Microsoft.Quantum.Simulators::0.25.228311", - "Microsoft.Quantum.Xunit::0.25.228311", - "Microsoft.Quantum.Standard::0.25.228311", - "Microsoft.Quantum.Standard.Visualization::0.25.228311", - "Microsoft.Quantum.Chemistry::0.25.228311", - "Microsoft.Quantum.Chemistry.Jupyter::0.25.228311", - "Microsoft.Quantum.MachineLearning::0.25.228311", - "Microsoft.Quantum.Numerics::0.25.228311", - "Microsoft.Quantum.Katas::0.25.228311", - "Microsoft.Quantum.Research::0.25.228311", - "Microsoft.Quantum.Providers.IonQ::0.25.228311", - "Microsoft.Quantum.Providers.Honeywell::0.25.228311", - "Microsoft.Quantum.Providers.QCI::0.25.228311", - "Microsoft.Quantum.Providers.Rigetti::0.25.228311" + "Microsoft.Quantum.Simulators::0.26.230521-beta", + "Microsoft.Quantum.Xunit::0.26.230521-beta", + "Microsoft.Quantum.Standard::0.26.230521-beta", + "Microsoft.Quantum.Standard.Visualization::0.26.230521-beta", + "Microsoft.Quantum.Chemistry::0.26.230521-beta", + "Microsoft.Quantum.Chemistry.Jupyter::0.26.230521-beta", + "Microsoft.Quantum.MachineLearning::0.26.230521-beta", + "Microsoft.Quantum.Numerics::0.26.230521-beta", + "Microsoft.Quantum.Katas::0.26.230521-beta", + "Microsoft.Quantum.Research::0.26.230521-beta", + "Microsoft.Quantum.Providers.IonQ::0.26.230521-beta", + "Microsoft.Quantum.Providers.Honeywell::0.26.230521-beta", + "Microsoft.Quantum.Providers.QCI::0.26.230521-beta", + "Microsoft.Quantum.Providers.Rigetti::0.26.230521-beta" ] } From 06997d520202187e6a35a3b902ea63290b3ed588 Mon Sep 17 00:00:00 2001 From: Scott Carda Date: Fri, 16 Sep 2022 11:02:58 -0700 Subject: [PATCH 12/12] removed unused using --- src/AzureClient/AzureClient.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/AzureClient/AzureClient.cs b/src/AzureClient/AzureClient.cs index 5dcef255db..bf757706d4 100644 --- a/src/AzureClient/AzureClient.cs +++ b/src/AzureClient/AzureClient.cs @@ -8,7 +8,6 @@ using System.IO; using System.Net; using System.Net.Http; -using System.Runtime.InteropServices.ComTypes; using System.Threading; using Azure.Core;