From 66564b13360bcb1aef72505dbb4c3138d1200ae5 Mon Sep 17 00:00:00 2001 From: John Dumbell Date: Tue, 15 Oct 2024 12:02:14 +0100 Subject: [PATCH 1/4] Clarifying that measurements can affect other state If read literally it reads that no qubits can ever effect other state, which I doubt is true. --- specification/under_development/profiles/Adaptive_Profile.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/specification/under_development/profiles/Adaptive_Profile.md b/specification/under_development/profiles/Adaptive_Profile.md index f10da4a..5012e7e 100644 --- a/specification/under_development/profiles/Adaptive_Profile.md +++ b/specification/under_development/profiles/Adaptive_Profile.md @@ -20,8 +20,9 @@ must support the following [mandatory capabilities](#mandatory-capabilities): 1. It can execute a sequence of quantum instructions that transform the quantum state. 2. A backend must support applying a measurement operation at any point in the - execution of the program. Qubits not undergoing the measurement should not - have their state affected. + execution of the program. Qubits not undergoing the measurement and are not + conjoined to its state, such as via entanglement, should not have their state + affected. 3. A backend must be able to apply quantum instructions conditionally on a measurement outcome. Specifically, forward branching using the LLVM branch instruction `br` must be supported, along with the necessary runtime function From 3e644843c6843b1a9ac94851078b391b9e4db22b Mon Sep 17 00:00:00 2001 From: John Dumbell Date: Tue, 15 Oct 2024 12:02:26 +0100 Subject: [PATCH 2/4] Fixing typo --- specification/under_development/profiles/Adaptive_Profile.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specification/under_development/profiles/Adaptive_Profile.md b/specification/under_development/profiles/Adaptive_Profile.md index 5012e7e..d54a23e 100644 --- a/specification/under_development/profiles/Adaptive_Profile.md +++ b/specification/under_development/profiles/Adaptive_Profile.md @@ -557,7 +557,7 @@ LLVM standard. The entry point is identified by a custom function attribute; as mentioned in the section on [attributes](#attributes), this is the same set of attributes as in the base profile. -An entry point function may not take any parameters and must must return an +An entry point function may not take any parameters and must return an exit code in the form of a 64-bit integer. The exit code `0` must be used to indicate a successful execution of the quantum program. Any other value of the exit code indicates a failure during execution. The program IR must use exit From 37e0bd1a655fe56fc6376d50364c17084d728a71 Mon Sep 17 00:00:00 2001 From: John Dumbell Date: Tue, 15 Oct 2024 12:03:02 +0100 Subject: [PATCH 3/4] Moving phi node definition into their own block and clarifying While previously accurate to what LLVM says, that definition dosen't actually tell you what they do. --- .../under_development/profiles/Adaptive_Profile.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/specification/under_development/profiles/Adaptive_Profile.md b/specification/under_development/profiles/Adaptive_Profile.md index d54a23e..8e48849 100644 --- a/specification/under_development/profiles/Adaptive_Profile.md +++ b/specification/under_development/profiles/Adaptive_Profile.md @@ -654,12 +654,21 @@ instructions must be supported: | `sext .. to` | Extends an integer value to create an integer of greater bitwidth by filling the added bits with the sign bit of the integer. | May be used at any point in the program if classical computations on both the input and the output type are supported. May only be used as part of a call to an output recording function if computations on the output type are not supported. | | `trunc .. to` | Truncates the highest order bits of an integer to create an integer of smaller bitwidth. | Behavior if the truncation changes the value of the integer is undefined, no support for `nuw` and/or `nsw`. May be used at any point in the program if classical computations on both the input and the output type are supported. May only be used as part of a call to an output recording function if computations on the output type are not supported. | | `select` | Evaluates to one of two integer values depending on a boolean condition. | | -| `phi` | Implement the φ node in the SSA graph representing the function. | Must be at the start of a basic block, or preceded by other `phi` instructions. | For more information about any of these instructions, we refer to the corresponding section in the [LLVM Language Reference](https://llvm.org/docs/LangRef.html). +If a backend chooses to support looping, iterations or backward branching then the following LLVM +instructions must be supported: + +| LLVM Instruction | Context and Purpose | Note | +|:-----------------|:------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------| +| `phi` | Assigns a local variables' data depending upon which branch caused entry to the basic block. | Must be at the start of a basic block, or preceded by other `phi` instructions. | + +If unfamiliar with phi nodes, [this entry](https://llvm.org/docs/LangRef.html#phi-instruction) in the Language +Reference can provide more details. + If a backend chooses to support floating point computations, then the following LLVM instructions must be supported: From e76c118649bfa44d579b6b5cf2108153e23afae5 Mon Sep 17 00:00:00 2001 From: John Dumbell Date: Tue, 15 Oct 2024 12:03:17 +0100 Subject: [PATCH 4/4] Expanding on phi/return statements --- specification/under_development/profiles/Adaptive_Profile.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specification/under_development/profiles/Adaptive_Profile.md b/specification/under_development/profiles/Adaptive_Profile.md index 8e48849..6512371 100644 --- a/specification/under_development/profiles/Adaptive_Profile.md +++ b/specification/under_development/profiles/Adaptive_Profile.md @@ -730,7 +730,8 @@ statement in the entry point function. Unless the backend supports multiple return points (**Bullet 9**), there is a single block that contains all calls to output recording functions followed by the final return statements. Multiple return statements in the application code can be replaced with suitable `phi` -nodes by the compiler to propagate the data into that block. +nodes by the compiler to propagate the data into that block if all computation +is contained within a single function. For all output recording functions, the `i8*` argument must be a non-null pointer to a global constant that contains a null-terminated string. A backend