Skip to content

Adding basic Rust CI infrastructure #1

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

Merged
merged 8 commits into from
Jan 31, 2023
Merged

Conversation

swernli
Copy link
Collaborator

@swernli swernli commented Jan 30, 2023

No description provided.

@swernli swernli marked this pull request as ready for review January 31, 2023 19:36
@swernli swernli changed the title WIP: Testing basic Rust infrastructure Adding basic Rust CI infrastructure Jan 31, 2023
@swernli swernli requested a review from bamarsha January 31, 2023 19:37
@swernli swernli merged commit 669fb07 into main Jan 31, 2023
@swernli swernli deleted the swernli/infrastructure branch January 31, 2023 19:54
github-merge-queue bot pushed a commit that referenced this pull request Oct 25, 2024
This PR adds the ability to declare custom measurements in Q#. Here is
an example:
```qsharp
@measurement()
operation __quantum__qis__mx__body(target : Qubit) : Result {
  body intrinsic;
}
```

The generated QIR will be,
```llvm-ir
declare void @__quantum__qis__mx__body(%Qubit*, %Result*) #1
```

# Design Notes

1. I choose the `@Measurement()` attribute over a new `measurement`
keyword to avoid putting extra syntax into the language.
2. A custom measurement must be a `body intrinsic` or a
`@SimulatableIntrinsic()`.
3. A measurement must only take `Qubits` as inputs and have `Results` as
outputs.

# Notes to reviewers

This PR consists of the following steps:
1. Adding a `@Measurement()` attribute to the language and piping it
down to FIR.
3. Make the generated QIR have the `#1` attribute indicating an
irreversible operation.
 4. Treating a measurement as a dynamic operation in RCA.
5. Handling custom measurements correctly during partial evaluation:
moving the output Results to result registers in the input.
 6. Handling undesired semantics as errors using an HIR pass.
 7. Adding the `@Measurement()` attribute to the completions list.
 8. Unit tests in codegen and in the HIR pass.
 
 # Next steps
 
After this PR is merged we can add the `@Measurement()` attribute to the
measurement operations in the standard library and remove the hard coded
logic we have for them in the compiler.

---------

Co-authored-by: Stefan J. Wernli <swernli@microsoft.com>
Co-authored-by: César Zaragoza Cortés <cesarzc@microsoft.com>
github-merge-queue bot pushed a commit that referenced this pull request Oct 29, 2024
This PR adds support for custom resets using the `@Reset` attribute. It
consists of the following changes:
 - Adding a `@Reset` attribute to the language.
 - Piping it down to FIR.
- Using the attribute to generate the correct QIR, including the
`"irreversible"` attribute.
- Semantic validation passes in `qsc_passes` based on the `@Reset`
attribute.
 - The right handling of reset operations during partial evaluation.
 - Unit tests.
- Update previous tests to include the `#1` irreversible attribute in
QIR when calling the Reset operation.

---------

Co-authored-by: Stefan J. Wernli <swernli@microsoft.com>
Co-authored-by: César Zaragoza Cortés <cesarzc@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants