-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Native OpenQASM 3 importer #11584
Merged
Merged
Native OpenQASM 3 importer #11584
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
809fff3
Begin work on new OpenQASM 3 importer
jakelishman cb36c30
Tidy up public interface construction
jakelishman 6cfcd81
Add load-from-file entry point
jakelishman 3fed881
Create public experimental interface
jakelishman 1994717
Credit John
jakelishman f84e86a
Fix lint
jakelishman 9c622cf
Bump version (git hash) of dependency on openqasm3_parser
jlapeyre 58cb87b
Add support for barrier
jakelishman 2ad7880
Handle measurement with new parser version
jakelishman 3cc0e3e
Fix Rust 1.75 code
jakelishman b6648c0
Depend on released version of oq3_seamntics
jlapeyre 66e7d60
Add tests of interface successes
jakelishman 787394f
Merge remote-tracking branch 'ibm/main' into qasm3/import
jakelishman 4e47a2c
Add dummy library to manifest
jakelishman 7ea2600
Depend on lastest version, 0.0.7, of openqasm3_parser crates
jlapeyre 0c517fe
Merge remote-tracking branch 'ibm/main' into qasm3/import
jakelishman acb84d5
Expand on readme
jakelishman 9f4e342
Centralise dependencies
jakelishman a2d2c4f
Fix typing and error typing
jakelishman eb474fa
Credit Matt
jakelishman 5b8398a
Fix clippy
jakelishman 3345c34
Clone using GIL
jakelishman 9bd6476
Format
jakelishman fcc79df
Improve error for unexpected angle
jakelishman 6712183
Add test of gate broadcasting
jakelishman 6e729bf
Add additional warnings about experimental interface
jakelishman c64c8c1
Add release note
jakelishman fd80ea1
Add comment about diagnostics in docs
jakelishman f37f279
Correct release series comment
jakelishman 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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 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 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,21 @@ | ||
[package] | ||
name = "qiskit-qasm3" | ||
version.workspace = true | ||
edition.workspace = true | ||
rust-version.workspace = true | ||
license.workspace = true | ||
|
||
[lib] | ||
name = "qiskit_qasm3" | ||
crate-type = ["cdylib"] | ||
|
||
[features] | ||
# This is a test-only shim removable feature. See the root `Cargo.toml`. | ||
default = ["extension-module"] | ||
extension-module = ["pyo3/extension-module"] | ||
|
||
[dependencies] | ||
pyo3.workspace = true | ||
indexmap.workspace = true | ||
hashbrown.workspace = true | ||
oq3_semantics = "0.0.7" | ||
This file contains 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,7 @@ | ||
# `qiskit._qasm3` | ||
|
||
This crate is the Rust-level Qiskit interface to [a separately managed OpenQASM 3 | ||
parser](https://github.com/Qiskit/openqasm3_parser). In order to maintain a sensible separation of | ||
concerns, and because we hope to expand the use of that parser outside Qiskit, the parsing side does | ||
not depend on Qiskit, and this crate interfaces with it in a Qiskit-specific manner to produce | ||
`QuantumCircuit`s. |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this pin the version at
0.0.7
? In principle we could make backward compatible bug fixes in 0.0.8. There are certainly some bugs that would affect this importer.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like we might want to release
0.1.0
of the parser in order to allow fixes:https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#specifying-dependencies-from-cratesio
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then
oq3_semantics = "0.1.0"
would be compatible with0.1.1
, etc.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this dependency is equivalent to
>=0.0.7,<0.0.8
. Cargo treats leading zeros specially - it basically treats the leftmost non-zero as the semantic-version "major". For how we're updating the base library at the moment, I think that's actually fairly accurate (and not a problem on either side).That said, this doesn't really affect anything, because we build our Rust crates into cdylib Python extensions that we treat give-or-take like fixed binary objects - one of those ways is that we pin our dependencies with the lockfile, so only precise lockfile updates affect the build environment, and (for the most part) are made separately to Rust code changes. In this case, large tracts of the lockfile are updated because there's so many new dependencies getting pulled in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In any case, I just released openqasm3_parser 0.1.0 ., This is the same as 0.0.7. Just changed the version (and reduced the sleep between publishing crates to 60 s) : https://crates.io/crates/oq3_semantics
I'm not sure I follow everything you said about versions. But if I understand correctly, a particular version of Qiskit includes a fixed version of every file, including the
Cargo.lock
files. And thesefix precise versions of Rust dependencies of Qiksit.