Skip to content

Commit

Permalink
Clean up repo and dependencies (#194)
Browse files Browse the repository at this point in the history
* Clean up repo and dependencies

This PR makes several changes to clean-up/streamline the repository:

 - Moves package version, authos, edition, and license to the workspace level to make updates easier.
 - Moves all dependency version specification to the workspace to make tracking and updating dependencies easier.
 - Removes dependabot.yml in favor of manual updates, so syncing with ADO release builds crate availability is easier.
 - Downgrades clap to 4.5.7 for compatibility with ADO.
 - Removes the rust toolchain file and fixes clippy warnings for 1.78.
 - Pins to specific release of inkwell rather than using branch master for better predictability.

* Fix clippy 1.79 lints

* Move inkwell to workspace
  • Loading branch information
swernli authored Jul 2, 2024
1 parent edad2e6 commit 60e07ab
Show file tree
Hide file tree
Showing 14 changed files with 75 additions and 77 deletions.
7 changes: 0 additions & 7 deletions .github/dependabot.yml

This file was deleted.

6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,27 @@ members = [
]
resolver = "2"

[workspace.package]
authors = ["Microsoft"]
homepage = "https://github.com/qir-alliance/qir-runner"
repository = "https://github.com/qir-alliance/qir-runner"
edition = "2021"
license = "MIT"
version = "0.7.1"

[profile.release]
debug = 1

[workspace.dependencies]
pyo3 = "0.20"
bitvec = "1.0.0"
clap = { version = "4.5.7", features = [ "cargo" ] }
criterion = "0.5.1"
inkwell = { git = "https://github.com/TheDan64/inkwell", rev = "0.4.0", default-features = false, features = ["llvm14-0"] }
msvc_spectre_libs = { version = "0.1", features = [ "error" ] }
ndarray = "0.15.4"
num-bigint = { version = "0.4.6", default-features = false }
num-complex = "0.4"
num-traits = "0.2.19"
pyo3 = "0.20"
rand = "0.8.5"
rustc-hash = "1.1.0"
20 changes: 11 additions & 9 deletions backend/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
[package]
name = "qir-backend"
version = "0.7.1"
authors = ["Microsoft"]
edition = "2021"
license = "MIT"
version.workspace = true
authors.workspace = true
homepage.workspace = true
repository.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
qir-stdlib = { path = "../stdlib" }
quantum-sparse-sim = { path = "../sparsesim" }
rand = "0.8.5"
num-complex = "0.4"
num-bigint = { version = "0.4.6", default-features = false }
bitvec = "1.0.0"
rand = { workspace = true }
num-complex = { workspace = true }
num-bigint = { workspace = true }
bitvec = { workspace = true }

[dev-dependencies]
criterion = "0.5.1"
criterion = { workspace = true }

[[bench]]
name = "gates"
Expand Down
2 changes: 2 additions & 0 deletions backend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ macro_rules! multicontrolled_qubit_gate {
///
/// This function should only be called with arrays and tuples created by the QIR runtime library.
#[no_mangle]
#[allow(clippy::cast_ptr_alignment)]
pub unsafe extern "C" fn $qir_name(ctls: *const QirArray, qubit: *mut c_void) {
SIM_STATE.with(|sim_state| {
let state = &mut *sim_state.borrow_mut();
Expand Down Expand Up @@ -382,6 +383,7 @@ macro_rules! multicontrolled_qubit_rotation {
///
/// This function should only be called with arrays and tuples created by the QIR runtime library.
#[no_mangle]
#[allow(clippy::cast_ptr_alignment)]
pub unsafe extern "C" fn $qir_name(
ctls: *const QirArray,
arg_tuple: *mut *const Vec<u8>,
Expand Down
12 changes: 6 additions & 6 deletions pip/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
authors = ["Microsoft"]
name = "qirrunner"
version = "0.0.0"
edition = "2021"
license = "MIT"
description = "JIT compiles and executes programs written in QIR (Quantum Intermediate Representation)."
readme = "README.md"
homepage = "https://github.com/qir-alliance/qir-runner"
repository = "https://github.com/qir-alliance/qir-runner"
version.workspace = true
authors.workspace = true
homepage.workspace = true
repository.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
runner = { path = "../runner" }
Expand Down
20 changes: 9 additions & 11 deletions runner/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
[package]
name = "runner"
version = "0.7.1"
edition = "2021"
license = "MIT"

[dependencies.inkwell]
git = "https://github.com/TheDan64/inkwell"
branch = "master"
default-features = false
features = ["llvm14-0"]
version.workspace = true
authors.workspace = true
homepage.workspace = true
repository.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
qir-stdlib = { path = "../stdlib" }
qir-backend = { path = "../backend" }
clap = { version = "4.5.8", features = [ "cargo" ] }
msvc_spectre_libs = { version = "0.1", features = ["error"] }
clap = { workspace = true }
inkwell = { workspace = true }
msvc_spectre_libs = { workspace = true }

[[bin]]
name = "qir-runner"
Expand Down
3 changes: 0 additions & 3 deletions rust-toolchain.toml

This file was deleted.

22 changes: 12 additions & 10 deletions sparsesim/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
[package]
name = "quantum-sparse-sim"
version = "0.7.1"
authors = ["Microsoft"]
edition = "2021"
license = "MIT"
version.workspace = true
authors.workspace = true
homepage.workspace = true
repository.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
rand = "0.8.5"
rustc-hash = "1.1.0"
num-complex = "0.4"
num-traits = "0.2.19"
num-bigint = { version = "0.4.6", default-features = false }
ndarray = "0.15.4"
rand = { workspace = true }
rustc-hash = { workspace = true }
num-complex = { workspace = true }
num-traits = { workspace = true }
num-bigint = { workspace = true }
ndarray = { workspace = true }
14 changes: 8 additions & 6 deletions stdlib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
[package]
name = "qir-stdlib"
version = "0.7.1"
authors = ["Microsoft"]
edition = "2021"
license = "MIT"
links = "qir-stdlib"
version.workspace = true
authors.workspace = true
homepage.workspace = true
repository.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
num-bigint = { version = "0.4.6", default-features = false }
rand = "0.8.5"
num-bigint = { workspace = true }
rand = { workspace = true }

[lib]
crate-type = ["staticlib", "rlib"]
Expand Down
4 changes: 2 additions & 2 deletions stdlib/src/arrays.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the MIT License.

use crate::{strings::convert, update_counts};
use std::{mem::ManuallyDrop, rc::Rc, usize};
use std::{mem::ManuallyDrop, rc::Rc};

#[cfg(not(feature = "fail-support"))]
#[allow(improper_ctypes)]
Expand Down Expand Up @@ -43,7 +43,7 @@ pub unsafe extern "C" fn __quantum__rt__array_copy(
let copy = rc.as_ref().clone();
Rc::into_raw(Rc::new(copy))
} else {
Rc::into_raw(Rc::clone(&rc));
let _ = Rc::into_raw(Rc::clone(&rc));
arr
}
}
Expand Down
2 changes: 1 addition & 1 deletion stdlib/src/callables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub unsafe extern "C" fn __quantum__rt__callable_copy(
let copy = rc.as_ref().clone();
Rc::into_raw(Rc::new(copy))
} else {
Rc::into_raw(Rc::clone(&rc));
let _ = Rc::into_raw(Rc::clone(&rc));
callable
}
}
Expand Down
16 changes: 0 additions & 16 deletions stdlib/src/output_recording.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,6 @@ impl Read for OutputRecorder {
}
}

struct DefaultReaderWriter(Vec<u8>);
impl Write for DefaultReaderWriter {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
self.0.write(buf)
}
fn flush(&mut self) -> std::io::Result<()> {
self.0.flush()
}
}

impl Read for DefaultReaderWriter {
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
self.0.as_slice().read(buf)
}
}

impl Default for OutputRecorder {
fn default() -> Self {
OutputRecorder {
Expand Down
3 changes: 1 addition & 2 deletions stdlib/src/tuples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::update_counts;
use std::{
mem::{size_of, ManuallyDrop},
rc::Rc,
usize,
};

#[allow(clippy::cast_ptr_alignment)]
Expand Down Expand Up @@ -38,7 +37,7 @@ pub unsafe extern "C" fn __quantum__rt__tuple_copy(
*header = Rc::into_raw(Rc::new(copy));
header.wrapping_add(1)
} else {
Rc::into_raw(Rc::clone(&rc));
let _ = Rc::into_raw(Rc::clone(&rc));
raw_tup
}
}
Expand Down

0 comments on commit 60e07ab

Please sign in to comment.