Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptive spec wording tweaks #40

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions specification/under_development/profiles/Adaptive_Profile.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
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

Check warning on line 23 in specification/under_development/profiles/Adaptive_Profile.md

View workflow job for this annotation

GitHub Actions / Check spelling, linting and links

Trailing spaces [Expected: 0 or 2; Actual: 1]
conjoined to its state, such as via entanglement, should not have their state

Check warning on line 24 in specification/under_development/profiles/Adaptive_Profile.md

View workflow job for this annotation

GitHub Actions / Check spelling, linting and links

Trailing spaces [Expected: 0 or 2; Actual: 1]

Check warning on line 24 in specification/under_development/profiles/Adaptive_Profile.md

View workflow job for this annotation

GitHub Actions / Check spelling, linting and links

Line length [Expected: 80; Actual: 81]
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
Expand Down Expand Up @@ -556,7 +557,7 @@
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
Expand Down Expand Up @@ -653,12 +654,21 @@
| `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

Check warning on line 662 in specification/under_development/profiles/Adaptive_Profile.md

View workflow job for this annotation

GitHub Actions / Check spelling, linting and links

Line length [Expected: 80; Actual: 97]
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

Check warning on line 669 in specification/under_development/profiles/Adaptive_Profile.md

View workflow job for this annotation

GitHub Actions / Check spelling, linting and links

Trailing spaces [Expected: 0 or 2; Actual: 1]

Check warning on line 669 in specification/under_development/profiles/Adaptive_Profile.md

View workflow job for this annotation

GitHub Actions / Check spelling, linting and links

Line length [Expected: 80; Actual: 111]
Reference can provide more details.

If a backend chooses to support floating point computations, then the following
LLVM instructions must be supported:

Expand Down Expand Up @@ -720,7 +730,8 @@
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

Check warning on line 733 in specification/under_development/profiles/Adaptive_Profile.md

View workflow job for this annotation

GitHub Actions / Check spelling, linting and links

Trailing spaces [Expected: 0 or 2; Actual: 1]
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
Expand Down
Loading