This repository was archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 90
Added DumpMachine() and DumpRegister(), some refactoring #634
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
5355a9d
Squashed all commits in the branch to minimize rebase/merge conflicts
kuzminrobin f95241f
Minor cleanup
kuzminrobin afddac3
Updated teh SDK version
kuzminrobin 24b9055
Fixing the build CI break
kuzminrobin 34040a7
Updated teh SDK package version
kuzminrobin 7e7f7f5
CR changes
kuzminrobin ddd9ccf
CR changes
kuzminrobin 9ee7089
Reverted the breaking changes.
kuzminrobin ecae556
Build break fix
kuzminrobin 3687527
CR changes
kuzminrobin c9777c9
Merge branch 'main' into kuzminrobin/dumpMachine4refact
kuzminrobin 05bf23c
Build break fix.
kuzminrobin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "msbuild-sdks": { | ||
| "Microsoft.Quantum.Sdk": "0.15.210324735-alpha" | ||
| "Microsoft.Quantum.Sdk": "0.15.210425594-alpha" | ||
| } | ||
| } |
2 changes: 1 addition & 1 deletion
2
src/Azure/Azure.Quantum.Client/Microsoft.Azure.Quantum.Client.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| # Ignore the generated qir files from Q# compiler | ||
| qir/ | ||
| **/qsharp/qir/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #include <ostream> // std::endl | ||
| #include "QirTypes.hpp" | ||
| #include "QirRuntime.hpp" // QIR_SHARED_API for quantum__rt__message. | ||
| #include "OutputStream.hpp" | ||
|
|
||
| // Public API: | ||
| extern "C" | ||
| { | ||
| void quantum__rt__message(QirString* qstr) // NOLINT | ||
| { | ||
| Microsoft::Quantum::OutputStream::Get() << qstr->str << std::endl; | ||
| } | ||
| } // extern "C" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| // https://stackoverflow.com/a/5419388/6362941 redirect std::cout to a string | ||
| // Discussion/history and some more info about the output redirection: | ||
| // https://github.com/microsoft/qsharp-runtime/pull/511#discussion_r574170031 | ||
| // https://github.com/microsoft/qsharp-runtime/pull/511#discussion_r574194191 | ||
|
|
||
| #include <iostream> | ||
| #include "QirRuntime.hpp" | ||
| #include "OutputStream.hpp" | ||
|
|
||
| namespace Microsoft // Replace with `namespace Microsoft::Quantum` after migration to C++17. | ||
| { | ||
| namespace Quantum | ||
| { | ||
| std::ostream* OutputStream::currentOutputStream = &std::cout; // Output to std::cout by default. | ||
|
|
||
| std::ostream& OutputStream::Get() | ||
| { | ||
| return *currentOutputStream; | ||
| } | ||
|
|
||
| std::ostream& OutputStream::Set(std::ostream& newOStream) | ||
| { | ||
| std::ostream& oldOStream = *currentOutputStream; | ||
| currentOutputStream = &newOStream; | ||
| return oldOStream; | ||
ScottCarda-MS marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| OutputStream::ScopedRedirector::ScopedRedirector(std::ostream& newOstream) | ||
| : old(OutputStream::Set(newOstream)) | ||
| {} | ||
|
|
||
| OutputStream::ScopedRedirector::~ScopedRedirector() | ||
| { | ||
| OutputStream::Set(old); | ||
| } | ||
|
|
||
| std::ostream& SetOutputStream(std::ostream & newOStream) | ||
| { | ||
| return OutputStream::Set(newOStream); | ||
| } | ||
|
|
||
| } // namespace Quantum | ||
| } // namespace Microsoft | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| #include <cstdint> | ||
| #include "QirTypes.hpp" | ||
|
|
||
| QirRange::QirRange() | ||
| : start(0) | ||
| , step(0) | ||
| , end(0) | ||
| { | ||
| } | ||
|
|
||
| QirRange::QirRange(int64_t st, int64_t sp, int64_t en) | ||
| : start(st) | ||
| , step(sp) | ||
| , end(en) | ||
| { | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # API Dependency | ||
|
|
||
| (Try to keep the readability balance between the web view and raw file, give the preference to the raw file) | ||
|
|
||
| The listed earlier ones provide the functionality to the listed later ones | ||
| (the listed later ones include and/or call the listed earlier ones, | ||
| the listed later ones cannot be compiled into an executable without the listed earlier ones). | ||
|
|
||
| Same-level entities are independent of each other (unless specified otherwise). Entities depend on the levels listed earlier only. | ||
|
|
||
|
|
||
| ## Level 0. External To This Directory | ||
|
|
||
| **public\CoreTypes.hpp** Defines `QIR_SHARED_API`, `QUBIT`, `Qubit`, `RESULT`, `Result`, `ResultValue`, `PauliId`. | ||
| Does not depend on anything of our code. | ||
|
|
||
| **public\QirTypes.hpp** Defines `QirArray`, `QirString`, `PTuple`, `QirTupleHeader`, `TupleWithControls`, `QirCallable`, `QirRange`. | ||
| Depends on the listed earlier ones. | ||
|
|
||
| **public\QirRuntime.hpp** Declares `quantum__rt__*()`. Depends on the listed earlier ones. | ||
|
|
||
|
|
||
| ## Level 1 | ||
kuzminrobin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| **allocationsTracker.hpp** Defines `Microsoft::Quantum::AllocationsTracker` that tracks the allocations and detects the mem leaks. | ||
| Does not depend on anything of our code. | ||
|
|
||
| **utils.cpp** Implements `quantum__rt__fail()`, `quantum__rt__memory_allocate()`, `quantum__rt__heap_{alloc,free}()`. | ||
| `quantum__rt__heap_alloc()` calls **strings.cpp**'s `quantum__rt__string_create()` - cyclical dependency. | ||
|
|
||
| **strings.cpp** Implements `QirString`, `quantum__rt__string_*()`, `quantum__rt__<type>_to_string()` (except `qubit_to_string` and `result_to_string`). | ||
| Depends on **utils.cpp**'s `quantum__rt__fail()` - cyclical dependency. | ||
|
|
||
|
|
||
| ## Level 2 | ||
|
|
||
| **allocationsTracker.cpp** Implements the internals of `Microsoft::Quantum::AllocationsTracker`. | ||
| Depends on `quantum__rt__fail()`, `quantum__rt__string_create()` | ||
|
|
||
| **context.cpp** Implements the internals of `Microsoft::Quantum::QirExecutionContext`, | ||
| Depends on **allocationsTracker.hpp**'s `Microsoft::Quantum::AllocationsTracker`. | ||
| Gets/returns `IRuntimeDriver *`. | ||
|
|
||
| ## Level 3 | ||
|
|
||
| **delegated.cpp** Implements `quantum__rt__result_*()`, `quantum__rt__qubit_{allocate,release,to_string}()`. | ||
| Each API depends on `Microsoft::Quantum::GlobalContext()[->GetDriver()]`, | ||
| `quantum__rt__qubit_to_string()` also depends on strings.cpp's `quantum__rt__string_create()`. | ||
| `quantum__rt__result_to_string()` also depends on strings.cpp's `quantum__rt__string_create()`. | ||
|
|
||
| **arrays.cpp** Implements {the internals of `QirArray`} and `quantum__rt__*array*`. | ||
| Depends on `Microsoft::Quantum::GlobalContext()`, `quantum__rt__fail()`, `quantum__rt__string_create()`, | ||
| **delegated.cpp**'s `quantum__rt__qubit_allocate()` | ||
|
|
||
| ## Level 4 | ||
|
|
||
| **callables.cpp** Defines the {internals of `QirTupleHeader`, `QirCallable`}, `quantum__rt__tuple_*()`, `quantum__rt__callable_*()` | ||
| Depends on `QirArray`, `Microsoft::Quantum::GlobalContext()`, `quantum__rt__fail()`, `quantum__rt__string_create()`, `TupleWithControls`, | ||
| Consider breaking up into **Tuples.cpp** and **Callables.cpp**. | ||
|
|
||
| ## Level 5 | ||
|
|
||
| **bridge-rt.ll** Defines the `@__quantum__rt__*` entry points (to be called by the `.ll` files generated from users' `.qs` files). | ||
| The C++ Standard reserves the identifiers starting with double underscores `__`, that is why the definitions of `@__quantum__rt__*` | ||
| have been put to `.ll` file rather than `.cpp` file. | ||
| Depends on `quantum__rt__*` implementations (in **utils.cpp**, **strings.cpp**, **delegated.cpp**, **arrays.cpp**, **callables.cpp**). | ||
kuzminrobin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.