From d347be93fa0a8ceebe43e7bf64224706484c7cd7 Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Thu, 8 Apr 2021 16:53:00 -0700 Subject: [PATCH 01/23] WIP implement dependencies --- .../Controller/Driver/QirDriverGenerator.cs | 10 +++- .../Executable/QirExecutableGenerator.cs | 12 +++-- src/Qir/Controller/QirController.csproj | 2 +- .../Tests.QirController/LoggerTests.cs | 11 ----- .../QirExecutableGeneratorTests.cs | 47 +++++++++++++++++++ 5 files changed, 65 insertions(+), 17 deletions(-) create mode 100644 src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs diff --git a/src/Qir/Controller/Driver/QirDriverGenerator.cs b/src/Qir/Controller/Driver/QirDriverGenerator.cs index 75711d7a056..8af4864ad18 100644 --- a/src/Qir/Controller/Driver/QirDriverGenerator.cs +++ b/src/Qir/Controller/Driver/QirDriverGenerator.cs @@ -4,6 +4,7 @@ using System.IO; using System.Threading.Tasks; using Microsoft.Quantum.Qir.Utility; +using Microsoft.Quantum.QsCompiler; using Microsoft.Quantum.QsCompiler.BondSchemas.EntryPoint; namespace Microsoft.Quantum.Qir.Driver @@ -17,9 +18,14 @@ public QirDriverGenerator(ILogger logger) this.logger = logger; } - public Task GenerateQirDriverCppAsync(EntryPointOperation entryPointOperation, FileInfo driverFile) + public async Task GenerateQirDriverCppAsync(EntryPointOperation entryPointOperation, FileInfo driverFile) { - throw new System.NotImplementedException(); + await Task.Run(() => + { + logger.LogInfo("Creating driver file."); + using var driverFileStream = driverFile.OpenWrite(); + QirDriverGeneration.GenerateQirDriverCpp(entryPointOperation, driverFileStream); + }); } } } diff --git a/src/Qir/Controller/Executable/QirExecutableGenerator.cs b/src/Qir/Controller/Executable/QirExecutableGenerator.cs index 46daf7ebb8a..d6bf98bfd36 100644 --- a/src/Qir/Controller/Executable/QirExecutableGenerator.cs +++ b/src/Qir/Controller/Executable/QirExecutableGenerator.cs @@ -9,6 +9,11 @@ namespace Microsoft.Quantum.Qir.Executable { public class QirExecutableGenerator : IQirExecutableGenerator { + private static readonly string[] LibrariesToLink = { + "Microsoft.Quantum.Qir.Runtime", + "Microsoft.Quantum.Qir.QSharp.Foundation", + "Microsoft.Quantum.Qir.QSharp.Core" + }; private readonly IClangClient clangClient; private readonly ILogger logger; @@ -18,10 +23,11 @@ public QirExecutableGenerator(IClangClient clangClient, ILogger logger) this.logger = logger; } - public Task GenerateExecutableAsync(FileInfo driverFile, FileInfo bytecodeFile, DirectoryInfo libraryDirectory, FileInfo executableFile) + public async Task GenerateExecutableAsync(FileInfo driverFile, FileInfo bytecodeFile, DirectoryInfo libraryDirectory, FileInfo executableFile) { - // TODO: Compile and link libraries- "Microsoft.Quantum.Qir.Runtime", "Microsoft.Quantum.Qir.QSharp.Foundation", "Microsoft.Quantum.Qir.QSharp.Core" - throw new System.NotImplementedException(); + logger.LogInfo("Generating executable."); + string[] inputFiles = { driverFile.FullName, bytecodeFile.FullName }; + await clangClient.CreateExecutableAsync(inputFiles, LibrariesToLink, libraryDirectory.FullName, executableFile.FullName); } } } diff --git a/src/Qir/Controller/QirController.csproj b/src/Qir/Controller/QirController.csproj index 3c7e124c26a..aff9bd1d39c 100644 --- a/src/Qir/Controller/QirController.csproj +++ b/src/Qir/Controller/QirController.csproj @@ -7,7 +7,7 @@ - 5 + 4 diff --git a/src/Qir/Controller/Tests.QirController/LoggerTests.cs b/src/Qir/Controller/Tests.QirController/LoggerTests.cs index eb180e7fecc..6c3be6f61ad 100644 --- a/src/Qir/Controller/Tests.QirController/LoggerTests.cs +++ b/src/Qir/Controller/Tests.QirController/LoggerTests.cs @@ -2,21 +2,10 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.IO; -using System.Reflection; -using System.Text.Json; -using System.Threading.Tasks; -using Microsoft.Quantum.Qir; -using Microsoft.Quantum.Qir.Driver; -using Microsoft.Quantum.Qir.Executable; -using Microsoft.Quantum.Qir.Model; using Microsoft.Quantum.Qir.Utility; -using Microsoft.Quantum.QsCompiler.BondSchemas.EntryPoint; -using Microsoft.Quantum.QsCompiler.BondSchemas.QirExecutionWrapper; using Moq; using Xunit; -using QirExecutionWrapperSerialization = Microsoft.Quantum.QsCompiler.BondSchemas.QirExecutionWrapper.Protocols; namespace Tests.QirController { diff --git a/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs b/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs new file mode 100644 index 00000000000..b5f038be401 --- /dev/null +++ b/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Quantum.Qir.Executable; +using Microsoft.Quantum.Qir.Utility; +using Moq; +using Xunit; + +namespace Tests.QirController +{ + public class QirExecutableGeneratorTests + { + private readonly Mock clangClientMock; + private readonly QirExecutableGenerator executableGenerator; + + public QirExecutableGeneratorTests() + { + clangClientMock = new Mock(); + executableGenerator = new QirExecutableGenerator(clangClientMock.Object, Mock.Of()); + } + + [Fact] + public async Task TestGenerateExecutable() + { + var driverFile = new FileInfo("driver"); + var bytecodeFile = new FileInfo("bytecode"); + var libraryDirectory = new DirectoryInfo("libraries"); + var executableFile = new FileInfo("executable"); + string[] expectedLibraries = { + "Microsoft.Quantum.Qir.Runtime", + "Microsoft.Quantum.Qir.QSharp.Foundation", + "Microsoft.Quantum.Qir.QSharp.Core", + }; + string[] expectedInputFiles = { driverFile.FullName, bytecodeFile.FullName }; + await executableGenerator.GenerateExecutableAsync(driverFile, bytecodeFile, libraryDirectory, executableFile); + clangClientMock.Verify(obj => obj.CreateExecutableAsync( + It.Is(s => s.SequenceEqual(expectedInputFiles)), + It.Is(s => s.SequenceEqual(expectedLibraries)), + libraryDirectory.FullName, + executableFile.FullName)); + } + } +} From fb064e616598a813ee719e0b24ff2a7b29064721 Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Fri, 9 Apr 2021 13:12:28 -0700 Subject: [PATCH 02/23] Implement executable generator --- .../Controller/Driver/QirDriverGenerator.cs | 13 ++- .../Executable/QirExecutableGenerator.cs | 34 +++++- .../QirExecutableGeneratorTests.cs | 107 ++++++++++++++++-- 3 files changed, 135 insertions(+), 19 deletions(-) diff --git a/src/Qir/Controller/Driver/QirDriverGenerator.cs b/src/Qir/Controller/Driver/QirDriverGenerator.cs index b3ac39c6c41..761ad77c13f 100644 --- a/src/Qir/Controller/Driver/QirDriverGenerator.cs +++ b/src/Qir/Controller/Driver/QirDriverGenerator.cs @@ -21,12 +21,13 @@ public QirDriverGenerator(ILogger logger) public Task GenerateQirDriverCppAsync(DirectoryInfo sourceDirectory, EntryPointOperation entryPointOperation, ArraySegment bytecode) { - await Task.Run(() => - { - logger.LogInfo("Creating driver file."); - using var driverFileStream = driverFile.OpenWrite(); - QirDriverGeneration.GenerateQirDriverCpp(entryPointOperation, driverFileStream); - }); + //await Task.Run(() => + //{ + // logger.LogInfo("Creating driver file."); + // using var driverFileStream = driverFile.OpenWrite(); + // QirDriverGeneration.GenerateQirDriverCpp(entryPointOperation, driverFileStream); + //}); + throw new NotImplementedException(); } } } diff --git a/src/Qir/Controller/Executable/QirExecutableGenerator.cs b/src/Qir/Controller/Executable/QirExecutableGenerator.cs index 2be5ce6d273..ed50ffc03eb 100644 --- a/src/Qir/Controller/Executable/QirExecutableGenerator.cs +++ b/src/Qir/Controller/Executable/QirExecutableGenerator.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System.IO; +using System.Linq; using System.Threading.Tasks; using Microsoft.Quantum.Qir.Utility; @@ -23,11 +24,36 @@ public QirExecutableGenerator(IClangClient clangClient, ILogger logger) this.logger = logger; } - public Task GenerateExecutableAsync(FileInfo executableFile, DirectoryInfo sourceDirectory, DirectoryInfo libraryDirectory, DirectoryInfo includeDirectory) + public async Task GenerateExecutableAsync(FileInfo executableFile, DirectoryInfo sourceDirectory, DirectoryInfo libraryDirectory, DirectoryInfo includeDirectory) { - logger.LogInfo("Generating executable."); - string[] inputFiles = { driverFile.FullName, bytecodeFile.FullName }; - await clangClient.CreateExecutableAsync(inputFiles, LibrariesToLink, libraryDirectory.FullName, executableFile.FullName); + // Wrap in a Task.Run because FileInfo methods are not asynchronous. + await Task.Run(async () => + { + var binDirectory = executableFile.Directory; + logger.LogInfo($"Creating binary directory at {binDirectory.FullName}."); + executableFile.Directory.Create(); + + // Copy all library contents to bin. + logger.LogInfo("Copying library directory contents into the executable's folder."); + var libraryFiles = libraryDirectory.GetFiles(); + foreach (var file in libraryFiles) + { + var newFile = file.CopyTo(Path.Combine(binDirectory.FullName, file.Name)); + logger.LogInfo($"Copied file {file.FullName} to {newFile.FullName}"); + } + + // Copy all include contents to bin. + logger.LogInfo("Copying include directory contents into the executable's folder."); + var includeFiles = includeDirectory.GetFiles(); + foreach (var file in includeFiles) + { + var newFile = file.CopyTo(Path.Combine(binDirectory.FullName, file.Name)); + logger.LogInfo($"Copied file {file.FullName} to {newFile.FullName}"); + } + + var inputFiles = sourceDirectory.GetFiles().Select(fileInfo => fileInfo.FullName).ToArray(); + await clangClient.CreateExecutableAsync(inputFiles, LibrariesToLink, libraryDirectory.FullName, includeDirectory.FullName, executableFile.FullName); + }); } } } diff --git a/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs b/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs index b5f038be401..c819f0fb41c 100644 --- a/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs +++ b/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -12,36 +13,124 @@ namespace Tests.QirController { - public class QirExecutableGeneratorTests + public class QirExecutableGeneratorTests : IDisposable { private readonly Mock clangClientMock; private readonly QirExecutableGenerator executableGenerator; + private readonly DirectoryInfo sourceDirectory; + private readonly DirectoryInfo includeDirectory; + private readonly DirectoryInfo libraryDirectory; + private readonly DirectoryInfo binDirectory; + private readonly IList libraryFiles; + private readonly IList sourceFiles; + private readonly IList includeFiles; public QirExecutableGeneratorTests() { clangClientMock = new Mock(); executableGenerator = new QirExecutableGenerator(clangClientMock.Object, Mock.Of()); + + // Set up files. + var prefix = Guid.NewGuid().ToString(); + binDirectory = new DirectoryInfo($"{prefix}-bin"); + binDirectory.Create(); + libraryDirectory = new DirectoryInfo($"{prefix}-library"); + libraryDirectory.Create(); + libraryFiles = new List() + { + CreateFile("lib1", libraryDirectory, "lib1 contents"), + CreateFile("lib2", libraryDirectory, "lib2 contents"), + }; + includeDirectory = new DirectoryInfo($"{prefix}-include"); + includeDirectory.Create(); + includeFiles = new List() + { + CreateFile("incl1", includeDirectory, "incl1 contents"), + CreateFile("incl2", includeDirectory, "incl2 contents"), + }; + sourceDirectory = new DirectoryInfo($"{prefix}-source"); + sourceDirectory.Create(); + sourceFiles = new List() + { + CreateFile("src1", sourceDirectory, "src1 contents"), + CreateFile("src2", sourceDirectory, "src2 contents"), + }; + } + + public void Dispose() + { + DeleteDirectory(sourceDirectory); + DeleteDirectory(includeDirectory); + DeleteDirectory(libraryDirectory); + DeleteDirectory(binDirectory); } [Fact] public async Task TestGenerateExecutable() { - var driverFile = new FileInfo("driver"); - var bytecodeFile = new FileInfo("bytecode"); - var libraryDirectory = new DirectoryInfo("libraries"); - var executableFile = new FileInfo("executable"); string[] expectedLibraries = { "Microsoft.Quantum.Qir.Runtime", "Microsoft.Quantum.Qir.QSharp.Foundation", - "Microsoft.Quantum.Qir.QSharp.Core", + "Microsoft.Quantum.Qir.QSharp.Core" }; - string[] expectedInputFiles = { driverFile.FullName, bytecodeFile.FullName }; - await executableGenerator.GenerateExecutableAsync(driverFile, bytecodeFile, libraryDirectory, executableFile); + + var executableFile = new FileInfo(Path.Combine(binDirectory.FullName, "executableFile")); + await executableGenerator.GenerateExecutableAsync(executableFile, sourceDirectory, libraryDirectory, includeDirectory); + + // Verify invocation of clang. clangClientMock.Verify(obj => obj.CreateExecutableAsync( - It.Is(s => s.SequenceEqual(expectedInputFiles)), + It.Is(s => s.SequenceEqual(sourceFiles.Select(fileInfo => fileInfo.FullName))), It.Is(s => s.SequenceEqual(expectedLibraries)), libraryDirectory.FullName, + includeDirectory.FullName, executableFile.FullName)); + + // Verify files were copied. + Assert.True(FilesWereCopied(includeFiles.ToArray(), binDirectory)); + Assert.True(FilesWereCopied(libraryFiles.ToArray(), binDirectory)); + } + + private static FileInfo CreateFile(string fileName, DirectoryInfo directory, string contents) + { + var filePath = Path.Combine(directory.FullName, fileName); + var fileInfo = new FileInfo(filePath); + using var fileStream = fileInfo.OpenWrite(); + using var streamWriter = new StreamWriter(fileStream); + streamWriter.Write(contents); + return fileInfo; + } + + private static void DeleteDirectory(DirectoryInfo directory) + { + foreach (var file in directory.GetFiles()) + { + file.Delete(); + } + directory.Delete(); + } + + private static bool FilesWereCopied(FileInfo[] files, DirectoryInfo destinationDirectory) + { + var destinationDirectoryFiles = destinationDirectory.GetFiles(); + foreach (var file in files) + { + var copiedFile = destinationDirectoryFiles.FirstOrDefault(fileInfo => fileInfo.Name == file.Name); + if (copiedFile == null) + { + return false; + } + + using var originalFileReader = file.OpenText(); + var originalFileContents = originalFileReader.ReadToEnd(); + using var copiedFileReader = copiedFile.OpenText(); + var copiedFileContents = copiedFileReader.ReadToEnd(); + if (originalFileContents != copiedFileContents) + { + return false; + } + } + + return true; } } } From 48973d4c2fb72191825623d48b899d2cac6dae52 Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Fri, 9 Apr 2021 15:07:22 -0700 Subject: [PATCH 03/23] Implement driver generator --- .../Controller/Driver/QirDriverGenerator.cs | 36 +++++++--- .../Tests.QirController/ControllerTests.cs | 12 +--- .../QirDriverGeneratorTests.cs | 65 +++++++++++++++++++ .../QirExecutableGeneratorTests.cs | 17 ++--- .../Controller/Tests.QirController/Util.cs | 30 +++++++++ 5 files changed, 129 insertions(+), 31 deletions(-) create mode 100644 src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs create mode 100644 src/Qir/Controller/Tests.QirController/Util.cs diff --git a/src/Qir/Controller/Driver/QirDriverGenerator.cs b/src/Qir/Controller/Driver/QirDriverGenerator.cs index 761ad77c13f..805f8b369fc 100644 --- a/src/Qir/Controller/Driver/QirDriverGenerator.cs +++ b/src/Qir/Controller/Driver/QirDriverGenerator.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.ComponentModel; using System.IO; using System.Threading.Tasks; using Microsoft.Quantum.Qir.Utility; @@ -12,6 +13,8 @@ namespace Microsoft.Quantum.Qir.Driver { public class QirDriverGenerator : IQirDriverGenerator { + private const string BytecodeFileName = "bytecode.ll"; + private const string DriverFileName = "driver.cpp"; private readonly ILogger logger; public QirDriverGenerator(ILogger logger) @@ -19,15 +22,32 @@ public QirDriverGenerator(ILogger logger) this.logger = logger; } - public Task GenerateQirDriverCppAsync(DirectoryInfo sourceDirectory, EntryPointOperation entryPointOperation, ArraySegment bytecode) + public async Task GenerateQirDriverCppAsync(DirectoryInfo sourceDirectory, EntryPointOperation entryPointOperation, ArraySegment bytecode) { - //await Task.Run(() => - //{ - // logger.LogInfo("Creating driver file."); - // using var driverFileStream = driverFile.OpenWrite(); - // QirDriverGeneration.GenerateQirDriverCpp(entryPointOperation, driverFileStream); - //}); - throw new NotImplementedException(); + // Wrapped in a task because DirectoryInfo operations are not asynchronous. + await Task.Run(async () => + { + sourceDirectory.Create(); + logger.LogInfo($"Created source directory at {sourceDirectory.FullName}."); + + // Create driver. + var driverFile = new FileInfo(Path.Combine(sourceDirectory.FullName, DriverFileName)); + using var driverFileStream = driverFile.OpenWrite(); + GenerateQirDriverCppHelper(entryPointOperation, driverFileStream); + logger.LogInfo($"Created driver file at {driverFile.FullName}."); + + // Create bytecode file. + var bytecodeFile = new FileInfo(Path.Combine(sourceDirectory.FullName, BytecodeFileName)); + using var bytecodeFileStream = bytecodeFile.OpenWrite(); + await bytecodeFileStream.WriteAsync(bytecode.Array, bytecode.Offset, bytecode.Count); + logger.LogInfo($"Created bytecode file at {bytecodeFile.FullName}."); + }); + } + + // Virtual method wrapper is to enable mocking in unit tests. + public virtual void GenerateQirDriverCppHelper(EntryPointOperation entryPointOperation, Stream stream) + { + QirDriverGeneration.GenerateQirDriverCpp(entryPointOperation, stream); } } } diff --git a/src/Qir/Controller/Tests.QirController/ControllerTests.cs b/src/Qir/Controller/Tests.QirController/ControllerTests.cs index 5da9e861d37..4489f00e58e 100644 --- a/src/Qir/Controller/Tests.QirController/ControllerTests.cs +++ b/src/Qir/Controller/Tests.QirController/ControllerTests.cs @@ -104,7 +104,7 @@ await Controller.ExecuteAsync( // Verify driver was created. driverGeneratorMock.Verify(obj => obj.GenerateQirDriverCppAsync( It.IsAny(), - It.Is(entryPoint => EntryPointsAreEqual(entryPoint, input.EntryPoint)), + It.Is(entryPoint => Util.EntryPointsAreEqual(entryPoint, input.EntryPoint)), It.Is>(bytecode => BytecodesAreEqual(bytecode, input.QirBytecode)))); // Verify executable was generated. @@ -118,7 +118,7 @@ await Controller.ExecuteAsync( // Verify executable was run. executableRunnerMock.Verify(obj => obj.RunExecutableAsync( It.Is(executableFile => actualExecutableFile.FullName == executableFile.FullName), - It.Is(entryPoint => EntryPointsAreEqual(entryPoint, input.EntryPoint)), + It.Is(entryPoint => Util.EntryPointsAreEqual(entryPoint, input.EntryPoint)), It.Is(actualOutputFile => actualOutputFile.FullName == outputFile.FullName))); } @@ -184,14 +184,6 @@ await Controller.ExecuteAsync( Assert.Equal(errorCode, error.Code); } - private bool EntryPointsAreEqual(EntryPointOperation entryPointA, EntryPointOperation entryPointB) - { - var method = typeof(Extensions) - .GetMethod("ValueEquals", BindingFlags.Static | BindingFlags.NonPublic, null, new[] { typeof(EntryPointOperation), typeof(EntryPointOperation) }, null); - object[] parameters = { entryPointA, entryPointB }; - return (bool)method.Invoke(null, parameters); - } - private bool BytecodesAreEqual(ArraySegment bytecodeA, ArraySegment bytecodeB) { if (bytecodeA.Count != bytecodeB.Count) diff --git a/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs b/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs new file mode 100644 index 00000000000..e6bc09e0d4d --- /dev/null +++ b/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Quantum.Qir.Driver; +using Microsoft.Quantum.Qir.Executable; +using Microsoft.Quantum.Qir.Utility; +using Microsoft.Quantum.QsCompiler.BondSchemas.EntryPoint; +using Moq; +using Xunit; + +namespace Tests.QirController +{ + public class QirDriverGeneratorTests : IDisposable + { + private readonly Mock driverGeneratorMock; + private readonly DirectoryInfo sourceDirectory; + + public QirDriverGeneratorTests() + { + driverGeneratorMock = new Mock(Mock.Of()) { CallBase = true }; + driverGeneratorMock.Setup(obj => obj.GenerateQirDriverCppHelper(It.IsAny(), It.IsAny())); + sourceDirectory = new DirectoryInfo($"{Guid.NewGuid()}-source"); + } + + public void Dispose() + { + Util.DeleteDirectory(sourceDirectory); + } + + [Fact] + public async Task TestGenerateDriver() + { + var entryPoint = new EntryPointOperation() + { + Arguments = new List + { + new Argument() + { + Position = 0, + Name = "argname", + Values = new List { new ArgumentValue { String = "argvalue" } }, + } + } + }; + byte[] bytes = { 1, 2, 3, 4, 5 }; + var bytecode = new ArraySegment(bytes, 1, 3); + await driverGeneratorMock.Object.GenerateQirDriverCppAsync(sourceDirectory, entryPoint, bytecode); + driverGeneratorMock.Verify(obj => obj.GenerateQirDriverCppHelper(It.Is(actualEntryPoint => Util.EntryPointsAreEqual(entryPoint, actualEntryPoint)), It.IsAny())); + + // Verify that the "bytecode" file was created correctly. + var bytecodeFilePath = new FileInfo(Path.Combine(sourceDirectory.FullName, "bytecode.ll")); + using var bytecodeFileStream = bytecodeFilePath.OpenRead(); + Assert.Equal(bytecodeFileStream.Length, bytecode.Count); + for (var i = 0; i < bytecodeFileStream.Length; ++i) + { + Assert.Equal(bytecode[i], bytecodeFileStream.ReadByte()); + } + } + } +} diff --git a/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs b/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs index c819f0fb41c..5e969943b8e 100644 --- a/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs +++ b/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs @@ -59,10 +59,10 @@ public QirExecutableGeneratorTests() public void Dispose() { - DeleteDirectory(sourceDirectory); - DeleteDirectory(includeDirectory); - DeleteDirectory(libraryDirectory); - DeleteDirectory(binDirectory); + Util.DeleteDirectory(sourceDirectory); + Util.DeleteDirectory(includeDirectory); + Util.DeleteDirectory(libraryDirectory); + Util.DeleteDirectory(binDirectory); } [Fact] @@ -100,15 +100,6 @@ private static FileInfo CreateFile(string fileName, DirectoryInfo directory, str return fileInfo; } - private static void DeleteDirectory(DirectoryInfo directory) - { - foreach (var file in directory.GetFiles()) - { - file.Delete(); - } - directory.Delete(); - } - private static bool FilesWereCopied(FileInfo[] files, DirectoryInfo destinationDirectory) { var destinationDirectoryFiles = destinationDirectory.GetFiles(); diff --git a/src/Qir/Controller/Tests.QirController/Util.cs b/src/Qir/Controller/Tests.QirController/Util.cs new file mode 100644 index 00000000000..476848705ea --- /dev/null +++ b/src/Qir/Controller/Tests.QirController/Util.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System.IO; +using System.Reflection; +using Microsoft.Quantum.QsCompiler.BondSchemas.EntryPoint; + +namespace Tests.QirController +{ + public static class Util + { + public static void DeleteDirectory(DirectoryInfo directory) + { + foreach (var file in directory.GetFiles()) + { + file.Delete(); + } + directory.Delete(); + } + + + public static bool EntryPointsAreEqual(EntryPointOperation entryPointA, EntryPointOperation entryPointB) + { + var method = typeof(Extensions) + .GetMethod("ValueEquals", BindingFlags.Static | BindingFlags.NonPublic, null, new[] { typeof(EntryPointOperation), typeof(EntryPointOperation) }, null); + object[] parameters = { entryPointA, entryPointB }; + return (bool)method.Invoke(null, parameters); + } + } +} From 65a6ae79b8b784f4f70145daaea243af64097551 Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Fri, 9 Apr 2021 15:07:38 -0700 Subject: [PATCH 04/23] Clean up --- .../Controller/Tests.QirController/QirDriverGeneratorTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs b/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs index e6bc09e0d4d..6f31f097eab 100644 --- a/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs +++ b/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs @@ -4,10 +4,8 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Threading.Tasks; using Microsoft.Quantum.Qir.Driver; -using Microsoft.Quantum.Qir.Executable; using Microsoft.Quantum.Qir.Utility; using Microsoft.Quantum.QsCompiler.BondSchemas.EntryPoint; using Moq; From 529f543d11a18f67fdb175a27094712d0967e911 Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Fri, 9 Apr 2021 15:08:17 -0700 Subject: [PATCH 05/23] Fix typo --- src/Qir/Controller/Controller.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Qir/Controller/Controller.cs b/src/Qir/Controller/Controller.cs index 5f9cc2b65cc..e4d73dd1a6b 100644 --- a/src/Qir/Controller/Controller.cs +++ b/src/Qir/Controller/Controller.cs @@ -37,7 +37,7 @@ public static async Task ExecuteAsync( using var inputFileStream = inputFile.OpenRead(); var input = QirExecutionWrapperSerialization.DeserializeFromFastBinary(inputFileStream); - // Step 32: Create driver. + // Step 2: Create driver. logger.LogInfo("Creating driver file."); var sourceDirectory = new DirectoryInfo(SourceDirectoryPath); await driverGenerator.GenerateQirDriverCppAsync(sourceDirectory, input.EntryPoint, input.QirBytecode); From 74eaa031f7972b65bec26062a8032a17e04607d9 Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Fri, 9 Apr 2021 15:08:38 -0700 Subject: [PATCH 06/23] Fix log --- src/Qir/Controller/Controller.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Qir/Controller/Controller.cs b/src/Qir/Controller/Controller.cs index e4d73dd1a6b..be6eec68d31 100644 --- a/src/Qir/Controller/Controller.cs +++ b/src/Qir/Controller/Controller.cs @@ -55,7 +55,7 @@ public static async Task ExecuteAsync( } catch (Exception e) { - logger.LogError("An error has been encountered. Will write an error to the error file and delete any output that has been generated."); + logger.LogError("An error has been encountered. Will write an error to the error file."); logger.LogException(e); await WriteExceptionToFileAsync(e, errorFile); } From 860d9d0780484f0b0ac787040ffc331e0cfb22dd Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Mon, 12 Apr 2021 16:47:07 -0700 Subject: [PATCH 07/23] Refactor executable runner --- .../Executable/QuantumExecutableRunner.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Qir/Controller/Executable/QuantumExecutableRunner.cs b/src/Qir/Controller/Executable/QuantumExecutableRunner.cs index 774aa0cf517..7ed182dc3dc 100644 --- a/src/Qir/Controller/Executable/QuantumExecutableRunner.cs +++ b/src/Qir/Controller/Executable/QuantumExecutableRunner.cs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +using System.Collections.Generic; +using System.CommandLine.Invocation; using System.IO; using System.Threading.Tasks; using Microsoft.Quantum.Qir.Utility; @@ -17,7 +19,21 @@ public QuantumExecutableRunner(ILogger logger) this.logger = logger; } - public Task RunExecutableAsync(FileInfo executableFile, EntryPointOperation entryPointOperation, FileInfo outputFile) + public async Task RunExecutableAsync(FileInfo executableFile, EntryPointOperation entryPointOperation, FileInfo outputFile) + { + var arguments = GenerateArgumentsString(entryPointOperation.Arguments); + logger.LogInfo($"Invoking executable {executableFile.FullName} with the following arguments: {arguments}"); + using var outputFileStream = outputFile.OpenWrite(); + using var streamWriter = new StreamWriter(outputFileStream); + var result = await Process.ExecuteAsync( + executableFile.FullName, + arguments, + stdOut: async s => { await streamWriter.WriteAsync(s); }, + stdErr: s => { logger.LogError("executable: " + s); }); + logger.LogInfo("Executable has finished running."); + } + + private string GenerateArgumentsString(IList args) { throw new System.NotImplementedException(); } From 0853fcda7d5c393c460d15b6fe18c530113fd060 Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Tue, 13 Apr 2021 13:54:06 -0700 Subject: [PATCH 08/23] Clean up --- .../Tests.QirController/ControllerTests.cs | 242 ++++++++++++++++++ 1 file changed, 242 insertions(+) diff --git a/src/Qir/Controller/Tests.QirController/ControllerTests.cs b/src/Qir/Controller/Tests.QirController/ControllerTests.cs index 4489f00e58e..1e431318a3b 100644 --- a/src/Qir/Controller/Tests.QirController/ControllerTests.cs +++ b/src/Qir/Controller/Tests.QirController/ControllerTests.cs @@ -184,6 +184,248 @@ await Controller.ExecuteAsync( Assert.Equal(errorCode, error.Code); } + [Fact] + public void TestToDelete() + { + var wrapper = new QirExecutionWrapper(); + var entryPoint = new EntryPointOperation + { + Arguments = new List + { + new Argument + { + Name = "int-value", + Position = 0, + Type = DataType.IntegerType, + Values = new List + { + new ArgumentValue + { + Integer = 135, + }, + }, + }, + new Argument + { + Name = "integer-array", + Position = 1, + Type = DataType.ArrayType, + ArrayType = DataType.IntegerType, + Values = new List + { + new ArgumentValue + { + Array = new ArrayValue + { + Integer = new List { 5, long.MaxValue, 544 }, + }, + } + } + }, + new Argument + { + Name = "double-value", + Position = 2, + Type = DataType.DoubleType, + Values = new List + { + new ArgumentValue + { + Double = 3.14, + }, + }, + }, + new Argument + { + Name = "double-array", + Position = 3, + Type = DataType.ArrayType, + ArrayType = DataType.DoubleType, + Values = new List + { + new ArgumentValue + { + Array = new ArrayValue + { + Double = new List { 0.43, 0.43, 943.4 }, + }, + } + } + }, + new Argument + { + Name = "bool-value", + Position = 4, + Type = DataType.BoolType, + Values = new List + { + new ArgumentValue + { + Bool = true, + }, + }, + }, + new Argument + { + Name = "bool-array", + Position = 5, + Type = DataType.ArrayType, + ArrayType = DataType.BoolType, + Values = new List + { + new ArgumentValue + { + Array = new ArrayValue + { + Bool = new List { true, true, false, true }, + }, + } + } + }, + new Argument + { + Name = "pauli-value", + Position = 6, + Type = DataType.PauliType, + Values = new List + { + new ArgumentValue + { + Pauli = PauliValue.PauliY, + }, + }, + }, + new Argument + { + Name = "pauli-array", + Position = 7, + Type = DataType.ArrayType, + ArrayType = DataType.PauliType, + Values = new List + { + new ArgumentValue + { + Array = new ArrayValue + { + Pauli = new List { PauliValue.PauliZ, PauliValue.PauliI, PauliValue.PauliX, PauliValue.PauliY, PauliValue.PauliZ }, + }, + } + } + }, + new Argument + { + Name = "range-value", + Position = 8, + Type = DataType.RangeType, + Values = new List + { + new ArgumentValue + { + Range = new RangeValue + { + Start = 4, + Step = 33, + End = 70, + }, + }, + }, + }, + new Argument + { + Name = "range-array", + Position = 9, + Type = DataType.ArrayType, + ArrayType = DataType.RangeType, + Values = new List + { + new ArgumentValue + { + Array = new ArrayValue + { + Range = new List + { + new RangeValue + { + Start = 0, + End = 10, + Step = 1, + }, + new RangeValue + { + Start = 0, + End = 20, + Step = 2 + } + }, + }, + } + } + }, + new Argument + { + Name = "result-value", + Position = 10, + Type = DataType.ResultType, + Values = new List + { + new ArgumentValue + { + Result = ResultValue.One + }, + }, + }, + new Argument + { + Name = "result-array", + Position = 11, + Type = DataType.ArrayType, + ArrayType = DataType.ResultType, + Values = new List + { + new ArgumentValue + { + Array = new ArrayValue + { + Result = new List { ResultValue.One, ResultValue.Zero, ResultValue.One } + }, + } + } + }, + new Argument + { + Name = "range-value", + Position = 12, + Type = DataType.StringType, + Values = new List + { + new ArgumentValue + { + String = "string value", + }, + }, + }, + new Argument + { + Name = "string-array", + Position = 13, + Type = DataType.ArrayType, + ArrayType = DataType.StringType, + Values = new List + { + new ArgumentValue + { + Array = new ArrayValue + { + String = new List {"string A", "stringB", "string C", "stringD"} + }, + } + } + }, + }, + Name = "Quantum__StandaloneSupportedInputs__ExerciseInputs", + }; + } + private bool BytecodesAreEqual(ArraySegment bytecodeA, ArraySegment bytecodeB) { if (bytecodeA.Count != bytecodeB.Count) From 6b067c006f27a37c6e5a3382609cdb2641672696 Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Wed, 14 Apr 2021 11:22:03 -0700 Subject: [PATCH 09/23] Fix tests --- .gitignore | 6 +- src/Qir/Controller/Controller.cs | 1 - .../Controller/Driver/QirDriverGenerator.cs | 3 +- .../Executable/QirExecutableGenerator.cs | 16 +- .../Executable/QuantumExecutableRunner.cs | 16 +- src/Qir/Controller/QirController.csproj | 2 +- .../Tests.QirController/ControllerTests.cs | 243 ------------------ .../QirDriverGeneratorTests.cs | 2 +- .../test-cases/standalone-input-test.out | 14 + .../test-cases/standalone-input-test.skip | Bin 0 -> 44258 bytes src/Qir/Controller/test-qir-controller.ps1 | 29 ++- 11 files changed, 66 insertions(+), 266 deletions(-) create mode 100644 src/Qir/Controller/test-cases/standalone-input-test.out create mode 100644 src/Qir/Controller/test-cases/standalone-input-test.skip diff --git a/.gitignore b/.gitignore index 7127ca52075..0553c56ac2a 100644 --- a/.gitignore +++ b/.gitignore @@ -341,4 +341,8 @@ ASALocalRun/ dbw_test # Controller test artifacts -/src/Qir/Controller/test-artifacts/ \ No newline at end of file +/src/Qir/Controller/test-artifacts/ +/src/Qir/Controller/src + +# out folders +out/ \ No newline at end of file diff --git a/src/Qir/Controller/Controller.cs b/src/Qir/Controller/Controller.cs index be6eec68d31..cb626a5bb34 100644 --- a/src/Qir/Controller/Controller.cs +++ b/src/Qir/Controller/Controller.cs @@ -50,7 +50,6 @@ public static async Task ExecuteAsync( // Step 4: Run executable. logger.LogInfo("Running executable."); - using var outputFileStream = outputFile.OpenWrite(); await executableRunner.RunExecutableAsync(executableFile, input.EntryPoint, outputFile); } catch (Exception e) diff --git a/src/Qir/Controller/Driver/QirDriverGenerator.cs b/src/Qir/Controller/Driver/QirDriverGenerator.cs index 805f8b369fc..b417bf7f79c 100644 --- a/src/Qir/Controller/Driver/QirDriverGenerator.cs +++ b/src/Qir/Controller/Driver/QirDriverGenerator.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System; -using System.ComponentModel; using System.IO; using System.Threading.Tasks; using Microsoft.Quantum.Qir.Utility; @@ -13,7 +12,7 @@ namespace Microsoft.Quantum.Qir.Driver { public class QirDriverGenerator : IQirDriverGenerator { - private const string BytecodeFileName = "bytecode.ll"; + private const string BytecodeFileName = "qir.bc"; private const string DriverFileName = "driver.cpp"; private readonly ILogger logger; diff --git a/src/Qir/Controller/Executable/QirExecutableGenerator.cs b/src/Qir/Controller/Executable/QirExecutableGenerator.cs index ed50ffc03eb..f76db73c9cf 100644 --- a/src/Qir/Controller/Executable/QirExecutableGenerator.cs +++ b/src/Qir/Controller/Executable/QirExecutableGenerator.cs @@ -38,8 +38,7 @@ await Task.Run(async () => var libraryFiles = libraryDirectory.GetFiles(); foreach (var file in libraryFiles) { - var newFile = file.CopyTo(Path.Combine(binDirectory.FullName, file.Name)); - logger.LogInfo($"Copied file {file.FullName} to {newFile.FullName}"); + CopyFileIfNotExists(file, binDirectory); } // Copy all include contents to bin. @@ -47,13 +46,22 @@ await Task.Run(async () => var includeFiles = includeDirectory.GetFiles(); foreach (var file in includeFiles) { - var newFile = file.CopyTo(Path.Combine(binDirectory.FullName, file.Name)); - logger.LogInfo($"Copied file {file.FullName} to {newFile.FullName}"); + CopyFileIfNotExists(file, binDirectory); } var inputFiles = sourceDirectory.GetFiles().Select(fileInfo => fileInfo.FullName).ToArray(); await clangClient.CreateExecutableAsync(inputFiles, LibrariesToLink, libraryDirectory.FullName, includeDirectory.FullName, executableFile.FullName); }); } + + private void CopyFileIfNotExists(FileInfo fileToCopy, DirectoryInfo destinationDirectory) + { + var newPath = Path.Combine(destinationDirectory.FullName, fileToCopy.Name); + if (!File.Exists(newPath)) + { + var newFile = fileToCopy.CopyTo(newPath); + logger.LogInfo($"Copied file {fileToCopy.FullName} to {newFile.FullName}"); + } + } } } diff --git a/src/Qir/Controller/Executable/QuantumExecutableRunner.cs b/src/Qir/Controller/Executable/QuantumExecutableRunner.cs index 7ed182dc3dc..a1b66cdb075 100644 --- a/src/Qir/Controller/Executable/QuantumExecutableRunner.cs +++ b/src/Qir/Controller/Executable/QuantumExecutableRunner.cs @@ -1,11 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -using System.Collections.Generic; using System.CommandLine.Invocation; using System.IO; using System.Threading.Tasks; using Microsoft.Quantum.Qir.Utility; +using Microsoft.Quantum.QsCompiler; using Microsoft.Quantum.QsCompiler.BondSchemas.EntryPoint; namespace Microsoft.Quantum.Qir.Executable @@ -21,21 +21,15 @@ public QuantumExecutableRunner(ILogger logger) public async Task RunExecutableAsync(FileInfo executableFile, EntryPointOperation entryPointOperation, FileInfo outputFile) { - var arguments = GenerateArgumentsString(entryPointOperation.Arguments); + var arguments = QirDriverGeneration.GenerateCommandLineArguments(entryPointOperation.Arguments); logger.LogInfo($"Invoking executable {executableFile.FullName} with the following arguments: {arguments}"); - using var outputFileStream = outputFile.OpenWrite(); - using var streamWriter = new StreamWriter(outputFileStream); + arguments = $"-s {outputFile.FullName} {arguments}"; var result = await Process.ExecuteAsync( executableFile.FullName, arguments, - stdOut: async s => { await streamWriter.WriteAsync(s); }, + stdOut: s => { logger.LogInfo(s); }, stdErr: s => { logger.LogError("executable: " + s); }); - logger.LogInfo("Executable has finished running."); - } - - private string GenerateArgumentsString(IList args) - { - throw new System.NotImplementedException(); + logger.LogInfo($"Executable has finished running. Result code: {result}"); } } } diff --git a/src/Qir/Controller/QirController.csproj b/src/Qir/Controller/QirController.csproj index 4570cafa210..6a84aaa906e 100644 --- a/src/Qir/Controller/QirController.csproj +++ b/src/Qir/Controller/QirController.csproj @@ -18,7 +18,7 @@ - + diff --git a/src/Qir/Controller/Tests.QirController/ControllerTests.cs b/src/Qir/Controller/Tests.QirController/ControllerTests.cs index 1e431318a3b..728438aea4e 100644 --- a/src/Qir/Controller/Tests.QirController/ControllerTests.cs +++ b/src/Qir/Controller/Tests.QirController/ControllerTests.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Reflection; using System.Text.Json; using System.Threading.Tasks; using Microsoft.Quantum.Qir; @@ -184,248 +183,6 @@ await Controller.ExecuteAsync( Assert.Equal(errorCode, error.Code); } - [Fact] - public void TestToDelete() - { - var wrapper = new QirExecutionWrapper(); - var entryPoint = new EntryPointOperation - { - Arguments = new List - { - new Argument - { - Name = "int-value", - Position = 0, - Type = DataType.IntegerType, - Values = new List - { - new ArgumentValue - { - Integer = 135, - }, - }, - }, - new Argument - { - Name = "integer-array", - Position = 1, - Type = DataType.ArrayType, - ArrayType = DataType.IntegerType, - Values = new List - { - new ArgumentValue - { - Array = new ArrayValue - { - Integer = new List { 5, long.MaxValue, 544 }, - }, - } - } - }, - new Argument - { - Name = "double-value", - Position = 2, - Type = DataType.DoubleType, - Values = new List - { - new ArgumentValue - { - Double = 3.14, - }, - }, - }, - new Argument - { - Name = "double-array", - Position = 3, - Type = DataType.ArrayType, - ArrayType = DataType.DoubleType, - Values = new List - { - new ArgumentValue - { - Array = new ArrayValue - { - Double = new List { 0.43, 0.43, 943.4 }, - }, - } - } - }, - new Argument - { - Name = "bool-value", - Position = 4, - Type = DataType.BoolType, - Values = new List - { - new ArgumentValue - { - Bool = true, - }, - }, - }, - new Argument - { - Name = "bool-array", - Position = 5, - Type = DataType.ArrayType, - ArrayType = DataType.BoolType, - Values = new List - { - new ArgumentValue - { - Array = new ArrayValue - { - Bool = new List { true, true, false, true }, - }, - } - } - }, - new Argument - { - Name = "pauli-value", - Position = 6, - Type = DataType.PauliType, - Values = new List - { - new ArgumentValue - { - Pauli = PauliValue.PauliY, - }, - }, - }, - new Argument - { - Name = "pauli-array", - Position = 7, - Type = DataType.ArrayType, - ArrayType = DataType.PauliType, - Values = new List - { - new ArgumentValue - { - Array = new ArrayValue - { - Pauli = new List { PauliValue.PauliZ, PauliValue.PauliI, PauliValue.PauliX, PauliValue.PauliY, PauliValue.PauliZ }, - }, - } - } - }, - new Argument - { - Name = "range-value", - Position = 8, - Type = DataType.RangeType, - Values = new List - { - new ArgumentValue - { - Range = new RangeValue - { - Start = 4, - Step = 33, - End = 70, - }, - }, - }, - }, - new Argument - { - Name = "range-array", - Position = 9, - Type = DataType.ArrayType, - ArrayType = DataType.RangeType, - Values = new List - { - new ArgumentValue - { - Array = new ArrayValue - { - Range = new List - { - new RangeValue - { - Start = 0, - End = 10, - Step = 1, - }, - new RangeValue - { - Start = 0, - End = 20, - Step = 2 - } - }, - }, - } - } - }, - new Argument - { - Name = "result-value", - Position = 10, - Type = DataType.ResultType, - Values = new List - { - new ArgumentValue - { - Result = ResultValue.One - }, - }, - }, - new Argument - { - Name = "result-array", - Position = 11, - Type = DataType.ArrayType, - ArrayType = DataType.ResultType, - Values = new List - { - new ArgumentValue - { - Array = new ArrayValue - { - Result = new List { ResultValue.One, ResultValue.Zero, ResultValue.One } - }, - } - } - }, - new Argument - { - Name = "range-value", - Position = 12, - Type = DataType.StringType, - Values = new List - { - new ArgumentValue - { - String = "string value", - }, - }, - }, - new Argument - { - Name = "string-array", - Position = 13, - Type = DataType.ArrayType, - ArrayType = DataType.StringType, - Values = new List - { - new ArgumentValue - { - Array = new ArrayValue - { - String = new List {"string A", "stringB", "string C", "stringD"} - }, - } - } - }, - }, - Name = "Quantum__StandaloneSupportedInputs__ExerciseInputs", - }; - } - private bool BytecodesAreEqual(ArraySegment bytecodeA, ArraySegment bytecodeB) { if (bytecodeA.Count != bytecodeB.Count) diff --git a/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs b/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs index 6f31f097eab..f672b441ae8 100644 --- a/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs +++ b/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs @@ -51,7 +51,7 @@ public async Task TestGenerateDriver() driverGeneratorMock.Verify(obj => obj.GenerateQirDriverCppHelper(It.Is(actualEntryPoint => Util.EntryPointsAreEqual(entryPoint, actualEntryPoint)), It.IsAny())); // Verify that the "bytecode" file was created correctly. - var bytecodeFilePath = new FileInfo(Path.Combine(sourceDirectory.FullName, "bytecode.ll")); + var bytecodeFilePath = new FileInfo(Path.Combine(sourceDirectory.FullName, "qir.bc")); using var bytecodeFileStream = bytecodeFilePath.OpenRead(); Assert.Equal(bytecodeFileStream.Length, bytecode.Count); for (var i = 0; i < bytecodeFileStream.Length; ++i) diff --git a/src/Qir/Controller/test-cases/standalone-input-test.out b/src/Qir/Controller/test-cases/standalone-input-test.out new file mode 100644 index 00000000000..9e28a14f85c --- /dev/null +++ b/src/Qir/Controller/test-cases/standalone-input-test.out @@ -0,0 +1,14 @@ +Exercise Supported Inputs Reference +intValue: 135 +intArray: [5, 9223372036854775807, 544] (3) +doubleValue: 3.14000000000000012 +doubleArray: [0.42999999999999999, 0.42999999999999999, 943.39999999999997726] (3) +boolValue: true +boolArray: [true, true, false, true] (4) +pauliValue: PauliY +pauliArray: [PauliZ, PauliI, PauliX, PauliY, PauliZ] (5) +rangeValue: 4..33..70 +resultValue: One +resultArray: [One, Zero, One] (3) +stringValue: string value +() diff --git a/src/Qir/Controller/test-cases/standalone-input-test.skip b/src/Qir/Controller/test-cases/standalone-input-test.skip new file mode 100644 index 0000000000000000000000000000000000000000..6ba33ad15b1e15c4dfbd97f1644d252010934583 GIT binary patch literal 44258 zcmeHw3w%>W*7&_inuIh>leR#gY0?%cr9hIVO~ONyKA=d^6wwb{v`O29w)T;}pasRe zXe*R8vQ_Jf-=tq8JllNFd6lV+7WId>i?j z0za!a0E)17PJTs2DOEQEQo=OAL1<7Wujn`;StXPVs}lVB%FO{)(ios5)CVXGSp&5M zn)J1$#Z)y+s!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W_SoM3yg2Q5fYZ5}E9pwRjyP{*|>@ zpf}ajRvE}q>dIpYvmaJMg6+F`c+ZC?jCYg)PI5HRE`X4 zmK$pFs*6_{@}z}+9S;wBV7{Rg4<=1DRRC?Y0N}3Tvf5H22qlEjR#g;$n5O~^z*%)5 zCaDGyDhLr^yjq`8QC?UKLsl>t*UvA9(M5G}0cqdExb!pYpANqKO?q_9%3{C+hzm;V z3w(J1v6U|mH%vqgF5``)uP-d|Ye-5n1r;X$$d<}0(?0-0+rp9xpo$yDUd9a;AJ8wT zDfJV-rq=XR;oflRfko6*Rg{(*3Ui8$VD_7rH|kV_G*cqJ{25$~9|Cpc1WTHix5!|` zg5ps#HE^zhWnZZp*)^~PaD7?w)77wv&Q%T}#pNq1fb9&Qkl;!meRR1Js!y-IaaMSv zdtnBs0Cc4rDgbE2E15*fHJAjz#hk`f7&JijwVt2h0HFF39%4NZ9sWC5-(*&CqV8)gu{-WcfLaDZi?lqKarGaD6-d&ye+P zjh{!oTEbGvH82d3uZ8f{vJB}0Twl^R#@_HsuB1IF2#fJm_^Sv>AhIvhKS%hg^#SPm z>Enu|uO$eV0_3aa8Q@+u&p56x>8n{%@ZSLe1D2tx!sIhhc{f3bW%CiM1;jEPTrOAz e3j3Ay$p!n1qi2pjS-5uorPAq=>F_)+_W6I>XS$*Q literal 0 HcmV?d00001 diff --git a/src/Qir/Controller/test-qir-controller.ps1 b/src/Qir/Controller/test-qir-controller.ps1 index ad70d23d1b7..ee3ce6e85ec 100644 --- a/src/Qir/Controller/test-qir-controller.ps1 +++ b/src/Qir/Controller/test-qir-controller.ps1 @@ -8,11 +8,36 @@ Write-Host "##[info]Test QIR Controller" $controllerProject = (Join-Path $PSScriptRoot QirController.csproj) $testCasesFolder = (Join-Path $PSScriptRoot "test-cases") $testArtifactsFolder = (Join-Path $PSScriptRoot "test-artifacts") +$includeDirectory = (Join-Path $testArtifactsFolder "include") +$headerPaths = @((Join-Path $PSScriptRoot "..\..\Qir\Common\externals\CLI11"), (Join-Path $PSScriptRoot "..\..\Qir\Runtime\public")) +$libraryPaths = @((Join-Path $PSScriptRoot "..\..\Qir\Runtime\build\Debug\bin"), (Join-Path $PSScriptRoot "..\..\Simulation\Simulators\bin\Debug\netstandard2.1")) +$includeDirectory = (Join-Path $testArtifactsFolder "include") +$libraryDirectory = (Join-Path $testArtifactsFolder "library") if (!(Test-Path $testArtifactsFolder -PathType Container)) { New-Item -ItemType Directory -Force -Path $testArtifactsFolder } -Get-ChildItem -Path $testArtifactsFolder | Remove-Item -Force +Get-ChildItem -Path $testArtifactsFolder | Remove-Item -Force -Recurse + +# Copy includes to the include folder +New-Item -ItemType "directory" -Path $includeDirectory -Force +foreach ( $path in $headerPaths ) +{ + Get-ChildItem $path -File | + Foreach-Object { + Copy-Item $_ -Destination (Join-Path $includeDirectory $_.Name) + } +} + +# Copy libraries to the library folder +New-Item -ItemType "directory" -Path $libraryDirectory -Force +foreach ( $path in $libraryPaths ) +{ + Get-ChildItem $path -File | + Foreach-Object { + Copy-Item $_ -Destination (Join-Path $libraryDirectory $_.Name) + } +} # Go through each input file in the test cases folder. Get-ChildItem $testCasesFolder -Filter *.in | @@ -20,7 +45,7 @@ Foreach-Object { # Get the paths to the output and error files to pass to the QIR controller. $outputFile = (Join-Path $testArtifactsFolder ($_.BaseName + ".out")) $errorFile = (Join-Path $testArtifactsFolder ($_.BaseName + ".err")) - dotnet run --project $controllerProject -- --input $_.FullName --output $outputFile --error $errorFile --includeDirectory "placeholder for now" --libraryDirectory "placeholder for now" + dotnet run --project $controllerProject -- --input $_.FullName --output $outputFile --error $errorFile --includeDirectory $includeDirectory --libraryDirectory $libraryDirectory # Compare the expected content of the output and error files vs the actual content. $expectedOutputFile = (Join-Path $testCasesFolder ($_.BaseName + ".out")) From 98ffe1b46de6c6fd6d0255de3a80fcf507301304 Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Wed, 14 Apr 2021 11:26:03 -0700 Subject: [PATCH 10/23] Clean up --- src/Qir/Controller/Executable/QuantumExecutableRunner.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Qir/Controller/Executable/QuantumExecutableRunner.cs b/src/Qir/Controller/Executable/QuantumExecutableRunner.cs index a1b66cdb075..580888e0702 100644 --- a/src/Qir/Controller/Executable/QuantumExecutableRunner.cs +++ b/src/Qir/Controller/Executable/QuantumExecutableRunner.cs @@ -27,7 +27,7 @@ public async Task RunExecutableAsync(FileInfo executableFile, EntryPointOperatio var result = await Process.ExecuteAsync( executableFile.FullName, arguments, - stdOut: s => { logger.LogInfo(s); }, + stdOut: s => { logger.LogInfo("executable: " + s); }, stdErr: s => { logger.LogError("executable: " + s); }); logger.LogInfo($"Executable has finished running. Result code: {result}"); } From 5c8d26f65f9815c6c68229db01bda88b4e660d0d Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Wed, 14 Apr 2021 15:42:28 -0700 Subject: [PATCH 11/23] WIP --- .../Controller/Driver/QirDriverGenerator.cs | 5 ++ src/Qir/Controller/Executable/ClangClient.cs | 2 +- .../Executable/QuantumExecutableRunner.cs | 8 ++- src/Qir/Controller/QirController.csproj | 6 ++- .../Tests.QirController/ControllerTests.cs | 47 ++++++++++++++++++ .../test-cases/standalone-input-test.in | Bin 0 -> 16075 bytes .../test-cases/standalone-input-test.skip | Bin 44258 -> 0 bytes 7 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 src/Qir/Controller/test-cases/standalone-input-test.in delete mode 100644 src/Qir/Controller/test-cases/standalone-input-test.skip diff --git a/src/Qir/Controller/Driver/QirDriverGenerator.cs b/src/Qir/Controller/Driver/QirDriverGenerator.cs index b417bf7f79c..3c520707401 100644 --- a/src/Qir/Controller/Driver/QirDriverGenerator.cs +++ b/src/Qir/Controller/Driver/QirDriverGenerator.cs @@ -26,6 +26,11 @@ public async Task GenerateQirDriverCppAsync(DirectoryInfo sourceDirectory, Entry // Wrapped in a task because DirectoryInfo operations are not asynchronous. await Task.Run(async () => { + if (sourceDirectory.Exists) + { + sourceDirectory.Delete(true); + } + sourceDirectory.Create(); logger.LogInfo($"Created source directory at {sourceDirectory.FullName}."); diff --git a/src/Qir/Controller/Executable/ClangClient.cs b/src/Qir/Controller/Executable/ClangClient.cs index 72fc903d4e8..81bd435aff4 100644 --- a/src/Qir/Controller/Executable/ClangClient.cs +++ b/src/Qir/Controller/Executable/ClangClient.cs @@ -23,7 +23,7 @@ public async Task CreateExecutableAsync(string[] inputFiles, string[] libraries, // string.Join does not automatically prepend the delimiter, so it is included again in the string here. var librariesArg = $"{LinkFlag} {string.Join(LinkFlag, libraries)}"; - var arguments = $"{inputsArg} -I {includePath} -L {libraryPath} {librariesArg} -o {outputPath}"; + var arguments = $"-v {inputsArg} -I {includePath} -L {libraryPath} {librariesArg} -o {outputPath}"; logger.LogInfo($"Invoking clang with the following arguments: {arguments}"); var result = await Process.ExecuteAsync( "clang", diff --git a/src/Qir/Controller/Executable/QuantumExecutableRunner.cs b/src/Qir/Controller/Executable/QuantumExecutableRunner.cs index 580888e0702..8ce2bcd41d7 100644 --- a/src/Qir/Controller/Executable/QuantumExecutableRunner.cs +++ b/src/Qir/Controller/Executable/QuantumExecutableRunner.cs @@ -23,7 +23,13 @@ public async Task RunExecutableAsync(FileInfo executableFile, EntryPointOperatio { var arguments = QirDriverGeneration.GenerateCommandLineArguments(entryPointOperation.Arguments); logger.LogInfo($"Invoking executable {executableFile.FullName} with the following arguments: {arguments}"); - arguments = $"-s {outputFile.FullName} {arguments}"; + arguments = $"--simulation-output {outputFile.FullName} {arguments}"; + if (outputFile.Exists) + { + outputFile.Delete(); + } + + outputFile.Create().Dispose(); var result = await Process.ExecuteAsync( executableFile.FullName, arguments, diff --git a/src/Qir/Controller/QirController.csproj b/src/Qir/Controller/QirController.csproj index 6a84aaa906e..7c12b01b4ce 100644 --- a/src/Qir/Controller/QirController.csproj +++ b/src/Qir/Controller/QirController.csproj @@ -7,18 +7,22 @@ + + + + - + diff --git a/src/Qir/Controller/Tests.QirController/ControllerTests.cs b/src/Qir/Controller/Tests.QirController/ControllerTests.cs index 728438aea4e..99f038ea2c4 100644 --- a/src/Qir/Controller/Tests.QirController/ControllerTests.cs +++ b/src/Qir/Controller/Tests.QirController/ControllerTests.cs @@ -183,6 +183,53 @@ await Controller.ExecuteAsync( Assert.Equal(errorCode, error.Code); } + [Fact] + public void DeleteThisTest() + { + var entryPoint = new EntryPointOperation + { + Arguments = new List + { + new Argument + { + Name = "intArray", + ArrayType = DataType.IntegerType, + Type = DataType.ArrayType, + Values = new List + { + new ArgumentValue + { + Array = new ArrayValue() + { + Integer = new List {9, 4, 4, 2, 3} + } + } + }, + Position = 0, + } + }, + + Name = "Quantum__StandaloneSupportedInputs__ExerciseInputs", + }; + + var qirFile = new FileInfo(@"C:\Users\alchocro\Desktop\qir-standalone-input-reference.ll"); + using var inputStream = qirFile.OpenRead(); + byte[] buffer = new byte[inputStream.Length]; + inputStream.Read(buffer, 0, (int)inputStream.Length); + var arraySegment = new ArraySegment(buffer); + var executionWrapper = new QirExecutionWrapper + { + EntryPoint = entryPoint, + QirBytecode = arraySegment, + }; + + var testCaseFile = new FileInfo(@"C:\Users\alchocro\git-repos\qsharp-runtime\src\Qir\Controller\test-cases\standalone-input-test.in"); + testCaseFile.Delete(); + using var outputStream = testCaseFile.OpenWrite(); + Microsoft.Quantum.QsCompiler.BondSchemas.QirExecutionWrapper.Protocols.SerializeToFastBinary(executionWrapper, outputStream); + Assert.False(true); + } + private bool BytecodesAreEqual(ArraySegment bytecodeA, ArraySegment bytecodeB) { if (bytecodeA.Count != bytecodeB.Count) diff --git a/src/Qir/Controller/test-cases/standalone-input-test.in b/src/Qir/Controller/test-cases/standalone-input-test.in new file mode 100644 index 0000000000000000000000000000000000000000..2bd1d15b130a5aea00891a916fe7d9ede0378aee GIT binary patch literal 16075 zcmeHOTW{OQ6;|2?ZDhFJ0)5%HK?(x4VFRKh%W@VABrvi-9txzJJhXKUf}%zaQJK_I z)Hd#Re^UQrzcV)uZ_-GX-9E$*mP8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$eV0_3aa8Q@+u&p56x>8n{%@ZSLe1D2tx!sIhhc{f3bW%CiM1;jEPTrOAz e3j3Ay$p!n1qi2pjS-5uorPAq=>F_)+_W6I>XS$*Q From 3761797bd66376c29272005c080d19508f6fe9db Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Wed, 14 Apr 2021 16:24:41 -0700 Subject: [PATCH 12/23] WIP --- .../Tests.QirController/ControllerTests.cs | 218 +++++++++++++++++- .../qsharp/qir-standalone-input-reference.qs | 3 +- 2 files changed, 217 insertions(+), 4 deletions(-) diff --git a/src/Qir/Controller/Tests.QirController/ControllerTests.cs b/src/Qir/Controller/Tests.QirController/ControllerTests.cs index 99f038ea2c4..875f8155fa6 100644 --- a/src/Qir/Controller/Tests.QirController/ControllerTests.cs +++ b/src/Qir/Controller/Tests.QirController/ControllerTests.cs @@ -190,6 +190,19 @@ public void DeleteThisTest() { Arguments = new List { + new Argument + { + Name = "intValue", + Type = DataType.IntegerType, + Values = new List + { + new ArgumentValue + { + Integer = 42, + } + }, + Position = 0, + }, new Argument { Name = "intArray", @@ -201,11 +214,210 @@ public void DeleteThisTest() { Array = new ArrayValue() { - Integer = new List {9, 4, 4, 2, 3} + Integer = new List {long.MaxValue, 4, 4, 2, 3} } } }, - Position = 0, + Position = 1, + }, + new Argument + { + Name = "doubleValue", + Type = DataType.DoubleType, + Values = new List + { + new ArgumentValue + { + Double = 3.14, + } + }, + Position = 1, + }, + new Argument + { + Name = "doubleArray", + ArrayType = DataType.DoubleType, + Type = DataType.ArrayType, + Values = new List + { + new ArgumentValue + { + Array = new ArrayValue() + { + Double = new List {0.6, 0.4, 43.2} + } + } + }, + Position = 2, + }, + new Argument + { + Name = "boolValue", + Type = DataType.BoolType, + Values = new List + { + new ArgumentValue + { + Bool = true, + } + }, + Position = 3, + }, + new Argument + { + Name = "boolArray", + ArrayType = DataType.BoolType, + Type = DataType.ArrayType, + Values = new List + { + new ArgumentValue + { + Array = new ArrayValue() + { + Bool = new List {true, false, true, true, false} + } + } + }, + Position = 4, + }, + new Argument + { + Name = "pauliValue", + Type = DataType.PauliType, + Values = new List + { + new ArgumentValue + { + Pauli = PauliValue.PauliZ, + } + }, + Position = 5, + }, + new Argument + { + Name = "pauliArray", + ArrayType = DataType.PauliType, + Type = DataType.ArrayType, + Values = new List + { + new ArgumentValue + { + Array = new ArrayValue() + { + Pauli = new List {PauliValue.PauliX, PauliValue.PauliI, PauliValue.PauliY, PauliValue.PauliY, PauliValue.Z} + } + } + }, + Position = 6, + }, + new Argument + { + Name = "rangeValue", + Type = DataType.RangeType, + Values = new List + { + new ArgumentValue + { + Range = new RangeValue + { + Start = 3, + Step = 12, + End = 27, + } + } + }, + Position = 7, + }, + new Argument + { + Name = "rangeArray", + ArrayType = DataType.RangeType, + Type = DataType.ArrayType, + Values = new List + { + new ArgumentValue + { + Array = new ArrayValue() + { + Range = new List + { + new RangeValue + { + Start = 0, + Step = 3, + End = 99, + }, + new RangeValue + { + Start = 2, + Step = 5, + End = 102, + } + } + } + } + }, + Position = 8, + }, + new Argument + { + Name = "resultValue", + Type = DataType.ResultType, + Values = new List + { + new ArgumentValue + { + Result = ResultValue.One, + } + }, + Position = 9, + }, + new Argument + { + Name = "resultArray", + ArrayType = DataType.ResultType, + Type = DataType.ArrayType, + Values = new List + { + new ArgumentValue + { + Array = new ArrayValue() + { + Result = new List { ResultValue.One, ResultValue.One, ResultValue.Zero, ResultValue.One} + } + } + }, + Position = 10, + }, + new Argument + { + Name = "stringValue", + Type = DataType.StringType, + Values = new List + { + new ArgumentValue + { + String = "string value", + } + }, + Position = 11, + }, + new Argument + { + Name = "stringArray", + ArrayType = DataType.StringType, + Type = DataType.ArrayType, + Values = new List + { + new ArgumentValue + { + Array = new ArrayValue() + { + String = new List {"string a", "string b", "string c"} + } + } + }, + Position = 12, } }, @@ -228,7 +440,7 @@ public void DeleteThisTest() using var outputStream = testCaseFile.OpenWrite(); Microsoft.Quantum.QsCompiler.BondSchemas.QirExecutionWrapper.Protocols.SerializeToFastBinary(executionWrapper, outputStream); Assert.False(true); - } + } private bool BytecodesAreEqual(ArraySegment bytecodeA, ArraySegment bytecodeB) { diff --git a/src/Qir/Samples/StandaloneInputReference/qsharp/qir-standalone-input-reference.qs b/src/Qir/Samples/StandaloneInputReference/qsharp/qir-standalone-input-reference.qs index 23908eaa514..c01b2a03972 100644 --- a/src/Qir/Samples/StandaloneInputReference/qsharp/qir-standalone-input-reference.qs +++ b/src/Qir/Samples/StandaloneInputReference/qsharp/qir-standalone-input-reference.qs @@ -31,7 +31,7 @@ } @EntryPoint() - operation ExerciseInputs (intValue : Int, intArray : Int[], doubleValue : Double, doubleArray : Double[], boolValue : Bool, boolArray : Bool[], pauliValue : Pauli, pauliArray : Pauli[], rangeValue : Range, resultValue : Result, resultArray : Result[], stringValue : String) : Unit { + operation ExerciseInputs (intValue : Int, intArray : Int[], doubleValue : Double, doubleArray : Double[], boolValue : Bool, boolArray : Bool[], pauliValue : Pauli, pauliArray : Pauli[], rangeValue : Range, resultValue : Result, resultArray : Result[], stringValue : String, stringArray : String[]) : Unit { Message("Exercise Supported Inputs Reference"); Message($"intValue: {intValue}"); Message($"intArray: {ArrayToString(intArray)} ({Count(TautologyPredicate, intArray)})"); @@ -45,5 +45,6 @@ Message($"resultValue: {resultValue}"); Message($"resultArray: {ArrayToString(resultArray)} ({Count(TautologyPredicate, resultArray)})"); Message($"stringValue: {stringValue}"); + Message($"stringArray: {ArrayToString(stringArray)} ({Count(TautologyPredicate, stringArray)})"); } } From 6a01cd16e5a321912b35c5fc7a987db817142374 Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Wed, 14 Apr 2021 16:52:23 -0700 Subject: [PATCH 13/23] WIP --- .../Controller/Driver/QirDriverGenerator.cs | 2 + .../Tests.QirController/ControllerTests.cs | 259 ------------------ .../test-cases/standalone-input-test.in | Bin 16075 -> 47041 bytes 3 files changed, 2 insertions(+), 259 deletions(-) diff --git a/src/Qir/Controller/Driver/QirDriverGenerator.cs b/src/Qir/Controller/Driver/QirDriverGenerator.cs index 3c520707401..9474c42e36b 100644 --- a/src/Qir/Controller/Driver/QirDriverGenerator.cs +++ b/src/Qir/Controller/Driver/QirDriverGenerator.cs @@ -23,6 +23,8 @@ public QirDriverGenerator(ILogger logger) public async Task GenerateQirDriverCppAsync(DirectoryInfo sourceDirectory, EntryPointOperation entryPointOperation, ArraySegment bytecode) { + return; + // Wrapped in a task because DirectoryInfo operations are not asynchronous. await Task.Run(async () => { diff --git a/src/Qir/Controller/Tests.QirController/ControllerTests.cs b/src/Qir/Controller/Tests.QirController/ControllerTests.cs index 875f8155fa6..728438aea4e 100644 --- a/src/Qir/Controller/Tests.QirController/ControllerTests.cs +++ b/src/Qir/Controller/Tests.QirController/ControllerTests.cs @@ -183,265 +183,6 @@ await Controller.ExecuteAsync( Assert.Equal(errorCode, error.Code); } - [Fact] - public void DeleteThisTest() - { - var entryPoint = new EntryPointOperation - { - Arguments = new List - { - new Argument - { - Name = "intValue", - Type = DataType.IntegerType, - Values = new List - { - new ArgumentValue - { - Integer = 42, - } - }, - Position = 0, - }, - new Argument - { - Name = "intArray", - ArrayType = DataType.IntegerType, - Type = DataType.ArrayType, - Values = new List - { - new ArgumentValue - { - Array = new ArrayValue() - { - Integer = new List {long.MaxValue, 4, 4, 2, 3} - } - } - }, - Position = 1, - }, - new Argument - { - Name = "doubleValue", - Type = DataType.DoubleType, - Values = new List - { - new ArgumentValue - { - Double = 3.14, - } - }, - Position = 1, - }, - new Argument - { - Name = "doubleArray", - ArrayType = DataType.DoubleType, - Type = DataType.ArrayType, - Values = new List - { - new ArgumentValue - { - Array = new ArrayValue() - { - Double = new List {0.6, 0.4, 43.2} - } - } - }, - Position = 2, - }, - new Argument - { - Name = "boolValue", - Type = DataType.BoolType, - Values = new List - { - new ArgumentValue - { - Bool = true, - } - }, - Position = 3, - }, - new Argument - { - Name = "boolArray", - ArrayType = DataType.BoolType, - Type = DataType.ArrayType, - Values = new List - { - new ArgumentValue - { - Array = new ArrayValue() - { - Bool = new List {true, false, true, true, false} - } - } - }, - Position = 4, - }, - new Argument - { - Name = "pauliValue", - Type = DataType.PauliType, - Values = new List - { - new ArgumentValue - { - Pauli = PauliValue.PauliZ, - } - }, - Position = 5, - }, - new Argument - { - Name = "pauliArray", - ArrayType = DataType.PauliType, - Type = DataType.ArrayType, - Values = new List - { - new ArgumentValue - { - Array = new ArrayValue() - { - Pauli = new List {PauliValue.PauliX, PauliValue.PauliI, PauliValue.PauliY, PauliValue.PauliY, PauliValue.Z} - } - } - }, - Position = 6, - }, - new Argument - { - Name = "rangeValue", - Type = DataType.RangeType, - Values = new List - { - new ArgumentValue - { - Range = new RangeValue - { - Start = 3, - Step = 12, - End = 27, - } - } - }, - Position = 7, - }, - new Argument - { - Name = "rangeArray", - ArrayType = DataType.RangeType, - Type = DataType.ArrayType, - Values = new List - { - new ArgumentValue - { - Array = new ArrayValue() - { - Range = new List - { - new RangeValue - { - Start = 0, - Step = 3, - End = 99, - }, - new RangeValue - { - Start = 2, - Step = 5, - End = 102, - } - } - } - } - }, - Position = 8, - }, - new Argument - { - Name = "resultValue", - Type = DataType.ResultType, - Values = new List - { - new ArgumentValue - { - Result = ResultValue.One, - } - }, - Position = 9, - }, - new Argument - { - Name = "resultArray", - ArrayType = DataType.ResultType, - Type = DataType.ArrayType, - Values = new List - { - new ArgumentValue - { - Array = new ArrayValue() - { - Result = new List { ResultValue.One, ResultValue.One, ResultValue.Zero, ResultValue.One} - } - } - }, - Position = 10, - }, - new Argument - { - Name = "stringValue", - Type = DataType.StringType, - Values = new List - { - new ArgumentValue - { - String = "string value", - } - }, - Position = 11, - }, - new Argument - { - Name = "stringArray", - ArrayType = DataType.StringType, - Type = DataType.ArrayType, - Values = new List - { - new ArgumentValue - { - Array = new ArrayValue() - { - String = new List {"string a", "string b", "string c"} - } - } - }, - Position = 12, - } - }, - - Name = "Quantum__StandaloneSupportedInputs__ExerciseInputs", - }; - - var qirFile = new FileInfo(@"C:\Users\alchocro\Desktop\qir-standalone-input-reference.ll"); - using var inputStream = qirFile.OpenRead(); - byte[] buffer = new byte[inputStream.Length]; - inputStream.Read(buffer, 0, (int)inputStream.Length); - var arraySegment = new ArraySegment(buffer); - var executionWrapper = new QirExecutionWrapper - { - EntryPoint = entryPoint, - QirBytecode = arraySegment, - }; - - var testCaseFile = new FileInfo(@"C:\Users\alchocro\git-repos\qsharp-runtime\src\Qir\Controller\test-cases\standalone-input-test.in"); - testCaseFile.Delete(); - using var outputStream = testCaseFile.OpenWrite(); - Microsoft.Quantum.QsCompiler.BondSchemas.QirExecutionWrapper.Protocols.SerializeToFastBinary(executionWrapper, outputStream); - Assert.False(true); - } - private bool BytecodesAreEqual(ArraySegment bytecodeA, ArraySegment bytecodeB) { if (bytecodeA.Count != bytecodeB.Count) diff --git a/src/Qir/Controller/test-cases/standalone-input-test.in b/src/Qir/Controller/test-cases/standalone-input-test.in index 2bd1d15b130a5aea00891a916fe7d9ede0378aee..e5a68f397cff07ece527b17cd914efb003cb6bbd 100644 GIT binary patch literal 47041 zcmeHw3w%>W_VB$)nuIh>leU!fo%DgV7D&=GO?a8~MG?>xaRo)2q)BbDkF>N12$&ab z!J?5xtjd2kWh(;9x&f5LscJzOuHiqNwQZT79KaUtU#dy1UM7uBxdu8K+m8>uMJk z73D29)fAU4G~s^-a}W-XAB3O?f{fxI?6S(*-|5TiOu=|;0i^M@_P(ZH=Fg&tDC>7Qr`1RER5Cx?Lp$MiM*ccK7op8+hy7Drz zmmsQ96i_3s5pPF0F4+?k;zDhES;It&0zL6TPxuGQ4gce`V8@U{*l~@%@*zsGPvJ0kr@>0HXwluy4>KtbtZhV_H~Oj+-a2icz2xXFiEAK410-WRgD)M22ef>Kap9 z5>y)ls*O|~@e8_zs)pSztgR`le25&ZV5-|xWE9H9D@BXooEg$TUP1N`wTbnQjh|OP zsi6N+bT&anPXY!Kz;p%XDDU`ZwCtRYk250>OdSTUB>9ecZxzz!_PB~hf5n(f(O~DSvEdD@utW}LHWVp<4bL31b6G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?(2H_k4|ur0Yuo7PHV@{cDY69=?qK8QgP?kY%u5L^9MLh(9ZB z$y^$>yCK`oZ&|WLODO@nfrZvqq@x>0M&bb^AJ2CHMc^_9!R!c6OBp+gcPw7~XfQ zP^(dikUA9FEl|x|nofnN{0Z+r(vAp~U1H-J&iID*^k6kY!_KvTrFB%=3%n}YM%F|W zU8VW9D~9ga-J?B`-O9Y>8ofNt!})i#=}3W7bt|Zpk`hC>k&09y`82h-!KV+e z#rv`zB;;4B#fPO@TvhcLR4vCLF}oZucC^H~pL(Ytr{h3+!w`|C(ai``1=BcQuGpkk6QwKxI zLpuy&wk?Dr{q7(Hv}XMloxK!J3zb`C!|Z`;X7KaV2t*aCAuTuEVpt9&`QDD-bUqBTO+3g84tS} zqPn9%3j~%*U+NURJm={$Jx}mh~`6Q#=3yhijCXG9ay)DP^8=vF;l%&8CugMz_L_@=|-y7Z!JC6 z$WA4$wQua#IclL-4rtpDBtxxAM+P!jV0H7c#M&+h9Sn`Ad1}teK9wuR^d>S&H+uSGuO&QDgfdR)fOE#mtwI1~nkA>R*B*y>np{wnjECaLN|V z1J6mnqZbv@#gV9PKo?uAlo#NNZ>U{z%>LLbpP3fJ#S?4ML|b4f>3Ppvlf)(0M8j*psp_)ILQZ_8_YmyQnLr>WU4+ zUBb0Eiy;i<0)c~8Wn&p(D44)nlwAnIQ1B=jtZB=MH9bn?6!y-LZhV=(uhY~76(#z_rO8|yGm|N z67aty0eZ2rcs1xt68Mq?)}Z~i6K=9mjn46xB%qH@TA;-s9?Fo9kOX8iO+q}q_gTew zx}J5|Y*(+)lwPKRSBP%4`q=*UJb%;6GA=2hny)NbR(9kRyKU`TEhTXRl^APIfMJfq u!jo0bmsBr&i!G9us<8Mji+M7g-@l|+ob6!*$}sFLy^Q&u_IAXG&VK Date: Thu, 15 Apr 2021 10:02:37 -0700 Subject: [PATCH 14/23] Create working test and fix issues --- .../Controller/Driver/QirDriverGenerator.cs | 2 -- .../test-cases/standalone-input-test.in | Bin 47041 -> 44066 bytes .../test-cases/standalone-input-test.out | 18 +++++++++--------- .../qsharp/qir-standalone-input-reference.qs | 3 +-- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/Qir/Controller/Driver/QirDriverGenerator.cs b/src/Qir/Controller/Driver/QirDriverGenerator.cs index 9474c42e36b..3c520707401 100644 --- a/src/Qir/Controller/Driver/QirDriverGenerator.cs +++ b/src/Qir/Controller/Driver/QirDriverGenerator.cs @@ -23,8 +23,6 @@ public QirDriverGenerator(ILogger logger) public async Task GenerateQirDriverCppAsync(DirectoryInfo sourceDirectory, EntryPointOperation entryPointOperation, ArraySegment bytecode) { - return; - // Wrapped in a task because DirectoryInfo operations are not asynchronous. await Task.Run(async () => { diff --git a/src/Qir/Controller/test-cases/standalone-input-test.in b/src/Qir/Controller/test-cases/standalone-input-test.in index e5a68f397cff07ece527b17cd914efb003cb6bbd..2251eb15f36354835911c0b1eb4f81ff2a71e3a6 100644 GIT binary patch literal 44066 zcmeHw3tZFX`uO*|jctxGHbCV%Ho!zg-NsNtFUJp=;D^X^YIJ4QHKn<^cU0@j^tzJrGQ%A;Mq_zpwL!nI%ve)h zm7AMcYpBdGsxshz`*RQum+yz52!c%DAnc;D>brC$H3t7MgoFAAA_6o4iB`!ll~zHAB80F$7bNq`lABB%lP#WgP=j)X~f@j;tpM^PEm$z*5EfjiD_cn^7HSU{ zPY7yEfU^hE5CI3_!aKMGfk*@n!CycLatrII(oj`Xf*T8{BQ{9INyQST;H@kInG|9I zM213mB*%n^g+ef(5Tqc)9TW=%hs9P^R~D76Bvr?uij7Ampj&OJkO?M;x0G)X>CNZ=&gY+1o=z>GK;! zZ=*7cEi@rM!7hEkx#Ce#Z!e(xun0k_z+D!@=7{v`7{PIEHt=)Y)@lz4%CZ9yW4!yp2Yu)05-O^m!*# zXl9!VUEG$A-WivU-lI=P4SfQWIxHkKr7_lTcJFb{jP*!K6C$#UO{tcFrpN5mxZ@)d^aLBPZTN&?|$$(nc0SfUia%r>09e1#!8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z0!X-q8W5^2nO+HF&xK{h$iC4lS8lAl6`Y)r4b(hZrkK2G7rS;&o^AvvG}VCFYe0HFITjbz3(j3mIt zCiGR_J~w z;yv>kR042)IsX~5SE~|0)o=K(L|AbR`~uvo>0 zS97G`f1wF1Sf-jPv(G~1z1Borod`HBAWlQ!alum1*srZmEx0^9eC6=l_G{-~DjhEw K4^#OO(intArray)} ({Count(TautologyPredicate, intArray)})"); @@ -45,6 +45,5 @@ Message($"resultValue: {resultValue}"); Message($"resultArray: {ArrayToString(resultArray)} ({Count(TautologyPredicate, resultArray)})"); Message($"stringValue: {stringValue}"); - Message($"stringArray: {ArrayToString(stringArray)} ({Count(TautologyPredicate, stringArray)})"); } } From e4e6c2286936fb6ac4fad294a4b0159140836124 Mon Sep 17 00:00:00 2001 From: Zander Chocron Date: Thu, 15 Apr 2021 10:11:58 -0700 Subject: [PATCH 15/23] Fix header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: César Zaragoza Cortés --- .../Controller/Tests.QirController/QirDriverGeneratorTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs b/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs index f672b441ae8..2579ab89c9a 100644 --- a/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs +++ b/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; From 432d88e623592d3b7d99cb0b1d3e3ef344f51a56 Mon Sep 17 00:00:00 2001 From: Zander Chocron Date: Thu, 15 Apr 2021 10:12:07 -0700 Subject: [PATCH 16/23] Fix header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: César Zaragoza Cortés --- .../Tests.QirController/QirExecutableGeneratorTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs b/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs index 5e969943b8e..86659210e6a 100644 --- a/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs +++ b/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; From b80383bb15099f8a57484c69bf3808180bd941e9 Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Thu, 15 Apr 2021 10:27:33 -0700 Subject: [PATCH 17/23] Address feedbacks --- src/Qir/Controller/Constant.cs | 6 ++ src/Qir/Controller/Controller.cs | 4 +- ...enerator.cs => IQirSourceFileGenerator.cs} | 4 +- .../Controller/Driver/QirDriverGenerator.cs | 57 ------------------- .../Driver/QirSourceFileGenerator.cs | 53 +++++++++++++++++ .../Executable/QirExecutableGenerator.cs | 13 +++-- src/Qir/Controller/Program.cs | 2 +- .../Tests.QirController/ControllerTests.cs | 6 +- .../QirDriverGeneratorTests.cs | 6 +- .../QirExecutableGeneratorTests.cs | 6 +- 10 files changed, 82 insertions(+), 75 deletions(-) rename src/Qir/Controller/Driver/{IQirDriverGenerator.cs => IQirSourceFileGenerator.cs} (77%) delete mode 100644 src/Qir/Controller/Driver/QirDriverGenerator.cs create mode 100644 src/Qir/Controller/Driver/QirSourceFileGenerator.cs diff --git a/src/Qir/Controller/Constant.cs b/src/Qir/Controller/Constant.cs index 23d5a8ba351..7e83a3b49c2 100644 --- a/src/Qir/Controller/Constant.cs +++ b/src/Qir/Controller/Constant.cs @@ -10,5 +10,11 @@ public static class ErrorCode { public const string InternalError = "InternalError"; } + + public static class FileExtension + { + public const string CppExtension = ".cpp"; + public const string BytecodeExtension = ".bc"; + } } } diff --git a/src/Qir/Controller/Controller.cs b/src/Qir/Controller/Controller.cs index cb626a5bb34..70378632128 100644 --- a/src/Qir/Controller/Controller.cs +++ b/src/Qir/Controller/Controller.cs @@ -25,7 +25,7 @@ public static async Task ExecuteAsync( DirectoryInfo libraryDirectory, DirectoryInfo includeDirectory, FileInfo errorFile, - IQirDriverGenerator driverGenerator, + IQirSourceFileGenerator driverGenerator, IQirExecutableGenerator executableGenerator, IQuantumExecutableRunner executableRunner, ILogger logger) @@ -40,7 +40,7 @@ public static async Task ExecuteAsync( // Step 2: Create driver. logger.LogInfo("Creating driver file."); var sourceDirectory = new DirectoryInfo(SourceDirectoryPath); - await driverGenerator.GenerateQirDriverCppAsync(sourceDirectory, input.EntryPoint, input.QirBytecode); + await driverGenerator.GenerateQirSourceFilesAsync(sourceDirectory, input.EntryPoint, input.QirBytecode); // Step 3: Create executable. logger.LogInfo("Compiling and linking executable."); diff --git a/src/Qir/Controller/Driver/IQirDriverGenerator.cs b/src/Qir/Controller/Driver/IQirSourceFileGenerator.cs similarity index 77% rename from src/Qir/Controller/Driver/IQirDriverGenerator.cs rename to src/Qir/Controller/Driver/IQirSourceFileGenerator.cs index e4dc2a6172c..92e0449c77a 100644 --- a/src/Qir/Controller/Driver/IQirDriverGenerator.cs +++ b/src/Qir/Controller/Driver/IQirSourceFileGenerator.cs @@ -8,7 +8,7 @@ namespace Microsoft.Quantum.Qir.Driver { - public interface IQirDriverGenerator + public interface IQirSourceFileGenerator { /// /// Generates the C++ driver source file and writes the bytecode to a file. @@ -17,6 +17,6 @@ public interface IQirDriverGenerator /// Entry point information. /// The QIR bytecode. /// - Task GenerateQirDriverCppAsync(DirectoryInfo sourceDirectory, EntryPointOperation entryPointOperation, ArraySegment bytecode); + Task GenerateQirSourceFilesAsync(DirectoryInfo sourceDirectory, EntryPointOperation entryPointOperation, ArraySegment bytecode); } } diff --git a/src/Qir/Controller/Driver/QirDriverGenerator.cs b/src/Qir/Controller/Driver/QirDriverGenerator.cs deleted file mode 100644 index 3c520707401..00000000000 --- a/src/Qir/Controller/Driver/QirDriverGenerator.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT License. - -using System; -using System.IO; -using System.Threading.Tasks; -using Microsoft.Quantum.Qir.Utility; -using Microsoft.Quantum.QsCompiler; -using Microsoft.Quantum.QsCompiler.BondSchemas.EntryPoint; - -namespace Microsoft.Quantum.Qir.Driver -{ - public class QirDriverGenerator : IQirDriverGenerator - { - private const string BytecodeFileName = "qir.bc"; - private const string DriverFileName = "driver.cpp"; - private readonly ILogger logger; - - public QirDriverGenerator(ILogger logger) - { - this.logger = logger; - } - - public async Task GenerateQirDriverCppAsync(DirectoryInfo sourceDirectory, EntryPointOperation entryPointOperation, ArraySegment bytecode) - { - // Wrapped in a task because DirectoryInfo operations are not asynchronous. - await Task.Run(async () => - { - if (sourceDirectory.Exists) - { - sourceDirectory.Delete(true); - } - - sourceDirectory.Create(); - logger.LogInfo($"Created source directory at {sourceDirectory.FullName}."); - - // Create driver. - var driverFile = new FileInfo(Path.Combine(sourceDirectory.FullName, DriverFileName)); - using var driverFileStream = driverFile.OpenWrite(); - GenerateQirDriverCppHelper(entryPointOperation, driverFileStream); - logger.LogInfo($"Created driver file at {driverFile.FullName}."); - - // Create bytecode file. - var bytecodeFile = new FileInfo(Path.Combine(sourceDirectory.FullName, BytecodeFileName)); - using var bytecodeFileStream = bytecodeFile.OpenWrite(); - await bytecodeFileStream.WriteAsync(bytecode.Array, bytecode.Offset, bytecode.Count); - logger.LogInfo($"Created bytecode file at {bytecodeFile.FullName}."); - }); - } - - // Virtual method wrapper is to enable mocking in unit tests. - public virtual void GenerateQirDriverCppHelper(EntryPointOperation entryPointOperation, Stream stream) - { - QirDriverGeneration.GenerateQirDriverCpp(entryPointOperation, stream); - } - } -} diff --git a/src/Qir/Controller/Driver/QirSourceFileGenerator.cs b/src/Qir/Controller/Driver/QirSourceFileGenerator.cs new file mode 100644 index 00000000000..aa7156323af --- /dev/null +++ b/src/Qir/Controller/Driver/QirSourceFileGenerator.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +using System; +using System.IO; +using System.Threading.Tasks; +using Microsoft.Quantum.Qir.Utility; +using Microsoft.Quantum.QsCompiler; +using Microsoft.Quantum.QsCompiler.BondSchemas.EntryPoint; + +namespace Microsoft.Quantum.Qir.Driver +{ + public class QirSourceFileGenerator : IQirSourceFileGenerator + { + private const string BytecodeFileName = "qir" + Constant.FileExtension.BytecodeExtension; + private const string DriverFileName = "driver" + Constant.FileExtension.CppExtension; + private readonly ILogger logger; + + public QirSourceFileGenerator(ILogger logger) + { + this.logger = logger; + } + + public async Task GenerateQirSourceFilesAsync(DirectoryInfo sourceDirectory, EntryPointOperation entryPointOperation, ArraySegment bytecode) + { + if (sourceDirectory.Exists) + { + sourceDirectory.Delete(true); + } + + sourceDirectory.Create(); + logger.LogInfo($"Created source directory at {sourceDirectory.FullName}."); + + // Create driver. + var driverFile = new FileInfo(Path.Combine(sourceDirectory.FullName, DriverFileName)); + using var driverFileStream = driverFile.OpenWrite(); + GenerateQirDriverCppHelper(entryPointOperation, driverFileStream); + logger.LogInfo($"Created driver file at {driverFile.FullName}."); + + // Create bytecode file. + var bytecodeFile = new FileInfo(Path.Combine(sourceDirectory.FullName, BytecodeFileName)); + using var bytecodeFileStream = bytecodeFile.OpenWrite(); + await bytecodeFileStream.WriteAsync(bytecode.Array, bytecode.Offset, bytecode.Count); + logger.LogInfo($"Created bytecode file at {bytecodeFile.FullName}."); + } + + // Virtual method wrapper is to enable mocking in unit tests. + public virtual void GenerateQirDriverCppHelper(EntryPointOperation entryPointOperation, Stream stream) + { + QirDriverGeneration.GenerateQirDriverCpp(entryPointOperation, stream); + } + } +} diff --git a/src/Qir/Controller/Executable/QirExecutableGenerator.cs b/src/Qir/Controller/Executable/QirExecutableGenerator.cs index f76db73c9cf..5247af4ad32 100644 --- a/src/Qir/Controller/Executable/QirExecutableGenerator.cs +++ b/src/Qir/Controller/Executable/QirExecutableGenerator.cs @@ -41,19 +41,24 @@ await Task.Run(async () => CopyFileIfNotExists(file, binDirectory); } - // Copy all include contents to bin. - logger.LogInfo("Copying include directory contents into the executable's folder."); + // Copy all include contents to src. + logger.LogInfo("Copying include directory contents into the source folder."); var includeFiles = includeDirectory.GetFiles(); foreach (var file in includeFiles) { - CopyFileIfNotExists(file, binDirectory); + CopyFileIfNotExists(file, sourceDirectory); } - var inputFiles = sourceDirectory.GetFiles().Select(fileInfo => fileInfo.FullName).ToArray(); + var inputFiles = sourceDirectory.GetFiles().Where(IsInputFile).Select(fileInfo => fileInfo.FullName).ToArray(); await clangClient.CreateExecutableAsync(inputFiles, LibrariesToLink, libraryDirectory.FullName, includeDirectory.FullName, executableFile.FullName); }); } + private bool IsInputFile(FileInfo file) + { + return file.Extension == Constant.FileExtension.BytecodeExtension || file.Extension == Constant.FileExtension.CppExtension; + } + private void CopyFileIfNotExists(FileInfo fileToCopy, DirectoryInfo destinationDirectory) { var newPath = Path.Combine(destinationDirectory.FullName, fileToCopy.Name); diff --git a/src/Qir/Controller/Program.cs b/src/Qir/Controller/Program.cs index 88677d0d1ce..6def5f9d223 100644 --- a/src/Qir/Controller/Program.cs +++ b/src/Qir/Controller/Program.cs @@ -16,7 +16,7 @@ static void Main(string[] args) { var logger = new Logger(new Clock()); var execGenerator = new QirExecutableGenerator(new ClangClient(logger), logger); - var driverGenerator = new QirDriverGenerator(logger); + var driverGenerator = new QirSourceFileGenerator(logger); var execRunner = new QuantumExecutableRunner(logger); logger.LogInfo("QIR controller beginning."); diff --git a/src/Qir/Controller/Tests.QirController/ControllerTests.cs b/src/Qir/Controller/Tests.QirController/ControllerTests.cs index 728438aea4e..6e85b07976b 100644 --- a/src/Qir/Controller/Tests.QirController/ControllerTests.cs +++ b/src/Qir/Controller/Tests.QirController/ControllerTests.cs @@ -21,7 +21,7 @@ namespace Tests.QirController { public class ControllerTests : IDisposable { - private Mock driverGeneratorMock; + private Mock driverGeneratorMock; private Mock executableGeneratorMock; private Mock executableRunnerMock; private Mock loggerMock; @@ -33,7 +33,7 @@ public class ControllerTests : IDisposable public ControllerTests() { - driverGeneratorMock = new Mock(); + driverGeneratorMock = new Mock(); executableGeneratorMock = new Mock(); executableRunnerMock = new Mock(); inputFile = new FileInfo($"{Guid.NewGuid()}-input"); @@ -101,7 +101,7 @@ await Controller.ExecuteAsync( loggerMock.Object); // Verify driver was created. - driverGeneratorMock.Verify(obj => obj.GenerateQirDriverCppAsync( + driverGeneratorMock.Verify(obj => obj.GenerateQirSourceFilesAsync( It.IsAny(), It.Is(entryPoint => Util.EntryPointsAreEqual(entryPoint, input.EntryPoint)), It.Is>(bytecode => BytecodesAreEqual(bytecode, input.QirBytecode)))); diff --git a/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs b/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs index f672b441ae8..e65364a3f75 100644 --- a/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs +++ b/src/Qir/Controller/Tests.QirController/QirDriverGeneratorTests.cs @@ -15,12 +15,12 @@ namespace Tests.QirController { public class QirDriverGeneratorTests : IDisposable { - private readonly Mock driverGeneratorMock; + private readonly Mock driverGeneratorMock; private readonly DirectoryInfo sourceDirectory; public QirDriverGeneratorTests() { - driverGeneratorMock = new Mock(Mock.Of()) { CallBase = true }; + driverGeneratorMock = new Mock(Mock.Of()) { CallBase = true }; driverGeneratorMock.Setup(obj => obj.GenerateQirDriverCppHelper(It.IsAny(), It.IsAny())); sourceDirectory = new DirectoryInfo($"{Guid.NewGuid()}-source"); } @@ -47,7 +47,7 @@ public async Task TestGenerateDriver() }; byte[] bytes = { 1, 2, 3, 4, 5 }; var bytecode = new ArraySegment(bytes, 1, 3); - await driverGeneratorMock.Object.GenerateQirDriverCppAsync(sourceDirectory, entryPoint, bytecode); + await driverGeneratorMock.Object.GenerateQirSourceFilesAsync(sourceDirectory, entryPoint, bytecode); driverGeneratorMock.Verify(obj => obj.GenerateQirDriverCppHelper(It.Is(actualEntryPoint => Util.EntryPointsAreEqual(entryPoint, actualEntryPoint)), It.IsAny())); // Verify that the "bytecode" file was created correctly. diff --git a/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs b/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs index 5e969943b8e..eea3fd75633 100644 --- a/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs +++ b/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs @@ -52,8 +52,8 @@ public QirExecutableGeneratorTests() sourceDirectory.Create(); sourceFiles = new List() { - CreateFile("src1", sourceDirectory, "src1 contents"), - CreateFile("src2", sourceDirectory, "src2 contents"), + CreateFile("src1.cpp", sourceDirectory, "src1 contents"), + CreateFile("src2.bc", sourceDirectory, "src2 contents"), }; } @@ -86,7 +86,7 @@ public async Task TestGenerateExecutable() executableFile.FullName)); // Verify files were copied. - Assert.True(FilesWereCopied(includeFiles.ToArray(), binDirectory)); + Assert.True(FilesWereCopied(includeFiles.ToArray(), sourceDirectory)); Assert.True(FilesWereCopied(libraryFiles.ToArray(), binDirectory)); } From b0f0285e616010e74a21ba8ad585e1877dfe1795 Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Thu, 15 Apr 2021 14:31:53 -0700 Subject: [PATCH 18/23] Update package --- src/Qir/Controller/QirController.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Qir/Controller/QirController.csproj b/src/Qir/Controller/QirController.csproj index 7c12b01b4ce..e9574233c00 100644 --- a/src/Qir/Controller/QirController.csproj +++ b/src/Qir/Controller/QirController.csproj @@ -22,7 +22,7 @@ - + From b7cb61f8f4a47b8ab9fd01218ad19697fb9d68ef Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Fri, 16 Apr 2021 10:18:16 -0700 Subject: [PATCH 19/23] Remove logic to copy include files --- src/Qir/Controller/Constant.cs | 6 ------ .../Controller/Driver/QirSourceFileGenerator.cs | 4 ++-- .../Executable/QirExecutableGenerator.cs | 15 +-------------- .../QirExecutableGeneratorTests.cs | 7 ------- 4 files changed, 3 insertions(+), 29 deletions(-) diff --git a/src/Qir/Controller/Constant.cs b/src/Qir/Controller/Constant.cs index 7e83a3b49c2..23d5a8ba351 100644 --- a/src/Qir/Controller/Constant.cs +++ b/src/Qir/Controller/Constant.cs @@ -10,11 +10,5 @@ public static class ErrorCode { public const string InternalError = "InternalError"; } - - public static class FileExtension - { - public const string CppExtension = ".cpp"; - public const string BytecodeExtension = ".bc"; - } } } diff --git a/src/Qir/Controller/Driver/QirSourceFileGenerator.cs b/src/Qir/Controller/Driver/QirSourceFileGenerator.cs index aa7156323af..7a7cfe891a2 100644 --- a/src/Qir/Controller/Driver/QirSourceFileGenerator.cs +++ b/src/Qir/Controller/Driver/QirSourceFileGenerator.cs @@ -12,8 +12,8 @@ namespace Microsoft.Quantum.Qir.Driver { public class QirSourceFileGenerator : IQirSourceFileGenerator { - private const string BytecodeFileName = "qir" + Constant.FileExtension.BytecodeExtension; - private const string DriverFileName = "driver" + Constant.FileExtension.CppExtension; + private const string BytecodeFileName = "qir.bc"; + private const string DriverFileName = "driver.cpp"; private readonly ILogger logger; public QirSourceFileGenerator(ILogger logger) diff --git a/src/Qir/Controller/Executable/QirExecutableGenerator.cs b/src/Qir/Controller/Executable/QirExecutableGenerator.cs index 5247af4ad32..9445f300115 100644 --- a/src/Qir/Controller/Executable/QirExecutableGenerator.cs +++ b/src/Qir/Controller/Executable/QirExecutableGenerator.cs @@ -41,24 +41,11 @@ await Task.Run(async () => CopyFileIfNotExists(file, binDirectory); } - // Copy all include contents to src. - logger.LogInfo("Copying include directory contents into the source folder."); - var includeFiles = includeDirectory.GetFiles(); - foreach (var file in includeFiles) - { - CopyFileIfNotExists(file, sourceDirectory); - } - - var inputFiles = sourceDirectory.GetFiles().Where(IsInputFile).Select(fileInfo => fileInfo.FullName).ToArray(); + var inputFiles = sourceDirectory.GetFiles().Select(fileInfo => fileInfo.FullName).ToArray(); await clangClient.CreateExecutableAsync(inputFiles, LibrariesToLink, libraryDirectory.FullName, includeDirectory.FullName, executableFile.FullName); }); } - private bool IsInputFile(FileInfo file) - { - return file.Extension == Constant.FileExtension.BytecodeExtension || file.Extension == Constant.FileExtension.CppExtension; - } - private void CopyFileIfNotExists(FileInfo fileToCopy, DirectoryInfo destinationDirectory) { var newPath = Path.Combine(destinationDirectory.FullName, fileToCopy.Name); diff --git a/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs b/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs index c835a7e522e..3d9da400687 100644 --- a/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs +++ b/src/Qir/Controller/Tests.QirController/QirExecutableGeneratorTests.cs @@ -23,7 +23,6 @@ public class QirExecutableGeneratorTests : IDisposable private readonly DirectoryInfo binDirectory; private readonly IList libraryFiles; private readonly IList sourceFiles; - private readonly IList includeFiles; public QirExecutableGeneratorTests() { @@ -43,11 +42,6 @@ public QirExecutableGeneratorTests() }; includeDirectory = new DirectoryInfo($"{prefix}-include"); includeDirectory.Create(); - includeFiles = new List() - { - CreateFile("incl1", includeDirectory, "incl1 contents"), - CreateFile("incl2", includeDirectory, "incl2 contents"), - }; sourceDirectory = new DirectoryInfo($"{prefix}-source"); sourceDirectory.Create(); sourceFiles = new List() @@ -86,7 +80,6 @@ public async Task TestGenerateExecutable() executableFile.FullName)); // Verify files were copied. - Assert.True(FilesWereCopied(includeFiles.ToArray(), sourceDirectory)); Assert.True(FilesWereCopied(libraryFiles.ToArray(), binDirectory)); } From f9de9da8e7ddb476ae5cb75e4a6db223f4b6e36c Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Fri, 16 Apr 2021 11:52:36 -0700 Subject: [PATCH 20/23] Add runtime building to test script --- src/Qir/Controller/test-qir-controller.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Qir/Controller/test-qir-controller.ps1 b/src/Qir/Controller/test-qir-controller.ps1 index ee3ce6e85ec..56111229e0b 100644 --- a/src/Qir/Controller/test-qir-controller.ps1 +++ b/src/Qir/Controller/test-qir-controller.ps1 @@ -13,6 +13,10 @@ $headerPaths = @((Join-Path $PSScriptRoot "..\..\Qir\Common\externals\CLI11"), ( $libraryPaths = @((Join-Path $PSScriptRoot "..\..\Qir\Runtime\build\Debug\bin"), (Join-Path $PSScriptRoot "..\..\Simulation\Simulators\bin\Debug\netstandard2.1")) $includeDirectory = (Join-Path $testArtifactsFolder "include") $libraryDirectory = (Join-Path $testArtifactsFolder "library") +$runtimeScript = (Join-Path $PSScriptRoot "..\..\Qir\Runtime\build-qir-runtime.ps1") + +# Build the runtime +Invoke-Expression $runtimeScript if (!(Test-Path $testArtifactsFolder -PathType Container)) { New-Item -ItemType Directory -Force -Path $testArtifactsFolder From 56c2d95cb4d4c09a0c2eb5d526f700f9842c59bf Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Fri, 16 Apr 2021 16:05:29 -0700 Subject: [PATCH 21/23] Fix build configuration issue in test script --- src/Qir/Controller/test-qir-controller.ps1 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Qir/Controller/test-qir-controller.ps1 b/src/Qir/Controller/test-qir-controller.ps1 index 56111229e0b..6d035760b9c 100644 --- a/src/Qir/Controller/test-qir-controller.ps1 +++ b/src/Qir/Controller/test-qir-controller.ps1 @@ -5,18 +5,15 @@ $all_ok = $True Write-Host "##[info]Test QIR Controller" +$buildConfiguration = $Env:BUILD_CONFIGURATION $controllerProject = (Join-Path $PSScriptRoot QirController.csproj) $testCasesFolder = (Join-Path $PSScriptRoot "test-cases") $testArtifactsFolder = (Join-Path $PSScriptRoot "test-artifacts") $includeDirectory = (Join-Path $testArtifactsFolder "include") $headerPaths = @((Join-Path $PSScriptRoot "..\..\Qir\Common\externals\CLI11"), (Join-Path $PSScriptRoot "..\..\Qir\Runtime\public")) -$libraryPaths = @((Join-Path $PSScriptRoot "..\..\Qir\Runtime\build\Debug\bin"), (Join-Path $PSScriptRoot "..\..\Simulation\Simulators\bin\Debug\netstandard2.1")) +$libraryPaths = @((Join-Path $PSScriptRoot "..\..\Qir\Runtime\build\$buildConfiguration\bin"), (Join-Path $PSScriptRoot "..\..\Simulation\Simulators\bin\$buildConfiguration\netstandard2.1")) $includeDirectory = (Join-Path $testArtifactsFolder "include") $libraryDirectory = (Join-Path $testArtifactsFolder "library") -$runtimeScript = (Join-Path $PSScriptRoot "..\..\Qir\Runtime\build-qir-runtime.ps1") - -# Build the runtime -Invoke-Expression $runtimeScript if (!(Test-Path $testArtifactsFolder -PathType Container)) { New-Item -ItemType Directory -Force -Path $testArtifactsFolder From 7446f8be04ad86caff08c9cc4fdbd6e027eabd7e Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Mon, 19 Apr 2021 12:53:33 -0700 Subject: [PATCH 22/23] Try adding clang to path --- src/Qir/Controller/test-qir-controller.ps1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Qir/Controller/test-qir-controller.ps1 b/src/Qir/Controller/test-qir-controller.ps1 index 6d035760b9c..f676a13b801 100644 --- a/src/Qir/Controller/test-qir-controller.ps1 +++ b/src/Qir/Controller/test-qir-controller.ps1 @@ -15,6 +15,20 @@ $libraryPaths = @((Join-Path $PSScriptRoot "..\..\Qir\Runtime\build\$buildConfi $includeDirectory = (Join-Path $testArtifactsFolder "include") $libraryDirectory = (Join-Path $testArtifactsFolder "library") +if (($IsWindows) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Win")))) +{ + Write-Host "On Windows build using Clang" + $env:CC = "clang.exe" + $env:CXX = "clang++.exe" + $env:RC = "clang++.exe" + + if (!(Get-Command clang -ErrorAction SilentlyContinue) -and (choco find --idonly -l llvm) -contains "llvm") { + # LLVM was installed by Chocolatey, so add the install location to the path. + $env:PATH += ";$($env:SystemDrive)\Program Files\LLVM\bin" + Write-Host "Adding clang to path." + } +} + if (!(Test-Path $testArtifactsFolder -PathType Container)) { New-Item -ItemType Directory -Force -Path $testArtifactsFolder } From 92d12692d0a5be1e897b308b629285eb5ef1ab04 Mon Sep 17 00:00:00 2001 From: Alexander Chocron Date: Mon, 19 Apr 2021 13:02:17 -0700 Subject: [PATCH 23/23] Print path in script --- src/Qir/Controller/test-qir-controller.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Qir/Controller/test-qir-controller.ps1 b/src/Qir/Controller/test-qir-controller.ps1 index f676a13b801..c8dc17ea1aa 100644 --- a/src/Qir/Controller/test-qir-controller.ps1 +++ b/src/Qir/Controller/test-qir-controller.ps1 @@ -25,7 +25,7 @@ if (($IsWindows) -or ((Test-Path Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("W if (!(Get-Command clang -ErrorAction SilentlyContinue) -and (choco find --idonly -l llvm) -contains "llvm") { # LLVM was installed by Chocolatey, so add the install location to the path. $env:PATH += ";$($env:SystemDrive)\Program Files\LLVM\bin" - Write-Host "Adding clang to path." + Write-Host "Adding clang to path. Path: $env:PATH" } }