diff --git a/src/QsCompiler/CompilationManager/CompilationUnit.cs b/src/QsCompiler/CompilationManager/CompilationUnit.cs index ada37b377f..3e35dc5fae 100644 --- a/src/QsCompiler/CompilationManager/CompilationUnit.cs +++ b/src/QsCompiler/CompilationManager/CompilationUnit.cs @@ -280,7 +280,7 @@ public class CompilationUnit : IReaderWriterLock, IDisposable internal readonly RuntimeCapabilities RuntimeCapabilities; internal readonly bool IsExecutable; - internal readonly NonNullable ExecutionTarget; + internal readonly NonNullable ProcessorArchitecture; public void Dispose() { this.SyncRoot.Dispose(); } @@ -293,7 +293,7 @@ public void Dispose() internal CompilationUnit( RuntimeCapabilities capabilities, bool isExecutable, - NonNullable executionTarget, + NonNullable processorArchitecture, References externals = null, IEnumerable dependentLocks = null) { @@ -305,7 +305,7 @@ internal CompilationUnit( this.RuntimeCapabilities = capabilities; this.IsExecutable = isExecutable; - this.ExecutionTarget = executionTarget; + this.ProcessorArchitecture = processorArchitecture; this.CompiledCallables = new Dictionary(); this.CompiledTypes = new Dictionary(); diff --git a/src/QsCompiler/CompilationManager/CompilationUnitManager.cs b/src/QsCompiler/CompilationManager/CompilationUnitManager.cs index 2cda5999be..7250194f8c 100644 --- a/src/QsCompiler/CompilationManager/CompilationUnitManager.cs +++ b/src/QsCompiler/CompilationManager/CompilationUnitManager.cs @@ -69,10 +69,10 @@ public CompilationUnitManager( bool syntaxCheckOnly = false, AssemblyConstants.RuntimeCapabilities capabilities = AssemblyConstants.RuntimeCapabilities.Unknown, bool isExecutable = false, - NonNullable executionTarget = default) + NonNullable processorArchitecture = default) { this.EnableVerification = !syntaxCheckOnly; - this.CompilationUnit = new CompilationUnit(capabilities, isExecutable, executionTarget); + this.CompilationUnit = new CompilationUnit(capabilities, isExecutable, processorArchitecture); this.FileContentManagers = new ConcurrentDictionary, FileContentManager>(); this.ChangedFiles = new ManagedHashSet>(new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion)); this.PublishDiagnostics = publishDiagnostics ?? (_ => { }); @@ -467,7 +467,7 @@ private Task SpawnGlobalTypeCheckingAsync(bool runSynchronously = false) var compilation = new CompilationUnit( this.CompilationUnit.RuntimeCapabilities, this.CompilationUnit.IsExecutable, - this.CompilationUnit.ExecutionTarget, + this.CompilationUnit.ProcessorArchitecture, this.CompilationUnit.Externals, sourceFiles.Select(file => file.SyncRoot)); var content = compilation.UpdateGlobalSymbolsFor(sourceFiles); diff --git a/src/QsCompiler/CompilationManager/ProjectManager.cs b/src/QsCompiler/CompilationManager/ProjectManager.cs index e5855fdffe..b6b004ed00 100644 --- a/src/QsCompiler/CompilationManager/ProjectManager.cs +++ b/src/QsCompiler/CompilationManager/ProjectManager.cs @@ -23,7 +23,7 @@ internal class ProjectProperties public readonly string OutputPath; public readonly AssemblyConstants.RuntimeCapabilities RuntimeCapabilities; public readonly bool IsExecutable; - public readonly NonNullable ExecutionTarget; + public readonly NonNullable ProcessorArchitecture; public readonly bool ExposeReferencesViaTestNames; public ProjectProperties( @@ -31,14 +31,14 @@ public ProjectProperties( string outputPath, AssemblyConstants.RuntimeCapabilities runtimeCapabilities, bool isExecutable, - NonNullable executionTarget, + NonNullable processorArchitecture, bool loadTestNames) { this.Version = version ?? ""; this.OutputPath = outputPath ?? throw new ArgumentNullException(nameof(outputPath)); this.RuntimeCapabilities = runtimeCapabilities; this.IsExecutable = isExecutable; - this.ExecutionTarget = executionTarget; + this.ProcessorArchitecture = processorArchitecture; this.ExposeReferencesViaTestNames = loadTestNames; } } @@ -72,14 +72,14 @@ public ProjectInformation( string outputPath, AssemblyConstants.RuntimeCapabilities runtimeCapabilities, bool isExecutable, - NonNullable executionTarget, + NonNullable processorArchitecture, bool loadTestNames, IEnumerable sourceFiles, IEnumerable projectReferences, IEnumerable references) { this.Properties = new ProjectProperties( - version, outputPath, runtimeCapabilities, isExecutable, executionTarget, loadTestNames); + version, outputPath, runtimeCapabilities, isExecutable, processorArchitecture, loadTestNames); this.SourceFiles = sourceFiles?.ToImmutableArray() ?? throw new ArgumentNullException(nameof(sourceFiles)); this.ProjectReferences = projectReferences?.ToImmutableArray() ?? throw new ArgumentNullException(nameof(projectReferences)); this.References = references?.ToImmutableArray() ?? throw new ArgumentNullException(nameof(references)); @@ -177,7 +177,7 @@ internal Project(Uri projectFile, ProjectInformation projectInfo, syntaxCheckOnly: ignore, this.Properties.RuntimeCapabilities, this.Properties.IsExecutable, - this.Properties.ExecutionTarget); + this.Properties.ProcessorArchitecture); this.Log = log ?? ((msg, severity) => Console.WriteLine($"{severity}: {msg}")); this.LoadedSourceFiles = ImmutableHashSet.Empty; diff --git a/src/QsCompiler/CompilationManager/TypeChecking.cs b/src/QsCompiler/CompilationManager/TypeChecking.cs index 9caeeaf924..24fc2df6af 100644 --- a/src/QsCompiler/CompilationManager/TypeChecking.cs +++ b/src/QsCompiler/CompilationManager/TypeChecking.cs @@ -1257,7 +1257,7 @@ QsSpecialization BuildSpecialization(QsSpecializationKind kind, ResolvedSignatur var context = ScopeContext.Create( compilation.GlobalSymbols, compilation.RuntimeCapabilities, - compilation.ExecutionTarget, + compilation.ProcessorArchitecture, spec); implementation = BuildUserDefinedImplementation( root, spec.SourceFile, arg, requiredFunctorSupport, context, diagnostics); diff --git a/src/QsCompiler/Compiler/CompilationLoader.cs b/src/QsCompiler/Compiler/CompilationLoader.cs index c25ee83926..099c14d9f6 100644 --- a/src/QsCompiler/Compiler/CompilationLoader.cs +++ b/src/QsCompiler/Compiler/CompilationLoader.cs @@ -447,14 +447,14 @@ public CompilationLoader(SourceLoader loadSources, ReferenceLoader loadReference RaiseCompilationTaskStart("OverallCompilation", "Build"); this.CompilationStatus.Validation = Status.Succeeded; var files = CompilationUnitManager.InitializeFileManagers(sourceFiles, null, this.OnCompilerException); // do *not* live track (i.e. use publishing) here! - var executionTarget = this.Config.AssemblyConstants?.GetValueOrDefault(ExecutionTarget); + var processorArchitecture = this.Config.AssemblyConstants?.GetValueOrDefault(AssemblyConstants.ProcessorArchitecture); var compilationManager = new CompilationUnitManager( this.OnCompilerException, capabilities: this.Config.RuntimeCapabilities, isExecutable: this.Config.IsExecutable, - executionTarget: NonNullable.New(string.IsNullOrWhiteSpace(executionTarget) + processorArchitecture: NonNullable.New(string.IsNullOrWhiteSpace(processorArchitecture) ? "Unspecified" - : executionTarget)); + : processorArchitecture)); compilationManager.UpdateReferencesAsync(references); compilationManager.AddOrUpdateSourceFilesAsync(files); this.VerifiedCompilation = compilationManager.Build(); diff --git a/src/QsCompiler/DataStructures/Diagnostics.fs b/src/QsCompiler/DataStructures/Diagnostics.fs index 49d67ef219..6e85f086be 100644 --- a/src/QsCompiler/DataStructures/Diagnostics.fs +++ b/src/QsCompiler/DataStructures/Diagnostics.fs @@ -544,12 +544,8 @@ type DiagnosticItem = | ErrorCode.ExpectingIterableExpr -> "The type {0} does not support iteration. Expecting an expression of array type or of type Range." | ErrorCode.ExpectingCallableExpr -> "The type of the expression must be a function or operation type. The given expression is of type {0}." | ErrorCode.UnknownIdentifier -> "No identifier with the name \"{0}\" exists." - | ErrorCode.UnsupportedResultComparison -> - // TODO: When the names of the runtime capabilities are finalized, they can be included in the error - // message. - "The execution target {0} does not support comparing measurement results. " + - "Choose an execution target with additional capabilities or avoid result comparisons." - + // TODO: When the names of the runtime capabilities are finalized, they can be included in the error message. + | ErrorCode.UnsupportedResultComparison -> "The target {0} does not support comparing measurement results." | ErrorCode.CallableRedefinition -> "Invalid callable declaration. A function or operation with the name \"{0}\" already exists." | ErrorCode.CallableOverlapWithTypeConstructor -> "Invalid callable declaration. A type constructor with the name \"{0}\" already exists." | ErrorCode.TypeRedefinition -> "Invalid type declaration. A type with the name \"{0}\" already exists." diff --git a/src/QsCompiler/DataStructures/ReservedKeywords.fs b/src/QsCompiler/DataStructures/ReservedKeywords.fs index 3e85d21445..408a9d6a8a 100644 --- a/src/QsCompiler/DataStructures/ReservedKeywords.fs +++ b/src/QsCompiler/DataStructures/ReservedKeywords.fs @@ -234,13 +234,14 @@ module GeneratedAttributes = module AssemblyConstants = let OutputPath = "OutputPath" let AssemblyName = "AssemblyName" - let QsharpOutputType = "ResolvedQsharpOutputType" + let QsharpOutputType = "QsharpOutputType" let QsharpExe = "QsharpExe" let QsharpLibrary = "QsharpLibrary" - let ExecutionTarget = "ResolvedExecutionTarget" + let ProcessorArchitecture = "ProcessorArchitecture" let HoneywellProcessor = "HoneywellProcessor" let IonQProcessor = "IonQProcessor" let QCIProcessor = "QCIProcessor" + let ExecutionTarget = "ExecutionTarget" let DefaultSimulator = "DefaultSimulator" let QuantumSimulator = "QuantumSimulator" let ToffoliSimulator = "ToffoliSimulator" diff --git a/src/QsCompiler/LanguageServer/EditorState.cs b/src/QsCompiler/LanguageServer/EditorState.cs index 7c8e5a1fb2..765ae83992 100644 --- a/src/QsCompiler/LanguageServer/EditorState.cs +++ b/src/QsCompiler/LanguageServer/EditorState.cs @@ -106,7 +106,7 @@ internal bool QsProjectLoader(Uri projectFile, out ProjectInformation info) var targetFile = projectInstance.GetPropertyValue("TargetFileName"); var outputPath = Path.Combine(projectInstance.Directory, outputDir, targetFile); - var executionTarget = projectInstance.GetPropertyValue("ResolvedQsharpExecutionTarget"); + var processorArchitecture = projectInstance.GetPropertyValue("ResolvedProcessorArchitecture"); var resRuntimeCapability = projectInstance.GetPropertyValue("ResolvedRuntimeCapabilities"); var runtimeCapabilities = Enum.TryParse(resRuntimeCapability, out AssemblyConstants.RuntimeCapabilities capability) ? capability @@ -132,7 +132,7 @@ internal bool QsProjectLoader(Uri projectFile, out ProjectInformation info) outputPath, runtimeCapabilities, isExecutable, - NonNullable.New(string.IsNullOrWhiteSpace(executionTarget) ? "Unspecified" : executionTarget), + NonNullable.New(string.IsNullOrWhiteSpace(processorArchitecture) ? "Unspecified" : processorArchitecture), loadTestNames, sourceFiles, projectReferences, diff --git a/src/QsCompiler/SyntaxProcessor/ExpressionVerification.fs b/src/QsCompiler/SyntaxProcessor/ExpressionVerification.fs index 4c62ae08f6..8b89e63e2e 100644 --- a/src/QsCompiler/SyntaxProcessor/ExpressionVerification.fs +++ b/src/QsCompiler/SyntaxProcessor/ExpressionVerification.fs @@ -253,7 +253,7 @@ let private VerifyEqualityComparison context addError (lhsType, lhsRange) (rhsTy let baseType = CommonBaseType addError argumentError context.Symbols.Parent (lhsType, lhsRange) (rhsType, rhsRange) match baseType.Resolution with | Result when context.Capabilities = RuntimeCapabilities.QPRGen0 -> - addError (ErrorCode.UnsupportedResultComparison, [context.ExecutionTarget.Value]) rhsRange + addError (ErrorCode.UnsupportedResultComparison, [context.ProcessorArchitecture.Value]) rhsRange | _ -> let unsupportedError = ErrorCode.InvalidTypeInEqualityComparison, [toString baseType] VerifyIsOneOf (fun t -> t.supportsEqualityComparison) unsupportedError addError (baseType, rhsRange) |> ignore diff --git a/src/QsCompiler/SyntaxProcessor/ScopeTools.fs b/src/QsCompiler/SyntaxProcessor/ScopeTools.fs index c838e10fa4..849252e9d7 100644 --- a/src/QsCompiler/SyntaxProcessor/ScopeTools.fs +++ b/src/QsCompiler/SyntaxProcessor/ScopeTools.fs @@ -290,8 +290,8 @@ type ScopeContext<'a> = ReturnType : ResolvedType /// The runtime capabilities for the compilation unit. Capabilities : RuntimeCapabilities - /// The name of the execution target for the compilation unit. - ExecutionTarget : NonNullable } + /// The name of the processor architecture for the compilation unit. + ProcessorArchitecture : NonNullable } with /// @@ -307,7 +307,7 @@ type ScopeContext<'a> = /// static member Create (nsManager : NamespaceManager) capabilities - executionTarget + processorArchitecture (spec : SpecializationDeclarationHeader) = match nsManager.TryGetCallable spec.Parent (spec.Parent.Namespace, spec.SourceFile) with | Found declaration -> @@ -315,5 +315,5 @@ type ScopeContext<'a> = IsInOperation = declaration.Kind = Operation ReturnType = StripPositionInfo.Apply declaration.Signature.ReturnType Capabilities = capabilities - ExecutionTarget = executionTarget } + ProcessorArchitecture = processorArchitecture } | _ -> raise <| ArgumentException "The specialization's parent callable does not exist." diff --git a/src/QuantumSdk/DefaultItems/DefaultItems.targets b/src/QuantumSdk/DefaultItems/DefaultItems.targets index a9e001f517..09d09a1468 100644 --- a/src/QuantumSdk/DefaultItems/DefaultItems.targets +++ b/src/QuantumSdk/DefaultItems/DefaultItems.targets @@ -28,31 +28,31 @@ Possible values are 'Exe', or 'Library'. - + - HoneywellProcessor - IonQProcessor - QCIProcessor - Unspecified - + HoneywellProcessor + IonQProcessor + QCIProcessor + Unspecified + Possible values must match 'ionq.*', 'honeywell.*', 'qci.*', or 'Any'. The execution target for a Q# library needs to be 'Any'. - OpenQASM - ExtendedQASM - OpenQASM - Default + OpenQASM + ExtendedQASM + OpenQASM + Default - QPRGen1 - QPRGen0 - QPRGen1 - Unknown + QPRGen1 + QPRGen0 + QPRGen1 + Unknown diff --git a/src/QuantumSdk/Sdk/Sdk.props b/src/QuantumSdk/Sdk/Sdk.props index faf7be0d8a..5b96ae2dd5 100644 --- a/src/QuantumSdk/Sdk/Sdk.props +++ b/src/QuantumSdk/Sdk/Sdk.props @@ -26,9 +26,9 @@ - - - + + + diff --git a/src/QuantumSdk/Sdk/Sdk.targets b/src/QuantumSdk/Sdk/Sdk.targets index 3ad2f317f0..436cd9a4ea 100644 --- a/src/QuantumSdk/Sdk/Sdk.targets +++ b/src/QuantumSdk/Sdk/Sdk.targets @@ -27,7 +27,7 @@ - + @@ -77,8 +77,9 @@ <_QscCommandRuntimeFlag>--runtime $(ResolvedRuntimeCapabilities) <_QscCommandTargetDecompositionsFlag Condition="@(ResolvedTargetSpecificDecompositions->Count()) > 0">--target-specific-decompositions "@(ResolvedTargetSpecificDecompositions,'" "')" <_QscCommandTestNamesFlag Condition="$(ExposeReferencesViaTestNames)">--load-test-names - <_QscCommandPredefinedAssemblyProperties>ResolvedExecutionTarget:$(ResolvedQsharpExecutionTarget) ResolvedQsharpOutputType:$(ResolvedQsharpOutputType) + <_QscCommandPredefinedAssemblyProperties>ProcessorArchitecture:$(ResolvedProcessorArchitecture) QsharpOutputType:$(ResolvedQsharpOutputType) <_QscCommandPredefinedAssemblyProperties Condition="$(DefaultSimulator) != ''">$(_QscCommandPredefinedAssemblyProperties) DefaultSimulator:$(DefaultSimulator) + <_QscCommandPredefinedAssemblyProperties Condition="$(ExecutionTarget) != ''">$(_QscCommandPredefinedAssemblyProperties) ExecutionTarget:$(ExecutionTarget) <_QscCommandAssemblyPropertiesFlag>--assembly-properties $(_QscCommandPredefinedAssemblyProperties) $(QscCommandAssemblyProperties) <_QscPackageLoadFallbackFoldersFlag Condition="@(ResolvedPackageLoadFallbackFolders->Count()) > 0">--package-load-fallback-folders "@(ResolvedPackageLoadFallbackFolders,'" "')" <_QscCommandArgs>--proj "$(PathCompatibleAssemblyName)" $(_QscCommandIsExecutableFlag) $(_QscCommandDocsFlag) $(_QscCommandInputFlag) $(_QscCommandOutputFlag) $(_QscCommandReferencesFlag) $(_QscCommandLoadFlag) $(_QscCommandRuntimeFlag) $(_QscCommandTargetDecompositionsFlag) $(_QscPackageLoadFallbackFoldersFlag) $(_QscCommandTestNamesFlag) $(_QscCommandAssemblyPropertiesFlag) $(AdditionalQscArguments)