diff --git a/.gitignore b/.gitignore index 026b26f36..2261ac142 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ target # These are backup files generated by rustfmt **/*.rs.bk + +.vscode/* \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index be85d1507..454b9cf63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,6 +23,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "anes" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" + [[package]] name = "atty" version = "0.2.14" @@ -126,6 +132,12 @@ dependencies = [ "capnp", ] +[[package]] +name = "cast" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" + [[package]] name = "cc" version = "1.0.73" @@ -147,6 +159,33 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "ciborium" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c137568cc60b904a7724001b35ce2630fd00d5d84805fbb608ab89509d788f" +dependencies = [ + "ciborium-io", + "ciborium-ll", + "serde", +] + +[[package]] +name = "ciborium-io" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "346de753af073cc87b52b2083a506b38ac176a44cfb05497b622e27be899b369" + +[[package]] +name = "ciborium-ll" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213030a2b5a4e0c0892b6652260cf6ccac84827b83a85a534e178e3906c4cf1b" +dependencies = [ + "ciborium-io", + "half", +] + [[package]] name = "clang-sys" version = "1.3.3" @@ -189,6 +228,7 @@ dependencies = [ "bitflags", "byteorder", "coaster-nn", + "criterion", "enum_primitive", "lazy_static", "libc", @@ -204,7 +244,9 @@ name = "coaster-blas" version = "0.4.0" dependencies = [ "coaster", + "criterion", "log", + "rand", "rcublas", "rust-blas", ] @@ -214,10 +256,12 @@ name = "coaster-nn" version = "0.5.0" dependencies = [ "coaster", + "criterion", "env_logger", "libc", "log", "num", + "paste", "rand", "rand_chacha", "rcudnn", @@ -255,6 +299,42 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "criterion" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c76e09c1aae2bc52b3d2f29e13c6572553b30c4aa1b8a49fd70de6412654cb" +dependencies = [ + "anes", + "atty", + "cast", + "ciborium", + "clap", + "criterion-plot", + "itertools", + "lazy_static", + "num-traits 0.2.15", + "oorandom", + "plotters", + "rayon", + "regex", + "serde", + "serde_derive", + "serde_json", + "tinytemplate", + "walkdir", +] + +[[package]] +name = "criterion-plot" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b50826342786a51a89e2da3a28f1c32b06e387201bc2d19791f622c673706b1" +dependencies = [ + "cast", + "itertools", +] + [[package]] name = "crossbeam-channel" version = "0.5.6" @@ -621,6 +701,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "half" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" + [[package]] name = "hashbrown" version = "0.12.3" @@ -782,6 +868,15 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "0.4.8" @@ -821,6 +916,7 @@ dependencies = [ "coaster", "coaster-blas", "coaster-nn", + "criterion", "env_logger", "log", "num", @@ -1103,6 +1199,12 @@ version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" +[[package]] +name = "oorandom" +version = "11.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" + [[package]] name = "openssl" version = "0.10.41" @@ -1154,6 +1256,12 @@ version = "6.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff" +[[package]] +name = "paste" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" + [[package]] name = "peeking_take_while" version = "0.1.2" @@ -1184,6 +1292,34 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +[[package]] +name = "plotters" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b639e642295546c50fcd545198c9d64ee2a38620a628724a3b266d5fbf97" +dependencies = [ + "num-traits 0.2.15", + "plotters-backend", + "plotters-svg", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "plotters-backend" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "193228616381fecdc1224c62e96946dfbc73ff4384fba576e052ff8c1bea8142" + +[[package]] +name = "plotters-svg" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9a81d2759aae1dae668f783c308bc5c8ebd191ff4184aaa1b37f65a6ae5a56f" +dependencies = [ + "plotters-backend", +] + [[package]] name = "png" version = "0.16.8" @@ -1471,6 +1607,15 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "schannel" version = "0.1.20" @@ -1697,6 +1842,16 @@ dependencies = [ "time", ] +[[package]] +name = "tinytemplate" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -1864,6 +2019,17 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + [[package]] name = "want" version = "0.3.0" diff --git a/Cargo.toml b/Cargo.toml index 4f5255f13..14fadef34 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,21 @@ [workspace] members = [ - "greenglas", "coaster", "coaster-nn", "coaster-blas", "juice", "rust-blas", - "rcudnn/cudnn", "rcudnn/cudnn-sys", "rcublas/cublas", "rcublas/cublas-sys", - "juice-examples/juice-utils", "juice-examples/mackey-glass-rnn-regression", - "juice-examples/mnist-image-multiclass-classification"] + "greenglas", + "coaster", + "coaster-nn", + "coaster-blas", + "juice", + "rust-blas", + "rcudnn/cudnn", + "rcudnn/cudnn-sys", + "rcublas/cublas", + "rcublas/cublas-sys", + "juice-examples/juice-utils", + "juice-examples/mackey-glass-rnn-regression", + "juice-examples/mnist-image-multiclass-classification", +] -exclude = [ "./rcudnn", "./rcublas", "./juice-examples"] +exclude = ["./rcudnn", "./rcublas", "./juice-examples"] [patch.crates-io] coaster-nn = { path = "./coaster-nn" } diff --git a/coaster-blas/Cargo.toml b/coaster-blas/Cargo.toml index 3d5f910aa..4d3397226 100644 --- a/coaster-blas/Cargo.toml +++ b/coaster-blas/Cargo.toml @@ -3,11 +3,11 @@ name = "coaster-blas" description = "Coaster library for full BLAS support" version = "0.4.0" authors = [ - "Bernhard Schuster ", - "Lissa Hyacinth ", - "Paul Kassianik ", - "Michael Hirn", - "Maximilian Goisser", + "Bernhard Schuster ", + "Lissa Hyacinth ", + "Paul Kassianik ", + "Michael Hirn", + "Maximilian Goisser", ] repository = "https://github.com/spearow/coaster-blas" homepage = "https://spearow.io/projects/coaster-blas" @@ -25,6 +25,10 @@ rust-blas = { version = "0.2", path = "../rust-blas", optional = true } # cuda rcublas = { version = "0.6", path = "../rcublas/cublas", optional = true } +[dev-dependencies] +rand = "0.8" +criterion = "0.4" + [features] default = ["native", "cuda"] native = ["coaster/native", "rust-blas"] diff --git a/coaster-blas/benches/rblas_overhead.rs b/coaster-blas/benches/rblas_overhead.rs index 55494042f..ee272c51e 100644 --- a/coaster-blas/benches/rblas_overhead.rs +++ b/coaster-blas/benches/rblas_overhead.rs @@ -1,12 +1,10 @@ -#![feature(test)] - use coaster as co; use coaster_blas as co_blas; use rust_blas as rblas; use co::prelude::*; use co_blas::plugin::*; -use test::Bencher; +use criterion::{criterion_group, criterion_main, Criterion}; use rand::distributions::Standard; use rand::{thread_rng, Rng}; @@ -15,19 +13,20 @@ fn backend() -> Backend { Backend::::default().unwrap() } -fn bench_dot_rblas(b: &mut Bencher, n: usize) { - let rng = thread_rng(); +fn bench_dot_rblas(b: &mut Criterion, n: usize) { + let rng = &mut thread_rng(); let slice_a: Vec = rng.sample_iter(Standard).take(n).collect(); let slice_b: Vec = rng.sample_iter(Standard).take(n).collect(); - - b.iter(|| { - let res = rblas::Dot::dot(slice_a.as_slice(), slice_b.as_slice()); - test::black_box(res); + b.bench_function("bench dot rblas", |b| { + b.iter(|| { + let res = rblas::Dot::dot(slice_a.as_slice(), slice_b.as_slice()); + ::criterion::black_box(res); + }) }); } -fn bench_dot_coaster(b: &mut Bencher, n: usize) { - let rng = thread_rng(); +fn bench_dot_coaster(b: &mut Criterion, n: usize) { + let rng = &mut thread_rng(); let slice_a: Vec = rng.sample_iter(Standard).take(n).collect(); let slice_b: Vec = rng.sample_iter(Standard).take(n).collect(); @@ -46,56 +45,63 @@ fn bench_dot_coaster(b: &mut Bencher, n: usize) { .as_mut_slice() .clone_from_slice(slice_b.as_slice()); let _ = backend.dot(shared_a, shared_b, shared_res); - - b.iter(|| backend.dot(shared_a, shared_b, shared_res).unwrap()); + b.bench_function("bench dot coaster", |b| { + b.iter(|| backend.dot(shared_a, shared_b, shared_res).unwrap()) + }); } -#[bench] -fn bench_dot_100_rblas(b: &mut Bencher) { +fn bench_dot_100_rblas(b: &mut Criterion) { bench_dot_rblas(b, 100); } -#[bench] -fn bench_dot_100_coaster(b: &mut Bencher) { +fn bench_dot_100_coaster(b: &mut Criterion) { bench_dot_coaster(b, 100); } -#[bench] -fn bench_dot_1000_rblas(b: &mut Bencher) { +fn bench_dot_1000_rblas(b: &mut Criterion) { bench_dot_rblas(b, 1000); } -#[bench] -fn bench_dot_1000_coaster(b: &mut Bencher) { +fn bench_dot_1000_coaster(b: &mut Criterion) { bench_dot_coaster(b, 1000); } -#[bench] -fn bench_dot_2000_rblas(b: &mut Bencher) { +fn bench_dot_2000_rblas(b: &mut Criterion) { bench_dot_rblas(b, 2000); } -#[bench] -fn bench_dot_2000_coaster(b: &mut Bencher) { +fn bench_dot_2000_coaster(b: &mut Criterion) { bench_dot_coaster(b, 2000); } -#[bench] -fn bench_dot_10000_rblas(b: &mut Bencher) { +fn bench_dot_10000_rblas(b: &mut Criterion) { bench_dot_rblas(b, 10000); } -#[bench] -fn bench_dot_10000_coaster(b: &mut Bencher) { +fn bench_dot_10000_coaster(b: &mut Criterion) { bench_dot_coaster(b, 10000); } -#[bench] -fn bench_dot_20000_rblas(b: &mut Bencher) { +fn bench_dot_20000_rblas(b: &mut Criterion) { bench_dot_rblas(b, 20000); } -#[bench] -fn bench_dot_20000_coaster(b: &mut Bencher) { +fn bench_dot_20000_coaster(b: &mut Criterion) { bench_dot_coaster(b, 20000); } + +criterion_group!( + coaster_nn, + bench_dot_100_rblas, + bench_dot_100_coaster, + bench_dot_1000_rblas, + bench_dot_1000_coaster, + bench_dot_2000_rblas, + bench_dot_2000_coaster, + bench_dot_10000_rblas, + bench_dot_10000_coaster, + bench_dot_20000_rblas, + bench_dot_20000_coaster, +); + +criterion_main!(coaster_nn); diff --git a/coaster-blas/src/lib.rs b/coaster-blas/src/lib.rs index 93a548124..a65a790f4 100644 --- a/coaster-blas/src/lib.rs +++ b/coaster-blas/src/lib.rs @@ -42,7 +42,7 @@ //! [blas-source]: https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms #![allow(dead_code)] #![deny( - unused_crate_dependencies, + // unused_crate_dependencies, clippy::missing_docs, clippy::missing_debug_implementations, clippy::missing_copy_implementations, diff --git a/coaster-nn/Cargo.toml b/coaster-nn/Cargo.toml index 8152a5677..2d7b54171 100644 --- a/coaster-nn/Cargo.toml +++ b/coaster-nn/Cargo.toml @@ -3,10 +3,10 @@ name = "coaster-nn" description = "coaster plugin providing Neural Network operations" version = "0.5.0" authors = [ - "Bernhard Schuster ", - "Lissa Hyacinth ", - "Michael Hirn", - "Maximilian Goisser", + "Bernhard Schuster ", + "Lissa Hyacinth ", + "Michael Hirn", + "Maximilian Goisser", ] repository = "https://github.com/spearow/coaster-nn" homepage = "https://spearow.io/coaster-nn" @@ -17,8 +17,8 @@ license = "MIT OR Apache-2.0" edition = "2018" [dependencies] -coaster = { path = "../coaster", version = "0.2", default-features = false } -rcudnn = { path = "../rcudnn/cudnn", version = "1.7", optional = true } +coaster = { path = "../coaster", version = "0.2", default-features = false } +rcudnn = { path = "../rcudnn/cudnn", version = "1.7", optional = true } libc = { version = "0.2", optional = true } log = "0.4" rand = { version = "0.8", optional = true } @@ -28,6 +28,8 @@ thiserror = { version = "1.0", optional = true } [dev-dependencies] env_logger = "0.9" num = "0.4" +criterion = "0.4" +paste = "1" [features] default = ["native", "cuda"] diff --git a/coaster-nn/src/frameworks/native/helper.rs b/coaster-nn/src/frameworks/native/helper.rs index 28a4ed20f..3997f2794 100644 --- a/coaster-nn/src/frameworks/native/helper.rs +++ b/coaster-nn/src/frameworks/native/helper.rs @@ -20,7 +20,7 @@ pub struct PoolingConfig { pub stride: Vec, } -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Clone, Copy, PartialEq)] #[allow(missing_docs)] pub struct DropoutConfig { pub probability: f32, diff --git a/coaster-nn/src/plugin.rs b/coaster-nn/src/plugin.rs index 9c9c6ecc5..484c58bec 100644 --- a/coaster-nn/src/plugin.rs +++ b/coaster-nn/src/plugin.rs @@ -2,7 +2,7 @@ use crate::co::tensor::SharedTensor; use std::fmt::Formatter; -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] /// Different algorithms to compute the convolution forward algorithm. pub enum ConvForwardAlgo { /// Attempt to automatically find the best algorithm of all the other available ones. @@ -45,7 +45,7 @@ impl ConvForwardAlgo { } } -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] /// Different algorithms to compute the gradient with respect to the filter. pub enum ConvBackwardFilterAlgo { /// Attempt to automatically find the best algorithm of all the other available ones. @@ -86,7 +86,7 @@ impl ConvBackwardFilterAlgo { } } -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] /// Different algorithms to compute the gradient with respect to the filter. pub enum ConvBackwardDataAlgo { /// Attempt to automatically find the best algorithm of all the other available ones. @@ -375,7 +375,7 @@ pub trait Rnn: NN { ) -> Result<(), crate::co::error::Error>; } -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] /// Network Type for RNN Networks [cudnnRNNMOde_t][1] /// [1]: https://docs.nvidia.com/deeplearning/sdk/cudnn-api/index.html#cudnnRNNMode_t pub enum RnnNetworkMode { @@ -414,7 +414,7 @@ impl RnnNetworkMode { } } -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] /// Input Modes for RNN [cudnnRNNInputMode_t][1] /// [1]: https://docs.nvidia.com/deeplearning/sdk/cudnn-api/index.html#cudnnRNNInputMode_t pub enum RnnInputMode { @@ -448,7 +448,7 @@ impl RnnInputMode { } } -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] /// Direction Mode for RNN [cudnnDirectionMode_t][1] /// [1]: https://docs.nvidia.com/deeplearning/sdk/cudnn-api/index.html#cudnnDirectionMode_t pub enum DirectionMode { @@ -479,7 +479,7 @@ impl DirectionMode { } } -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] /// Algorithm for RNN [cudnnRNNAlgo_t][1] /// [1]: https://docs.nvidia.com/deeplearning/sdk/cudnn-api/index.html#cudnnRNNAlgo_t /// diff --git a/coaster-nn/src/tests/activation.rs b/coaster-nn/src/tests/activation.rs index 65e226bb1..09457fe5c 100644 --- a/coaster-nn/src/tests/activation.rs +++ b/coaster-nn/src/tests/activation.rs @@ -7,8 +7,8 @@ use std::fmt; use crate::co::plugin::numeric_helpers::Float; use crate::co::prelude::*; +use super::{filled_tensor, tensor_assert_eq, Epsilon}; use crate::plugin::{Relu, ReluPointwise, Sigmoid, SigmoidPointwise, Tanh, TanhPointwise}; -use crate::tests::{filled_tensor, tensor_assert_eq, Epsilon}; const DIMS: [usize; 4] = [3, 1, 2, 2]; diff --git a/coaster-nn/src/tests/bench_all.rs b/coaster-nn/src/tests/bench_all.rs index 6f9c8da27..5843e726d 100644 --- a/coaster-nn/src/tests/bench_all.rs +++ b/coaster-nn/src/tests/bench_all.rs @@ -1,164 +1,187 @@ -#![cfg(feature = "unstable")] -extern crate test; +#![allow(unused_crate_dependencies, dead_code, warnings)] -macro_rules! bench_activation { - ($backend_getter:ident, $t:ident, $f:ident, $f_grad:ident, - $bench_name:ident, $bench_grad_name:ident, $n:expr) => { - #[bench] - pub fn $bench_name(b: &mut Bencher) { - let backend = ::tests::$backend_getter(); +use paste::paste; + +use std::mem::transmute; + +use crate::co::SharedTensor; +use crate::plugin::*; +use crate::tests::*; +use crate::*; +use criterion::Criterion; +use rand::distributions::OpenClosed01; + +macro_rules! bench_pooling { + ($b:ident, $t:ident, $f:ident, $n:literal) => { + paste! { + fn [< $f _ $n _ $b:lower _ $t:lower>](_: &mut Criterion) { + println!("TODO FIXME"); + } + + fn [< $f _grad_ $n _ $b:lower _ $t:lower>](_: &mut Criterion) { - let x = ::tests::uniformly_random_tensor(&[$n], -2.0, 2.0); + println!("TODO FIXME"); + }} + }; +} + +macro_rules! bench_activation { + ($b:ident, $t:ident, $f:ident, $n:literal) => { + paste! { + pub fn [< $f _ $n _ $b:lower _ $t:lower>] (criterion: &mut ::criterion::Criterion) { + let backend = Backend::<$b>::default().unwrap(); + let x = uniformly_random_tensor(&backend, &[$n], -2.0, 2.0); let mut r = SharedTensor::<$t>::new(&[$n]); for _ in 0..3 { // warmup - backend.$f(&x, &mut r).unwrap(); + backend. $f (&x, &mut r).unwrap(); backend.synchronize().unwrap(); } - b.iter(|| { - backend.$f(&x, &mut r).unwrap(); - backend.synchronize().unwrap(); + criterion.bench_function(stringify!($f), |b| { + b.iter(|| { + backend. $f (&x, &mut r).unwrap(); + backend.synchronize().unwrap(); + }) }); } - #[bench] - pub fn $bench_grad_name(b: &mut Bencher) { - let backend = ::tests::$backend_getter(); + pub fn [< $f _grad_ $n _ $b:lower _ $t:lower>] (criterion: &mut ::criterion::Criterion) { + let backend = Backend::<$b>::default().unwrap(); let mut x = SharedTensor::<$t>::new(&[$n]); - let dx = ::tests::uniformly_random_tensor(&[$n], -2.0, 2.0); - let r = ::tests::uniformly_random_tensor(&[$n], -2.0, 2.0); + let dx = uniformly_random_tensor(&backend, &[$n], -2.0, 2.0); + let r = uniformly_random_tensor(&backend, &[$n], -2.0, 2.0); let mut dr = SharedTensor::<$t>::new(&[$n]); - backend.$f(&r, &mut x).unwrap(); + backend. $f (&r, &mut x).unwrap(); for _ in 0..3 { // warmup - backend.$f_grad(&x, &dx, &r, &mut dr).unwrap(); + backend.[<$f _grad>] (&x, &dx, &r, &mut dr).unwrap(); backend.synchronize().unwrap(); } - b.iter(|| { - backend.$f_grad(&x, &dx, &r, &mut dr).unwrap(); - backend.synchronize().unwrap(); + criterion.bench_function(stringify!($f_grad), |b| { + b.iter(|| { + backend.[< $f _grad >] (&x, &dx, &r, &mut dr).unwrap(); + backend.synchronize().unwrap(); + }) }); - } + }} }; } // softmax differs from activations only in arg count for grad function... macro_rules! bench_softmax { - ($backend_getter:ident, $t:ident, $f:ident, $f_grad:ident, - $bench_name:ident, $bench_grad_name:ident, $n:expr) => { - #[bench] - pub fn $bench_name(b: &mut Bencher) { - let backend = ::tests::$backend_getter(); + ($b:ident, $t:ident, $f:ident, + $n:literal) => { + use super::*; + use crate::plugin::*; + + paste!{ + pub fn [< $f _ $n _ $b:lower _ $t:lower>](criterion: &mut ::criterion::Criterion) { + let backend = Backend::<$b>::default().unwrap(); - let x = ::tests::uniformly_random_tensor(&[$n], -2.0, 2.0); + let x = uniformly_random_tensor(&backend, &[$n], -2.0, 2.0); let mut r = SharedTensor::<$t>::new(&[$n]); for _ in 0..3 { // warmup - backend.$f(&x, &mut r).unwrap(); + backend. $f (&x, &mut r).unwrap(); backend.synchronize().unwrap(); } - b.iter(|| { - backend.$f(&x, &mut r).unwrap(); - backend.synchronize().unwrap(); + criterion.bench_function(stringify!($bench_name), |b| { + b.iter(|| { + backend.$f(&x, &mut r).unwrap(); + backend.synchronize().unwrap(); + }) }); } - #[bench] - pub fn $bench_grad_name(b: &mut Bencher) { - let backend = ::tests::$backend_getter(); + pub fn [< $f _grad_ $n _ $b:lower _ $t:lower>] (criterion: &mut ::criterion::Criterion) { + let backend = Backend::<$b>::default().unwrap(); let mut x = SharedTensor::<$t>::new(&[$n]); - let dx = ::tests::uniformly_random_tensor(&[$n], -2.0, 2.0); - let r = ::tests::uniformly_random_tensor(&[$n], -2.0, 2.0); + let dx = uniformly_random_tensor(&backend, &[$n], -2.0, 2.0); + let r = uniformly_random_tensor(&backend, &[$n], -2.0, 2.0); let mut dr = SharedTensor::<$t>::new(&[$n]); - backend.$f(&r, &mut x).unwrap(); + backend. $f (&r, &mut x).unwrap(); for _ in 0..3 { // warmup - backend.$f_grad(&x, &dx, &mut dr).unwrap(); + backend. [<$f _grad>] (&x, &dx, &mut dr).unwrap(); backend.synchronize().unwrap(); } - b.iter(|| { - backend.$f_grad(&x, &dx, &mut dr).unwrap(); - backend.synchronize().unwrap(); + criterion.bench_function(stringify!([< $f _grad _ $n _ $b:lower _ $t:lower >]), |b| { + b.iter(|| { + backend. [<$f _grad>] (&x, &dx, &mut dr).unwrap(); + backend.synchronize().unwrap(); + }) }); } + } }; } -macro_rules! define_benches { ($b:ident, $t:ident) => { - use super::test::Bencher; - use co::prelude::*; - use plugin::{Relu, Sigmoid, Tanh, Softmax, LogSoftmax}; - - bench_activation!($b, $t, relu, relu_grad, relu_100, relu_grad_100, 100); - bench_activation!($b, $t, relu, relu_grad, relu_1k, relu_grad_1k, 1000); - bench_activation!($b, $t, relu, relu_grad, relu_10k, relu_grad_10k, 10_000); - bench_activation!($b, $t, relu, relu_grad, relu_100k, relu_grad_100k, 100_000); - bench_activation!($b, $t, relu, relu_grad, relu_1m, relu_grad_1m, 1000_000); - bench_activation!($b, $t, relu, relu_grad, relu_10m, relu_grad_10m, 10_000_000); - - bench_activation!($b, $t, sigmoid, sigmoid_grad, sigmoid_100, sigmoid_grad_100, 100); - bench_activation!($b, $t, sigmoid, sigmoid_grad, sigmoid_1k, sigmoid_grad_1k, 1000); - bench_activation!($b, $t, sigmoid, sigmoid_grad, sigmoid_10k, sigmoid_grad_10k, 10_000); - bench_activation!($b, $t, sigmoid, sigmoid_grad, sigmoid_100k, sigmoid_grad_100k, 100_000); - bench_activation!($b, $t, sigmoid, sigmoid_grad, sigmoid_1m, sigmoid_grad_1m, 1000_000); - bench_activation!($b, $t, sigmoid, sigmoid_grad, sigmoid_10m, sigmoid_grad_10m, 10_000_000); - - bench_activation!($b, $t, tanh, tanh_grad, tanh_100, tanh_grad_100, 100); - bench_activation!($b, $t, tanh, tanh_grad, tanh_1k, tanh_grad_1k, 1000); - bench_activation!($b, $t, tanh, tanh_grad, tanh_10k, tanh_grad_10k, 10_000); - bench_activation!($b, $t, tanh, tanh_grad, tanh_100k, tanh_grad_100k, 100_000); - bench_activation!($b, $t, tanh, tanh_grad, tanh_1m, tanh_grad_1m, 1000_000); - bench_activation!($b, $t, tanh, tanh_grad, tanh_10m, tanh_grad_10m, 10_000_000); - - bench_softmax!($b, $t, softmax, softmax_grad, softmax_10, softmax_grad_10, 10); - bench_softmax!($b, $t, softmax, softmax_grad, softmax_100, softmax_grad_100, 100); - bench_softmax!($b, $t, softmax, softmax_grad, softmax_1k, softmax_grad_1k, 1000); - bench_softmax!($b, $t, softmax, softmax_grad, softmax_10k, softmax_grad_10k, 10_000); - - bench_softmax!($b, $t, log_softmax, log_softmax_grad, - log_softmax_10, log_softmax_grad_10, 10); - bench_softmax!($b, $t, log_softmax, log_softmax_grad, - log_softmax_100, log_softmax_grad_100, 100); - bench_softmax!($b, $t, log_softmax, log_softmax_grad, - log_softmax_1k, log_softmax_grad_1k, 1000); - bench_softmax!($b, $t, log_softmax, log_softmax_grad, - log_softmax_10k, log_softmax_grad_10k, 10_000); - - bench_pooling!($b, $t, pooling_avg, pooling_avg_10, pooling_avg_grad_10, 10) - bench_pooling!($b, $t, pooling_avg, pooling_avg_100, pooling_avg_grad_100, 100) - bench_pooling!($b, $t, pooling_avg, pooling_avg_1k, pooling_avg_grad_1k, 1000) - bench_pooling!($b, $t, pooling_avg, pooling_avg_10k, pooling_avg_grad_10k, 10_000) - - bench_pooling!($b, $t, pooling_max, pooling_max_10, pooling_max_grad_10, 10) - bench_pooling!($b, $t, pooling_max, pooling_max_100, pooling_max_grad_100, 100) - bench_pooling!($b, $t, pooling_max, pooling_max_1k, pooling_max_grad_1k, 1000) - bench_pooling!($b, $t, pooling_max, pooling_max_10k, pooling_max_grad_10k, 10_000) -}} - -mod native_f32 { - define_benches!(get_native_backend, f32); +macro_rules! add_bench_group { + ($b:ident, $t:ident, $f:ident, $k:ident, [$($n:literal),+], $criterion:expr) => { + + paste!{ + $( + $k !($b,$t,$f,$n); + )+ + $({ + let fx = [< $f _ $n _ $b:lower _ $t:lower>]; + fx($criterion); + + let fx_grad = [< $f _grad_ $n _ $b:lower _ $t:lower >]; + fx_grad($criterion); + })+ + } + } } -mod native_f64 { - define_benches!(get_native_backend, f64); + +use super::*; +use co::prelude::*; +use plugin::{LogSoftmax, Relu, Sigmoid, Softmax, Tanh}; + +macro_rules! define_benches { + ($b:ident, $t:ident) => { + paste!{ + fn []() { + let mut criterion = ::criterion::Criterion::default() + .configure_from_args(); + add_bench_group!($b, $t, relu, bench_activation, [100,1000,10_000,100_000,1_000_000, 10_000_000], &mut criterion); + add_bench_group!($b, $t, sigmoid, bench_activation, [100, 1_000, 10_000, 100_000, 1_000_000, 10_000_000], &mut criterion); + add_bench_group!($b, $t, tanh, bench_activation, [100, 1_000, 10_000, 100_000, 1_000_000, 10_000_000], &mut criterion); + add_bench_group!($b, $t, softmax, bench_softmax, [10, 100, 1_000], &mut criterion); + add_bench_group!($b, $t, log_softmax, bench_softmax,[10, 100, 1_000, 10_000], &mut criterion); + add_bench_group!($b, $t, pooling_avg, bench_pooling, [10, 100, 1_000, 10_000], &mut criterion); + add_bench_group!($b, $t, pooling_max, bench_pooling, [10, 100, 1_000, 10_000], &mut criterion); + } + } + } } +define_benches!(Native, f32); +define_benches!(Native, f64); + #[cfg(feature = "cuda")] -mod cuda_f32 { - define_benches!(get_cuda_backend, f32); -} +define_benches!(Cuda, f32); #[cfg(feature = "cuda")] -mod cuda_f64 { - define_benches!(get_cuda_backend, f64); +define_benches!(Cuda, f64); + +fn main() { + group_cuda_f32(); + group_cuda_f64(); + group_native_f32(); + group_native_f64(); + ::criterion::Criterion::default() + .configure_from_args() + .final_summary(); } diff --git a/coaster-nn/src/tests/convolutional.rs b/coaster-nn/src/tests/convolutional.rs index 43f2fefea..dd23942c6 100644 --- a/coaster-nn/src/tests/convolutional.rs +++ b/coaster-nn/src/tests/convolutional.rs @@ -3,11 +3,11 @@ use std::fmt; use crate::co::plugin::numeric_helpers::Float; use crate::co::prelude::*; +use super::{filled_tensor, tensor_assert_eq, tensor_assert_eq_tensor, Epsilon}; use crate::plugin::{ ConvBackwardDataAlgo, ConvBackwardFilterAlgo, ConvForwardAlgo, Convolution, ConvolutionConfig, LRN, }; -use crate::tests::{filled_tensor, tensor_assert_eq, tensor_assert_eq_tensor, Epsilon}; pub fn test_lrn(backend: Backend) where diff --git a/coaster-nn/src/tests/dropout.rs b/coaster-nn/src/tests/dropout.rs index 99f659fc8..4b24f78aa 100644 --- a/coaster-nn/src/tests/dropout.rs +++ b/coaster-nn/src/tests/dropout.rs @@ -3,8 +3,8 @@ use std::fmt; use crate::co::plugin::numeric_helpers::Float; use crate::co::prelude::*; +use super::{filled_tensor, tensor_assert_eq_tensor, tensor_assert_ne_tensor, Epsilon}; use crate::plugin::Dropout; -use crate::tests::{filled_tensor, tensor_assert_eq_tensor, tensor_assert_ne_tensor, Epsilon}; pub fn test_dropout(backend: Backend) where diff --git a/coaster-nn/src/tests/pooling.rs b/coaster-nn/src/tests/pooling.rs index 5f014e46f..d516faa95 100644 --- a/coaster-nn/src/tests/pooling.rs +++ b/coaster-nn/src/tests/pooling.rs @@ -3,10 +3,10 @@ use std::fmt; use crate::co::plugin::numeric_helpers::Float; use crate::co::prelude::*; -use crate::plugin::Pooling; -use crate::tests::{ +use super::{ filled_tensor, tensor_assert_eq, tensor_assert_eq_tensor, uniformly_random_tensor, Epsilon, }; +use crate::plugin::Pooling; pub fn test_pooling_max(backend: Backend) where diff --git a/coaster-nn/src/tests/rnn.rs b/coaster-nn/src/tests/rnn.rs index cbdc767bc..a6b7f82b8 100644 --- a/coaster-nn/src/tests/rnn.rs +++ b/coaster-nn/src/tests/rnn.rs @@ -3,10 +3,10 @@ use std::fmt; use co::prelude::*; use coaster as co; +use super::{filled_tensor, uniformly_random_tensor, Epsilon, One, Zero}; use crate::plugin::{ self, DirectionMode, RnnAlgorithm, RnnConfig, RnnInputMode, RnnNetworkMode, RnnPaddingMode, }; -use crate::tests::{filled_tensor, uniformly_random_tensor, Epsilon, One, Zero}; use crate::{co::plugin::numeric_helpers::Float, Rnn}; pub fn test_rnn(backend: Backend) diff --git a/coaster-nn/src/tests/softmax.rs b/coaster-nn/src/tests/softmax.rs index 7739b8d92..e368cfe18 100644 --- a/coaster-nn/src/tests/softmax.rs +++ b/coaster-nn/src/tests/softmax.rs @@ -3,8 +3,8 @@ use std::fmt; use crate::co::plugin::numeric_helpers::Float; use crate::co::prelude::*; +use super::{filled_tensor, tensor_assert_eq, tensor_assert_eq_tensor, Epsilon}; use crate::plugin::{LogSoftmax, Softmax}; -use crate::tests::{filled_tensor, tensor_assert_eq, tensor_assert_eq_tensor, Epsilon}; const DIMS: [usize; 3] = [4, 1, 3]; diff --git a/coaster/Cargo.toml b/coaster/Cargo.toml index a7cbf9a8f..9d59c6940 100644 --- a/coaster/Cargo.toml +++ b/coaster/Cargo.toml @@ -3,10 +3,10 @@ name = "coaster" description = "high-performance computation on any hardware" version = "0.2.0" authors = [ - "Bernhard Schuster ", - "Lissa Hyacinth ", - "Michael Hirn", - "Maximilian Goisser", + "Bernhard Schuster ", + "Lissa Hyacinth ", + "Michael Hirn", + "Maximilian Goisser", ] edition = "2018" repository = "https://github.com/spearow/coaster" @@ -30,10 +30,11 @@ rcublas = { version = "0.6", path = "../rcublas/cublas", optional = true } [dev-dependencies] coaster-nn = { path = "../coaster-nn", default-features = false } trybuild = "1.0" +criterion = "0.4" [features] default = ["native"] native = [] cuda = ["rcudnn", "rcublas"] opencl = [] -unstable_alloc = [] # faster but unstable memory allocation on native machines +unstable_alloc = [] # faster but unstable memory allocation on native machines diff --git a/coaster/benches/shared_tensor.rs b/coaster/benches/shared_tensor.rs index 640c0d60e..86517f0ac 100644 --- a/coaster/benches/shared_tensor.rs +++ b/coaster/benches/shared_tensor.rs @@ -1,11 +1,9 @@ -#![feature(test)] - use co::backend::{Backend, BackendConfig}; use co::device::IDevice; use co::framework::IFramework; use co::tensor::SharedTensor; use coaster as co; -use test::Bencher; +use criterion::{criterion_group, criterion_main, Criterion}; #[cfg(feature = "cuda")] use co::frameworks::Cuda; @@ -34,7 +32,7 @@ fn opencl_backend() -> Backend { use co::frameworks::cuda::get_cuda_backend as cuda_backend; fn sync_back_and_forth( - b: &mut Bencher, + b: &mut Criterion, backend1: Backend, backend2: Backend, mem_size: usize, @@ -51,15 +49,22 @@ fn sync_back_and_forth( mem.read_write(dev1).unwrap(); mem.read_write(dev2).unwrap(); - b.bytes = mem_size as u64 * 2; // we do two transfers per iteration - b.iter(|| { - mem.read_write(dev1).unwrap(); - mem.read_write(dev2).unwrap(); - }); + use criterion::BenchmarkId; + let input = mem_size as u64 * 2; // we do two transfers per iteration; + b.bench_with_input( + BenchmarkId::new("sync_back_and_forth", input), + &input, + |b, _i| { + b.iter(|| { + mem.read_write(dev1).unwrap(); + mem.read_write(dev2).unwrap(); + }) + }, + ); } fn unidirectional_sync( - b: &mut Bencher, + b: &mut Criterion, src_backend: Backend, dst_backend: Backend, mem_size: usize, @@ -75,11 +80,18 @@ fn unidirectional_sync( mem.write_only(src_dev).unwrap(); mem.read(dst_dev).unwrap(); - b.bytes = mem_size as u64; - b.iter(|| { - mem.write_only(src_dev).unwrap(); - mem.read(dst_dev).unwrap(); - }); + use criterion::BenchmarkId; + let input = mem_size as u64; + b.bench_with_input( + BenchmarkId::new("unidirectional", input), + &input, + |b, _i| { + b.iter(|| { + mem.write_only(src_dev).unwrap(); + mem.read(dst_dev).unwrap(); + }) + }, + ); } #[cfg(feature = "native")] @@ -88,66 +100,72 @@ mod opencl_and_native { use super::{native_backend, opencl_backend, sync_back_and_forth, unidirectional_sync}; use co::device::IDevice; use co::frameworks::opencl; - use test::Bencher; + use criterion::criterion_group; + use criterion::Criterion; #[inline(never)] - fn bench_256_alloc_1mb_opencl_profile(b: &mut Bencher, device: &opencl::Context, size: usize) { - b.iter(|| { - for _ in 0..256 { - device.alloc_memory(size).unwrap(); - } + fn bench_256_alloc_1mb_opencl_profile( + b: &mut Criterion, + device: &opencl::Context, + size: usize, + ) { + b.bench_function("alloc 1mb opencl", |b| { + b.iter(|| { + for _ in 0..256 { + device.alloc_memory(size).unwrap(); + } + }) }); } - #[bench] - fn bench_256_alloc_1mb_opencl(b: &mut Bencher) { + ::criterion::criterion_group!( + coaster, + bench_256_alloc_1mb_opencl, + bench_sync_1kb_native_opencl_back_and_forth, + bench_sync_1kb_native_to_opencl, + bench_sync_1mb_native_opencl_back_and_forth, + bench_sync_1mb_native_to_opencl, + ); + + fn bench_256_alloc_1mb_opencl(b: &mut Criterion) { let opencl_backend = opencl_backend(); let cl_device = opencl_backend.device(); bench_256_alloc_1mb_opencl_profile(b, cl_device, 1_048_576); } - #[bench] - fn bench_sync_1kb_native_opencl_back_and_forth(b: &mut Bencher) { + fn bench_sync_1kb_native_opencl_back_and_forth(b: &mut Criterion) { sync_back_and_forth(b, opencl_backend(), native_backend(), 1024); } - #[bench] - fn bench_sync_1kb_native_to_opencl(b: &mut Bencher) { + fn bench_sync_1kb_native_to_opencl(b: &mut Criterion) { unidirectional_sync(b, native_backend(), opencl_backend(), 1024); } - #[bench] - fn bench_sync_1kb_opencl_to_native(b: &mut Bencher) { + fn bench_sync_1kb_opencl_to_native(b: &mut Criterion) { unidirectional_sync(b, opencl_backend(), native_backend(), 1024); } - #[bench] - fn bench_sync_1mb_native_opencl_back_and_forth(b: &mut Bencher) { + fn bench_sync_1mb_native_opencl_back_and_forth(b: &mut Criterion) { sync_back_and_forth(b, opencl_backend(), native_backend(), 1_048_576); } - #[bench] - fn bench_sync_1mb_native_to_opencl(b: &mut Bencher) { + fn bench_sync_1mb_native_to_opencl(b: &mut Criterion) { unidirectional_sync(b, native_backend(), opencl_backend(), 1_048_576); } - #[bench] - fn bench_sync_1mb_opencl_to_native(b: &mut Bencher) { + fn bench_sync_1mb_opencl_to_native(b: &mut Criterion) { unidirectional_sync(b, opencl_backend(), native_backend(), 1_048_576); } - #[bench] - fn bench_sync_128mb_native_opencl_back_and_forth(b: &mut Bencher) { + fn bench_sync_128mb_native_opencl_back_and_forth(b: &mut Criterion) { sync_back_and_forth(b, opencl_backend(), native_backend(), 128 * 1_048_576); } - #[bench] - fn bench_sync_128mb_native_to_opencl(b: &mut Bencher) { + fn bench_sync_128mb_native_to_opencl(b: &mut Criterion) { unidirectional_sync(b, native_backend(), opencl_backend(), 128 * 1_048_576); } - #[bench] - fn bench_sync_128mb_opencl_to_native(b: &mut Bencher) { + fn bench_sync_128mb_opencl_to_native(b: &mut Criterion) { unidirectional_sync(b, opencl_backend(), native_backend(), 128 * 1_048_576); } } @@ -156,57 +174,47 @@ mod opencl_and_native { #[cfg(feature = "cuda")] mod cuda_and_native { use super::{cuda_backend, native_backend, sync_back_and_forth, unidirectional_sync}; - use test::Bencher; + use ::criterion::Criterion; - #[bench] - fn bench_sync_1kb_native_cuda_back_and_forth(b: &mut Bencher) { + fn bench_sync_1kb_native_cuda_back_and_forth(b: &mut Criterion) { sync_back_and_forth(b, cuda_backend(), native_backend(), 1024); } - #[bench] - fn bench_sync_1kb_native_to_cuda(b: &mut Bencher) { + fn bench_sync_1kb_native_to_cuda(b: &mut Criterion) { unidirectional_sync(b, native_backend(), cuda_backend(), 1024); } - #[bench] - fn bench_sync_1kb_cuda_to_native(b: &mut Bencher) { + fn bench_sync_1kb_cuda_to_native(b: &mut Criterion) { unidirectional_sync(b, cuda_backend(), native_backend(), 1024); } - #[bench] - fn bench_sync_1mb_native_cuda_back_and_forth(b: &mut Bencher) { + fn bench_sync_1mb_native_cuda_back_and_forth(b: &mut Criterion) { sync_back_and_forth(b, cuda_backend(), native_backend(), 1_048_576); } - #[bench] - fn bench_sync_1mb_native_to_cuda(b: &mut Bencher) { + fn bench_sync_1mb_native_to_cuda(b: &mut Criterion) { unidirectional_sync(b, native_backend(), cuda_backend(), 1_048_576); } - #[bench] - fn bench_sync_1mb_cuda_to_native(b: &mut Bencher) { + fn bench_sync_1mb_cuda_to_native(b: &mut Criterion) { unidirectional_sync(b, cuda_backend(), native_backend(), 1_048_576); } - #[bench] - fn bench_sync_128mb_native_cuda_back_and_forth(b: &mut Bencher) { + fn bench_sync_128mb_native_cuda_back_and_forth(b: &mut Criterion) { sync_back_and_forth(b, cuda_backend(), native_backend(), 128 * 1_048_576); } - #[bench] - fn bench_sync_128mb_native_to_cuda(b: &mut Bencher) { + fn bench_sync_128mb_native_to_cuda(b: &mut Criterion) { unidirectional_sync(b, native_backend(), cuda_backend(), 128 * 1_048_576); } - #[bench] - fn bench_sync_128mb_cuda_to_native(b: &mut Bencher) { + pub fn bench_sync_128mb_cuda_to_native(b: &mut Criterion) { unidirectional_sync(b, cuda_backend(), native_backend(), 128 * 1_048_576); } } -#[bench] #[cfg(feature = "cuda")] -fn bench_shared_tensor_access_time_first(b: &mut Bencher) { +fn bench_shared_tensor_access_time_first(b: &mut Criterion) { let cuda_backend = cuda_backend(); let cu_device = cuda_backend.device(); let native_backend = native_backend(); @@ -217,12 +225,13 @@ fn bench_shared_tensor_access_time_first(b: &mut Bencher) { x.write_only(cu_device).unwrap(); x.read(nt_device).unwrap(); - b.iter(|| x.read(nt_device).unwrap()) + b.bench_function("access_first_time", |b| { + b.iter(|| x.read(nt_device).unwrap()) + }); } -#[bench] #[cfg(feature = "cuda")] -fn bench_shared_tensor_access_time_second(b: &mut Bencher) { +fn bench_shared_tensor_access_time_second(b: &mut Criterion) { let cuda_backend = cuda_backend(); let cu_device = cuda_backend.device(); let native_backend = native_backend(); @@ -232,5 +241,19 @@ fn bench_shared_tensor_access_time_second(b: &mut Bencher) { x.write_only(cu_device).unwrap(); x.write_only(nt_device).unwrap(); - b.iter(|| x.read(nt_device).unwrap()) + b.bench_function("access_first_time", |b| { + b.iter(|| x.read(nt_device).unwrap()) + }); } + +::criterion::criterion_group!( + cuda_and_native, + cuda_and_native::bench_sync_128mb_cuda_to_native +); +::criterion::criterion_group!( + cuda, + bench_shared_tensor_access_time_second, + bench_shared_tensor_access_time_first +); + +::criterion::criterion_main!(cuda, cuda_and_native); diff --git a/coaster/src/device.rs b/coaster/src/device.rs index 8da1fc592..d2722ed02 100644 --- a/coaster/src/device.rs +++ b/coaster/src/device.rs @@ -57,7 +57,7 @@ pub trait MemorySync { ) -> Result<(), Error>; } -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] /// Defines a generic set of Memory Errors. pub enum Error { /// No route found for memory transfer between devices diff --git a/coaster/src/frameworks/cuda/api/driver/error.rs b/coaster/src/frameworks/cuda/api/driver/error.rs index 8145c6038..8256690a7 100644 --- a/coaster/src/frameworks/cuda/api/driver/error.rs +++ b/coaster/src/frameworks/cuda/api/driver/error.rs @@ -1,7 +1,7 @@ //! Provides Rust Errors for OpenCL's status. #[allow(missing_docs)] -#[derive(Debug, Copy, Clone, PartialEq, Eq, thiserror::Error)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)] /// OpenCL device errors pub enum Error { #[error("{0}")] diff --git a/coaster/src/frameworks/native/error.rs b/coaster/src/frameworks/native/error.rs index aae3e213d..7c1164aae 100644 --- a/coaster/src/frameworks/native/error.rs +++ b/coaster/src/frameworks/native/error.rs @@ -1,7 +1,7 @@ /// Defines a generic set of Native Errors. use std::{error, fmt}; -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] /// Defines the Native Error. pub enum Error { /// Failure related to allocation, syncing memory diff --git a/coaster/src/frameworks/opencl/api/error.rs b/coaster/src/frameworks/opencl/api/error.rs index f5fc8c690..ef684f648 100644 --- a/coaster/src/frameworks/opencl/api/error.rs +++ b/coaster/src/frameworks/opencl/api/error.rs @@ -2,7 +2,7 @@ use std::{error, fmt}; -#[derive(Debug, Copy, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] /// Defines OpenCL errors. pub enum Error { /// Failure with provided platform. diff --git a/coaster/src/frameworks/opencl/platform.rs b/coaster/src/frameworks/opencl/platform.rs index b47e8aeec..2176ed00b 100644 --- a/coaster/src/frameworks/opencl/platform.rs +++ b/coaster/src/frameworks/opencl/platform.rs @@ -2,7 +2,7 @@ use super::api::types as cl; -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq)] /// Defines a OpenCL Platform. pub struct Platform { id: isize, diff --git a/coaster/src/hardware.rs b/coaster/src/hardware.rs index 2cbe9c379..1588b3215 100644 --- a/coaster/src/hardware.rs +++ b/coaster/src/hardware.rs @@ -7,7 +7,7 @@ //! //! [device]: ../device/index.html -#[derive(Debug, Copy, Clone, PartialEq, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Hash)] /// Specifies the available Hardware types. pub enum HardwareType { /// CPU devices diff --git a/coaster/src/lib.rs b/coaster/src/lib.rs index ea1381f80..98fb599bd 100644 --- a/coaster/src/lib.rs +++ b/coaster/src/lib.rs @@ -26,7 +26,7 @@ //! //! But writing code for devices would often be a good choice as these devices can execute many //! operations a lot faster than the native CPUs. GPUs for example can execute operations roughly -//! one to two orders of magnitudes faster, thanks to better support of parallelizing operations. +//! one to two orders of ns faster, thanks to better support of parallelizing operations. //! OpenCL and CUDA make parallelizing operations super easy. //! //! With Coaster we eleminate the pain points of writing device code, so you can run your code diff --git a/coaster/src/tensor.rs b/coaster/src/tensor.rs index 2ea7c8fe4..d7637d021 100644 --- a/coaster/src/tensor.rs +++ b/coaster/src/tensor.rs @@ -96,6 +96,12 @@ pub struct SharedTensor { phantom: PhantomData, } +impl PartialEq for SharedTensor { + fn eq(&self, other: &Self) -> bool { + self.desc == other.desc + } +} + /// Describes the Descriptor of a Tensor. pub trait ITensorDesc { /// Returns the rank of the Tensor. @@ -546,7 +552,7 @@ impl SharedTensor { } /// Errors than can occur when synchronizing memory. -#[derive(Debug, Copy, Clone, PartialEq, Eq, thiserror::Error)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)] pub enum Error { /// Error caused by operations with device: allocation, memory synchronization, etc. #[error(transparent)] diff --git a/coaster/tests/shared_memory_specs.rs b/coaster/tests/shared_memory_specs.rs index c75827187..48885378e 100644 --- a/coaster/tests/shared_memory_specs.rs +++ b/coaster/tests/shared_memory_specs.rs @@ -2,10 +2,10 @@ use coaster as co; #[cfg(test)] mod shared_memory_spec { - use super::co::prelude::*; - use super::co::tensor::Error; #[cfg(features = "cuda")] use super::co::frameworks::native::flatbox::FlatBox; + use super::co::prelude::*; + use super::co::tensor::Error; #[cfg(features = "cuda")] fn write_to_memory(mem: &mut FlatBox, data: &[T]) { diff --git a/greenglas/Cargo.toml b/greenglas/Cargo.toml index 070502bba..402680c6e 100644 --- a/greenglas/Cargo.toml +++ b/greenglas/Cargo.toml @@ -1,19 +1,26 @@ [package] name = "greenglas" description = "Data Preprocessing library for Machine Learning" -authors = ["Bernhard Schuster ", - "Michael Hirn"] +authors = ["Bernhard Schuster ", "Michael Hirn"] version = "0.3.0" repository = "https://github.com/spearow/greenglas" homepage = "https://spearow.io/projects/greenglas" documentation = "https://spearow.github.com/greenglas" readme = "README.md" -keywords = ["preprocessing", "data-preprocessing", "transformation", "encoding", "machine-learning"] +keywords = [ + "preprocessing", + "data-preprocessing", + "transformation", + "encoding", + "machine-learning", +] license = "MIT OR Apache-2.0" edition = "2018" [dependencies] -coaster = { path = "../coaster", version = "0.2", default-features = false, features = ["native"] } # native feature to read/write data into tensors +coaster = { path = "../coaster", version = "0.2", default-features = false, features = [ + "native", +] } # native feature to read/write data into tensors # can't upgrade beyond due to: # ISSUE: https://github.com/image-rs/image/issues/1468 diff --git a/juice-examples/juice-utils/Cargo.toml b/juice-examples/juice-utils/Cargo.toml index 8c75cb2eb..75a9d5254 100644 --- a/juice-examples/juice-utils/Cargo.toml +++ b/juice-examples/juice-utils/Cargo.toml @@ -2,12 +2,15 @@ name = "juice-utils" description = "Utilities for running Juice Examples" version = "0.0.1" -authors = ["Lissa Hyacinth ", "Bernhard Schuster "] +authors = [ + "Lissa Hyacinth ", + "Bernhard Schuster ", +] edition = "2018" publish = false [dependencies] -reqwest= { version = "0.11", features = ["blocking", "rustls-tls"]} +reqwest = { version = "0.11", features = ["blocking", "rustls-tls"] } flate2 = "1" fs-err = "2" log = "0.4" diff --git a/juice-examples/mackey-glass-rnn-regression/Cargo.toml b/juice-examples/mackey-glass-rnn-regression/Cargo.toml index b077daa4c..d9fa1c326 100644 --- a/juice-examples/mackey-glass-rnn-regression/Cargo.toml +++ b/juice-examples/mackey-glass-rnn-regression/Cargo.toml @@ -7,16 +7,16 @@ edition = "2018" publish = false [dependencies] -greenglas = { path = "../../greenglas" , version = "0.3.0"} -juice = { path = "../../juice", default-features = false , version = "0.3.0"} -coaster = { path = "../../coaster", default-features = false , version = "0.2.0"} -coaster-nn = { path = "../../coaster-nn", default-features = false , version = "0.5.0"} +greenglas = { path = "../../greenglas", version = "0.3.0" } +juice = { path = "../../juice", default-features = false, version = "0.3.0" } +coaster = { path = "../../coaster", default-features = false, version = "0.2.0" } +coaster-nn = { path = "../../coaster-nn", default-features = false, version = "0.5.0" } csv = "1.1" serde = { version = "1", features = ["derive"] } env_logger = "0.9" log = "0.4" -docopt= "1.1" +docopt = "1.1" fs-err = "2" [features] diff --git a/juice-examples/mackey-glass-rnn-regression/src/main.rs b/juice-examples/mackey-glass-rnn-regression/src/main.rs index 31bedf9ed..e20733063 100644 --- a/juice-examples/mackey-glass-rnn-regression/src/main.rs +++ b/juice-examples/mackey-glass-rnn-regression/src/main.rs @@ -3,7 +3,7 @@ use coaster as co; use coaster_nn as conn; -use fs_err::File; +use fs_err::{File, OpenOptions}; use std::rc::Rc; use std::sync::{Arc, RwLock}; @@ -140,15 +140,15 @@ where regressor_cfg.add_layer(mse_layer_cfg); // Setup an Optimiser - let mut solver_cfg = SolverConfig { + let solver_cfg = SolverConfig { minibatch_size: batch_size, base_lr: learning_rate, momentum, + objective: LayerConfig::new("regressor", regressor_cfg), + network: LayerConfig::new("network", net_cfg), ..SolverConfig::default() }; - solver_cfg.network = LayerConfig::new("network", net_cfg); - solver_cfg.objective = LayerConfig::new("regressor", regressor_cfg); Solver::from_config(backend.clone(), backend, &solver_cfg) } @@ -209,6 +209,12 @@ pub(crate) fn train( } if total > 0 { + let mut file = OpenOptions::new() + .create(true) + .truncate(false) + .write(true) + .open(file) + .unwrap(); solver .mut_network() .save(file) @@ -227,6 +233,7 @@ pub(crate) fn test( where Backend: coaster::IBackend + SolverOps + LayerOps, { + let file = File::open(file)?; // Load in a pre-trained network let mut network: Layer> = Layer::>::load(backend, file)?; diff --git a/juice-examples/mnist-image-multiclass-classification/Cargo.toml b/juice-examples/mnist-image-multiclass-classification/Cargo.toml index 32cc809f6..b63245ae0 100644 --- a/juice-examples/mnist-image-multiclass-classification/Cargo.toml +++ b/juice-examples/mnist-image-multiclass-classification/Cargo.toml @@ -2,19 +2,21 @@ name = "example-mnist-classification" description = "MNIST Image Multiclass Classification example of Juice" version = "0.0.1" -authors = ["Bernhard Schuster ", - "Michael Hirn", - "Maximilian Goisser"] +authors = [ + "Bernhard Schuster ", + "Michael Hirn", + "Maximilian Goisser", +] edition = "2018" publish = false [dependencies] -greenglas = { path = "../../greenglas" , version = "0.3.0"} -juice = { path = "../../juice", default-features = false , version = "0.3.0"} -coaster = { path = "../../coaster", default-features = false , version = "0.2.0"} -coaster-nn = { path = "../../coaster-nn", default-features = false , version = "0.5.0"} +greenglas = { path = "../../greenglas", version = "0.3.0" } +juice = { path = "../../juice", default-features = false, version = "0.3.0" } +coaster = { path = "../../coaster", default-features = false, version = "0.2.0" } +coaster-nn = { path = "../../coaster-nn", default-features = false, version = "0.5.0" } -juice-utils = {path = "../juice-utils"} +juice-utils = { path = "../juice-utils" } csv = "1" hyper = "0.14" diff --git a/juice/Cargo.toml b/juice/Cargo.toml index cbbf40c3d..5cae31c58 100644 --- a/juice/Cargo.toml +++ b/juice/Cargo.toml @@ -34,6 +34,7 @@ capnpc = "0.14" [dev-dependencies] env_logger = "0.9" +criterion = "0.4" [features] default = ["native", "cuda"] diff --git a/juice/benches/network_benches.rs b/juice/benches/network_benches.rs index 798b61938..f6afdfd12 100644 --- a/juice/benches/network_benches.rs +++ b/juice/benches/network_benches.rs @@ -1,6 +1,5 @@ -#![feature(test)] +use criterion::criterion_main; -extern crate test; #[macro_use] extern crate timeit; extern crate coaster as co; @@ -12,8 +11,8 @@ mod benches { use juice::layers::*; use std::rc::Rc; + use ::criterion::Criterion; use std::sync::{Arc, RwLock}; - use test::Bencher; fn native_backend() -> Rc> { Rc::new(Backend::::default().unwrap()) @@ -30,7 +29,7 @@ mod benches { #[inline(never)] #[allow(unused_variables)] - fn bench_profile ()>(b: &mut Bencher, mut bench_func: F, times: usize) { + fn bench_profile ()>(b: &mut ::criterion::Criterion, mut bench_func: F, times: usize) { timeit_loops!(times, { bench_func(); }); @@ -38,7 +37,7 @@ mod benches { // #[inline(never)] // fn sync_back_and_forth( - // b: &mut Bencher, + // b: &mut ::criterion::Criterion, // n: usize, // nt_device: &DeviceType, // cl_device: &DeviceType, @@ -64,10 +63,9 @@ mod benches { // }); // } - #[bench] #[ignore] #[cfg(feature = "cuda")] - fn bench_mnsit_forward_1(_b: &mut Bencher) { + fn bench_mnsit_forward_1(_b: &mut ::criterion::Criterion) { let mut cfg = SequentialConfig::default(); // set up input cfg.add_input("in", &[1, 30, 30]); @@ -89,7 +87,7 @@ mod benches { // loss_cfg.add_input("label"); // cfg.add_layer(loss_cfg); - let backend = cuda_backend(); + let backend = Rc::new(cuda_backend()); let mut network = Layer::from_config( backend.clone(), &LayerConfig::new("network", LayerType::Sequential(cfg)), @@ -114,10 +112,9 @@ mod benches { // }); } - #[bench] // #[ignore] #[cfg(feature = "cuda")] - fn alexnet_forward(b: &mut Bencher) { + pub fn alexnet_forward(b: &mut ::criterion::Criterion) { let mut cfg = SequentialConfig::default(); // Layer: data cfg.add_input("data", &[128, 3, 224, 224]); @@ -253,7 +250,7 @@ mod benches { fc3_cfg.add_output("fc3_out"); cfg.add_layer(fc3_cfg); - let backend = cuda_backend(); + let backend = Rc::new(cuda_backend()); // let native_backend = native_backend(); let mut network = Layer::from_config( backend.clone(), @@ -274,8 +271,7 @@ mod benches { } } - #[bench] - fn small_alexnet_forward(b: &mut Bencher) { + pub fn small_alexnet_forward(b: &mut ::criterion::Criterion) { // let _ = env_logger::init(); let mut cfg = SequentialConfig::default(); // Layer: data @@ -412,7 +408,7 @@ mod benches { fc3_cfg.add_output("fc3_out"); cfg.add_layer(fc3_cfg); - let backend = cuda_backend(); + let backend = Rc::new(cuda_backend()); // let native_backend = native_backend(); let mut network = Layer::from_config( backend.clone(), @@ -431,3 +427,6 @@ mod benches { } } } + +::criterion::criterion_group!(network, benches::alexnet_forward, benches::small_alexnet_forward); +::criterion::criterion_main!(network); diff --git a/juice/doc/book.toml b/juice/doc/book.toml index 74d2902c6..6b59d99a2 100644 --- a/juice/doc/book.toml +++ b/juice/doc/book.toml @@ -2,9 +2,9 @@ title = "juice documentation" description = "Introduction book to the juice framework" authors = [ - "Maximilian Goisser", - "Michael Hirn", - "Bernhard Schuster ", + "Maximilian Goisser", + "Michael Hirn", + "Bernhard Schuster ", ] language = "en" diff --git a/juice/examples/benchmarks.rs b/juice/examples/benchmarks.rs index 79a0828b3..1b20dfa6e 100644 --- a/juice/examples/benchmarks.rs +++ b/juice/examples/benchmarks.rs @@ -9,7 +9,8 @@ use crate::co::prelude::*; use std::env; use std::rc::Rc; -use std::sync::{RwLock, Arc}; +#[cfg(all(feature = "cuda", not(feature = "native")))] +use std::sync::{Arc, RwLock}; fn main() { env_logger::init(); @@ -116,6 +117,7 @@ fn bench_alexnet() { "Try running with `cargo run --release --no-default-features --features cuda --example benchmarks alexnet`." ); } + #[cfg(all(feature = "cuda", not(feature = "native")))] fn bench_alexnet() { let mut cfg = SequentialConfig::default(); diff --git a/juice/examples/loadstorecycle.rs b/juice/examples/loadstorecycle.rs new file mode 100644 index 000000000..ad0ffa169 --- /dev/null +++ b/juice/examples/loadstorecycle.rs @@ -0,0 +1,201 @@ +use std::{fs::File, io::BufReader}; + +use juice::util::native_backend; +use juice::{capnp_util, layer::*, layers::*, solver::*}; +// use juice::layer::{LayerType, LayerConfig, Layer}; +use coaster::prelude::*; +use juice::capnp_util::{CapnpRead, CapnpWrite}; +use juice::util::{LayerOps, SolverOps}; +use num::cast; +use num::NumCast; +use rand::distributions::Distribution; +use std::rc::Rc; +use std::sync::Arc; +use std::sync::RwLock; + +fn get_native_backend() -> Backend { + Backend::::default().unwrap() +} + +fn sillynet() -> SequentialConfig { + let mut cfg = SequentialConfig::default(); + cfg.add_input("data", &[1, 2, 3, 2]); + + cfg.add_layer(LayerConfig::new("fc1", LinearConfig { output_size: 13 })); + cfg.add_layer(LayerConfig::new("fc2", LinearConfig { output_size: 7 })); + cfg.add_layer(LayerConfig::new("fc3", LinearConfig { output_size: 1 })); + cfg +} + +fn add_solver( + backend: Rc>, + net_cfg: SequentialConfig, + batch_size: usize, + learning_rate: f32, + momentum: f32, +) -> Solver, Backend> +where + Backend: coaster::IBackend + SolverOps + LayerOps, +{ + // Define an Objective Function + let mut regressor_cfg = SequentialConfig::default(); + + // Bit confusing, but the output is seen as the same as the input? + regressor_cfg.add_input("data_output", &[batch_size, 1]); + regressor_cfg.add_input("label", &[batch_size, 1]); + + // Add a Layer expressing Mean Squared Error (MSE) Loss. This will be used with the solver to + // train the model. + let mse_layer_cfg = LayerConfig::new("mse", LayerType::MeanSquaredError); + regressor_cfg.add_layer(mse_layer_cfg); + + // Setup an Optimiser + let solver_cfg = SolverConfig { + minibatch_size: batch_size, + base_lr: learning_rate, + momentum, + network: LayerConfig::new("network", net_cfg), + objective: LayerConfig::new("regressor", regressor_cfg), + ..SolverConfig::default() + }; + + Solver::from_config(backend.clone(), backend, &solver_cfg) +} + +// Currently unused. It was supposed to be used for random tests with inlined +// verification or cross tests (Native <-> Cuda), but they aren't implemented +// yet. +pub fn uniformly_random_tensor(_backend: &Backend, dims: &[usize], low: T, high: T) -> SharedTensor +where + T: Copy + PartialEq + PartialOrd + rand::distributions::uniform::SampleUniform, + F: IFramework, + Backend: IBackend, +{ + let dist = rand::distributions::Uniform::::new_inclusive(low, high); + let mut rng = rand::thread_rng(); + + let mut xs = SharedTensor::new(&dims); + { + let native = get_native_backend(); + let native_dev = native.device(); + { + let mem = xs.write_only(native_dev).unwrap(); + let mem_slice = mem.as_mut_slice::(); + + for x in mem_slice { + *x = dist.sample(&mut rng); + } + } + // not functional since, PartialEq has yet to be implemented for Device + // but tbh this is test only so screw the extra dangling ununsed memory alloc + // let other_dev = backend.device(); + // if other_dev != native_dev { + // xs.read(other_dev).unwrap(); + // xs.drop_device(native_dev).unwrap(); + // } + } + xs +} + +pub fn write_to_tensor(_backend: &Backend, xs: &mut SharedTensor, data: &[f64]) +where + T: ::std::marker::Copy + NumCast, + F: IFramework, + Backend: IBackend, +{ + assert_eq!(xs.desc().size(), data.len()); + let native = get_native_backend(); + let native_dev = native.device(); + { + let mem = xs.write_only(native_dev).unwrap(); + let mem_buffer = mem.as_mut_slice::(); + for (i, x) in data.iter().enumerate() { + mem_buffer[i] = cast::<_, T>(*x).unwrap(); + } + } + // not functional since, PartialEq has yet to be implemented for Device + // but tbh this is test only so screw the extra dangling ununsed memory alloc + // let other_dev = backend.device(); + // if other_dev != native_dev { + // xs.read(other_dev).unwrap(); + // xs.drop_device(native_dev).unwrap(); + // } +} + +pub fn filled_tensor(backend: &Backend, dims: &[usize], data: &[f64]) -> SharedTensor +where + T: ::std::marker::Copy + NumCast, + F: IFramework, + Backend: IBackend, +{ + let mut x = SharedTensor::new(&dims); + write_to_tensor(backend, &mut x, data); + x +} + +fn main() { + let _ = env_logger::builder() + .default_format() + .filter_level(log::LevelFilter::Trace) + .try_init(); + + eprintln!("XXXXXXXXXXXXXX"); + let cfg = sillynet(); + + let backend = Rc::new(native_backend()); + let mut solver = add_solver::(backend.clone(), cfg, 1, 1., 1.); + + let mut input_lock = Arc::new(RwLock::new(uniformly_random_tensor( + &backend, + &[1, 2, 3, 2], + 0.0f32, + 256.0f32, + ))); + let mut label_lock = Arc::new(RwLock::new(filled_tensor(&backend, &[1, 1], &[1.]))); + + log::info!("Start training 1 trivial minibatch..."); + solver.train_minibatch(input_lock, label_lock); + + log::info!("Training complete;"); + let mut buf = Vec::::new(); + + // save + log::info!("Saving.."); + solver.mut_network().save(&mut buf).unwrap(); + log::info!("Saved;"); + + log::info!("Loading.."); + // load the same + let reincarnation = Layer::>::load(backend, &mut buf.as_slice()).unwrap(); + log::info!("Loaded;"); + log::info!("Cmp.."); + assert_eq!(solver.mut_network(), &reincarnation); +} + +// fn foo() { +// let p = "./foo.serialized.capnp"; +// { +// let mut f = File::options().truncate(true).create(true).write(true).open(p).unwrap(); +// // let mut builder = juice::juice_capnp::sequential_config::Builder; +// let mut builder = capnp::message::TypedBuilder::::new_default(); +// let facade = &mut builder.get_root().unwrap(); +// cfg.write_capnp(facade); + +// capnp::serialize::write_message(&mut f, builder.borrow_inner()).unwrap(); +// } +// let reincarnation = { +// let f = File::options().read(true).open(p).unwrap(); + +// let reader = BufReader::new(f); +// let reader = capnp::serialize::try_read_message( +// reader, +// capnp::message::ReaderOptions { +// traversal_limit_in_words: None, +// nesting_limit: 100, +// }).unwrap().unwrap(); +// ::read_capnp(reader.get_root().unwrap()) +// }; + +// assert_eq!(dbg!(cfg), dbg!(reincarnation)); + +// } diff --git a/juice/src/layer.rs b/juice/src/layer.rs index fe62ff1c3..a68d878eb 100644 --- a/juice/src/layer.rs +++ b/juice/src/layer.rs @@ -6,9 +6,7 @@ use std::cmp; use std::collections::{HashMap, HashSet}; use std::fmt; -use std::fs::File; -use std::io::{self, BufReader}; -use std::path::Path; +use std::io::{self, BufReader, BufWriter}; use std::rc::Rc; use std::sync::{Arc, RwLock}; @@ -90,6 +88,21 @@ pub struct Layer { pub blob_names: HashMap>, ArcLock>)>, } +impl PartialEq for Layer { + fn eq(&self, other: &Self) -> bool { + use std::ops::Deref; + self.loss == other.loss + && self.config == other.config + && self.name == other.name + && self + .weights_data + .iter() + .zip(other.weights_data.iter()) + .find(|(a, b)| a.read().unwrap().deref() != b.read().unwrap().deref()) + .is_none() + } +} + impl Layer { /// Connect the layer to another layers and set up tensors for intermediate results and weights. /// @@ -710,16 +723,15 @@ impl Layer { /// # } /// # } /// ``` - pub fn save>(&mut self, path: P) -> io::Result<()> { - let path = path.as_ref(); - let ref mut out = File::create(path)?; + pub fn save(&mut self, dest: W) -> io::Result<()> { + let writer = BufWriter::new(dest); let mut message = ::capnp::message::Builder::new_default(); { let mut layer = message.init_root::(); self.write_capnp(&mut layer); } - ::capnp::serialize_packed::write_message(out, &message).unwrap(); + ::capnp::serialize_packed::write_message(writer, &message).unwrap(); Ok(()) } @@ -761,13 +773,11 @@ impl Layer { /// # } /// # } /// ``` - pub fn load + 'static, P: AsRef>( + pub fn load + 'static, R: std::io::Read>( backend: Rc, - path: P, + source: R, ) -> io::Result> { - let path = path.as_ref(); - let ref mut file = File::open(path)?; - let mut reader = BufReader::new(file); + let mut reader = BufReader::new(source); let message_reader = ::capnp::serialize_packed::read_message(&mut reader, ::capnp::message::ReaderOptions::new()).unwrap(); @@ -1369,7 +1379,7 @@ impl fmt::Debug for dyn ILayer { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] /// Layer Configuration Struct pub struct LayerConfig { /// The name of the Layer @@ -1392,7 +1402,7 @@ pub struct LayerConfig { pub propagate_down: Vec, } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] /// The Layer Types pub enum LayerType { // Common layers diff --git a/juice/src/layers/common/convolution.rs b/juice/src/layers/common/convolution.rs index d0c2b32f4..99cc381f0 100644 --- a/juice/src/layers/common/convolution.rs +++ b/juice/src/layers/common/convolution.rs @@ -278,7 +278,7 @@ impl> ComputeParametersGradient for } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] /// Specifies configuration parameters for a Convolution Layer. pub struct ConvolutionConfig { /// The number of output feature maps diff --git a/juice/src/layers/common/dropout.rs b/juice/src/layers/common/dropout.rs index 8d715e51d..8ea0c373c 100644 --- a/juice/src/layers/common/dropout.rs +++ b/juice/src/layers/common/dropout.rs @@ -102,7 +102,7 @@ impl> ComputeInputGradient for Dropout< impl> ComputeParametersGradient for Dropout {} -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Clone, PartialEq)] /// Specifies configuration parameters for a Dropout Layer. pub struct DropoutConfig { /// The probability to clamp a value to zero diff --git a/juice/src/layers/common/linear.rs b/juice/src/layers/common/linear.rs index 38d90b993..3e1a9049f 100644 --- a/juice/src/layers/common/linear.rs +++ b/juice/src/layers/common/linear.rs @@ -249,7 +249,7 @@ impl ::std::default::Default for Linear { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[allow(missing_copy_implementations)] /// Specifies configuration parameters for a Linear Layer. pub struct LinearConfig { diff --git a/juice/src/layers/common/pooling.rs b/juice/src/layers/common/pooling.rs index 9a8dbfbff..17d61f278 100644 --- a/juice/src/layers/common/pooling.rs +++ b/juice/src/layers/common/pooling.rs @@ -170,7 +170,7 @@ impl> ComputeInputGradient for Pooling< impl> ComputeParametersGradient for Pooling {} -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] /// Specifies configuration parameters for a Pooling Layer. pub struct PoolingConfig { /// The PoolingMode to use @@ -247,7 +247,7 @@ impl<'a> CapnpRead<'a> for PoolingConfig { } } -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] /// The different modes of pooling that can be calculated. pub enum PoolingMode { /// The maximum value inside the pooling window will be used as result. diff --git a/juice/src/layers/common/rnn.rs b/juice/src/layers/common/rnn.rs index 62970ee6b..fdb8c78b1 100644 --- a/juice/src/layers/common/rnn.rs +++ b/juice/src/layers/common/rnn.rs @@ -270,7 +270,7 @@ impl> ComputeParametersGradient for Rnn } } -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, PartialEq)] /// Specifies configuration parameters for a RNN Layer. /// TODO: Update to RnnConfig in CUDA Layer pub struct RnnConfig { diff --git a/juice/src/layers/container/sequential.rs b/juice/src/layers/container/sequential.rs index 1808f8b83..f0978b143 100644 --- a/juice/src/layers/container/sequential.rs +++ b/juice/src/layers/container/sequential.rs @@ -386,7 +386,7 @@ impl + 'static> ComputeParametersGradient fo } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] #[allow(missing_copy_implementations)] /// Specifies configuration parameters for a Sequential Layer. pub struct SequentialConfig { diff --git a/juice/src/layers/loss/negative_log_likelihood.rs b/juice/src/layers/loss/negative_log_likelihood.rs index 05be58d10..5e6539b88 100644 --- a/juice/src/layers/loss/negative_log_likelihood.rs +++ b/juice/src/layers/loss/negative_log_likelihood.rs @@ -126,7 +126,7 @@ impl ComputeInputGradient for NegativeLogLikelihood { impl ComputeParametersGradient for NegativeLogLikelihood {} -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[allow(missing_copy_implementations)] /// Specifies configuration parameters for a NegativeLogLikelihood Layer. pub struct NegativeLogLikelihoodConfig { diff --git a/juice/src/layers/utility/reshape.rs b/juice/src/layers/utility/reshape.rs index 2d1a699e6..31422798f 100644 --- a/juice/src/layers/utility/reshape.rs +++ b/juice/src/layers/utility/reshape.rs @@ -87,7 +87,7 @@ impl ComputeInputGradient for Reshape { impl ComputeParametersGradient for Reshape {} -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq, Eq)] /// Specifies configuration parameters for a Reshape Layer. pub struct ReshapeConfig { /// The target shape that the input should assume. diff --git a/juice/src/lib.rs b/juice/src/lib.rs index 30fe80b55..a67079fb5 100644 --- a/juice/src/lib.rs +++ b/juice/src/lib.rs @@ -123,10 +123,13 @@ pub mod solver; pub mod solvers; pub mod weight; -mod capnp_util; +pub mod capnp_util; pub mod util; +#[cfg(test)] +use criterion as _; + // include capnp code generated by `build.rs` -mod juice_capnp { +pub mod juice_capnp { include!(concat!(env!("OUT_DIR"), "/juice_capnp.rs")); } diff --git a/juice/src/weight.rs b/juice/src/weight.rs index 9e8af0039..ce84639cd 100644 --- a/juice/src/weight.rs +++ b/juice/src/weight.rs @@ -6,7 +6,7 @@ use crate::juice_capnp::weight_config as capnp_config; use crate::util::native_backend; use rand::{self, prelude::*}; -#[derive(Debug, Clone)] +#[derive(Debug, Clone, PartialEq)] /// Specifies training configuration for a weight blob. pub struct WeightConfig { /// The name of the weight blob -- useful for sharing weights among @@ -137,7 +137,7 @@ impl<'a> CapnpRead<'a> for WeightConfig { } } -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] /// Enum for specifing the shared weights behaviour pub enum DimCheckMode { /// Strict requires that shapes match. @@ -146,7 +146,7 @@ pub enum DimCheckMode { Permissive, } -#[derive(Debug, Copy, Clone)] +#[derive(Debug, Clone, Copy, PartialEq)] /// Enum for specifing the type of Filler. pub enum FillerType { /// Fills the weight blob with a constant `value` (all values are the same). diff --git a/juice/tests/layer_specs.rs b/juice/tests/layer_specs.rs index b05f7a2f5..958b4e7a0 100644 --- a/juice/tests/layer_specs.rs +++ b/juice/tests/layer_specs.rs @@ -46,6 +46,8 @@ mod layer_spec { #[cfg(feature = "native")] mod native { + use std::fs::OpenOptions; + use super::native_backend; use crate::co::prelude::*; use juice::layer::*; @@ -92,11 +94,11 @@ mod layer_spec { fn save_and_load_layer() { let cfg = simple_network(); let mut original_layer = Layer::from_config(native_backend(), &cfg); - let mut tmpfile = std::env::temp_dir(); - tmpfile.push("tmpnet"); - original_layer.save(&tmpfile).unwrap(); - let loaded_layer = Layer::>::load(native_backend(), &tmpfile).unwrap(); + let mut tmpfile = Vec::new(); + original_layer.save(&mut tmpfile).unwrap(); + + let loaded_layer = Layer::>::load(native_backend(), &mut tmpfile.as_slice()).unwrap(); assert_eq!(original_layer.input_blob_names(), loaded_layer.input_blob_names()); diff --git a/rcublas/cublas-sys/Cargo.toml b/rcublas/cublas-sys/Cargo.toml index e262867d2..f98d1244d 100644 --- a/rcublas/cublas-sys/Cargo.toml +++ b/rcublas/cublas-sys/Cargo.toml @@ -3,10 +3,7 @@ name = "rcublas-sys" description = "FFI bindings to cuBLAS" version = "0.5.0" edition = "2018" -authors = [ - "Bernhard Schuster ", - "Maximilian Goisser" -] +authors = ["Bernhard Schuster ", "Maximilian Goisser"] repository = "https://github.com/spearow/juice" homepage = "https://github.com/spearow/juice/tree/master/rcublas/cublas-sys" keywords = ["cublas", "cuda", "nvidia", "sys"] diff --git a/rcublas/cublas-sys/src/generated.rs b/rcublas/cublas-sys/src/generated.rs index 6ead6e31b..97ff64e89 100644 --- a/rcublas/cublas-sys/src/generated.rs +++ b/rcublas/cublas-sys/src/generated.rs @@ -1,13 +1,11 @@ /* automatically generated by rust-bindgen 0.60.1 */ - //! Defines the FFI for CUDA cuBLAS. //! #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] - pub const CUBLAS_VER_MAJOR: u32 = 11; pub const CUBLAS_VER_MINOR: u32 = 10; pub const CUBLAS_VER_PATCH: u32 = 3; @@ -169,7 +167,7 @@ fn bindgen_test_layout_dim3() { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaError { cudaSuccess = 0, cudaErrorInvalidValue = 1, @@ -297,7 +295,7 @@ pub enum cudaError { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaChannelFormatKind { cudaChannelFormatKindSigned = 0, cudaChannelFormatKindUnsigned = 1, @@ -712,7 +710,7 @@ fn bindgen_test_layout_cudaArrayMemoryRequirements() { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaMemoryType { cudaMemoryTypeUnregistered = 0, cudaMemoryTypeHost = 1, @@ -721,7 +719,7 @@ pub enum cudaMemoryType { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaMemcpyKind { cudaMemcpyHostToHost = 0, cudaMemcpyHostToDevice = 1, @@ -1427,7 +1425,7 @@ fn bindgen_test_layout_cudaMemsetParams() { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaAccessProperty { cudaAccessPropertyNormal = 0, cudaAccessPropertyStreaming = 1, @@ -1596,7 +1594,7 @@ fn bindgen_test_layout_cudaHostNodeParams() { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaStreamCaptureStatus { cudaStreamCaptureStatusNone = 0, cudaStreamCaptureStatusActive = 1, @@ -1604,7 +1602,7 @@ pub enum cudaStreamCaptureStatus { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaStreamCaptureMode { cudaStreamCaptureModeGlobal = 0, cudaStreamCaptureModeThreadLocal = 1, @@ -1612,7 +1610,7 @@ pub enum cudaStreamCaptureMode { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaSynchronizationPolicy { cudaSyncPolicyAuto = 1, cudaSyncPolicySpin = 2, @@ -1621,20 +1619,20 @@ pub enum cudaSynchronizationPolicy { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaStreamUpdateCaptureDependenciesFlags { cudaStreamAddCaptureDependencies = 0, cudaStreamSetCaptureDependencies = 1, } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaUserObjectFlags { cudaUserObjectNoDestructorSync = 1, } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaUserObjectRetainFlags { cudaGraphUserObjectMove = 1, } @@ -1645,7 +1643,7 @@ pub struct cudaGraphicsResource { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaGraphicsRegisterFlags { cudaGraphicsRegisterFlagsNone = 0, cudaGraphicsRegisterFlagsReadOnly = 1, @@ -1655,7 +1653,7 @@ pub enum cudaGraphicsRegisterFlags { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaGraphicsMapFlags { cudaGraphicsMapFlagsNone = 0, cudaGraphicsMapFlagsReadOnly = 1, @@ -1663,7 +1661,7 @@ pub enum cudaGraphicsMapFlags { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaGraphicsCubeFace { cudaGraphicsCubeFacePositiveX = 0, cudaGraphicsCubeFaceNegativeX = 1, @@ -1674,7 +1672,7 @@ pub enum cudaGraphicsCubeFace { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaResourceType { cudaResourceTypeArray = 0, cudaResourceTypeMipmappedArray = 1, @@ -1683,7 +1681,7 @@ pub enum cudaResourceType { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaResourceViewFormat { cudaResViewFormatNone = 0, cudaResViewFormatUnsignedChar1 = 1, @@ -2604,7 +2602,7 @@ fn bindgen_test_layout_cudaFuncAttributes() { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaFuncAttribute { cudaFuncAttributeMaxDynamicSharedMemorySize = 8, cudaFuncAttributePreferredSharedMemoryCarveout = 9, @@ -2612,7 +2610,7 @@ pub enum cudaFuncAttribute { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaFuncCache { cudaFuncCachePreferNone = 0, cudaFuncCachePreferShared = 1, @@ -2621,7 +2619,7 @@ pub enum cudaFuncCache { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaSharedMemConfig { cudaSharedMemBankSizeDefault = 0, cudaSharedMemBankSizeFourByte = 1, @@ -2629,7 +2627,7 @@ pub enum cudaSharedMemConfig { } #[repr(i32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaSharedCarveout { cudaSharedmemCarveoutDefault = -1, cudaSharedmemCarveoutMaxShared = 100, @@ -2637,7 +2635,7 @@ pub enum cudaSharedCarveout { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaComputeMode { cudaComputeModeDefault = 0, cudaComputeModeExclusive = 1, @@ -2646,7 +2644,7 @@ pub enum cudaComputeMode { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaLimit { cudaLimitStackSize = 0, cudaLimitPrintfFifoSize = 1, @@ -2658,7 +2656,7 @@ pub enum cudaLimit { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaMemoryAdvise { cudaMemAdviseSetReadMostly = 1, cudaMemAdviseUnsetReadMostly = 2, @@ -2669,7 +2667,7 @@ pub enum cudaMemoryAdvise { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaMemRangeAttribute { cudaMemRangeAttributeReadMostly = 1, cudaMemRangeAttributePreferredLocation = 2, @@ -2678,21 +2676,21 @@ pub enum cudaMemRangeAttribute { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaOutputMode { cudaKeyValuePair = 0, cudaCSV = 1, } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaFlushGPUDirectRDMAWritesOptions { cudaFlushGPUDirectRDMAWritesOptionHost = 1, cudaFlushGPUDirectRDMAWritesOptionMemOps = 2, } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaGPUDirectRDMAWritesOrdering { cudaGPUDirectRDMAWritesOrderingNone = 0, cudaGPUDirectRDMAWritesOrderingOwner = 100, @@ -2700,14 +2698,14 @@ pub enum cudaGPUDirectRDMAWritesOrdering { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaFlushGPUDirectRDMAWritesScope { cudaFlushGPUDirectRDMAWritesToOwner = 100, cudaFlushGPUDirectRDMAWritesToAllDevices = 200, } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaFlushGPUDirectRDMAWritesTarget { cudaFlushGPUDirectRDMAWritesTargetCurrentDevice = 0, } @@ -2717,7 +2715,7 @@ impl cudaDeviceAttr { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaDeviceAttr { cudaDevAttrMaxThreadsPerBlock = 1, cudaDevAttrMaxBlockDimX = 2, @@ -2836,7 +2834,7 @@ pub enum cudaDeviceAttr { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaMemPoolAttr { cudaMemPoolReuseFollowEventDependencies = 1, cudaMemPoolReuseAllowOpportunistic = 2, @@ -2849,7 +2847,7 @@ pub enum cudaMemPoolAttr { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaMemLocationType { cudaMemLocationTypeInvalid = 0, cudaMemLocationTypeDevice = 1, @@ -2909,7 +2907,7 @@ fn bindgen_test_layout_cudaMemLocation() { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaMemAccessFlags { cudaMemAccessFlagsProtNone = 0, cudaMemAccessFlagsProtRead = 1, @@ -2970,7 +2968,7 @@ fn bindgen_test_layout_cudaMemAccessDesc() { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaMemAllocationType { cudaMemAllocationTypeInvalid = 0, cudaMemAllocationTypePinned = 1, @@ -2978,7 +2976,7 @@ pub enum cudaMemAllocationType { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaMemAllocationHandleType { cudaMemHandleTypeNone = 0, cudaMemHandleTypePosixFileDescriptor = 1, @@ -3236,7 +3234,7 @@ fn bindgen_test_layout_cudaMemAllocNodeParams() { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaGraphMemAttributeType { cudaGraphMemAttrUsedMemCurrent = 0, cudaGraphMemAttrUsedMemHigh = 1, @@ -3245,7 +3243,7 @@ pub enum cudaGraphMemAttributeType { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaDeviceP2PAttr { cudaDevP2PAttrPerformanceRank = 1, cudaDevP2PAttrAccessSupported = 2, @@ -4823,7 +4821,7 @@ fn bindgen_test_layout_cudaIpcMemHandle_st() { pub type cudaIpcMemHandle_t = cudaIpcMemHandle_st; #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaExternalMemoryHandleType { cudaExternalMemoryHandleTypeOpaqueFd = 1, cudaExternalMemoryHandleTypeOpaqueWin32 = 2, @@ -5257,7 +5255,7 @@ fn bindgen_test_layout_cudaExternalMemoryMipmappedArrayDesc() { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaExternalSemaphoreHandleType { cudaExternalSemaphoreHandleTypeOpaqueFd = 1, cudaExternalSemaphoreHandleTypeOpaqueWin32 = 2, @@ -6804,7 +6802,7 @@ pub struct CUmemPoolHandle_st { pub type cudaMemPool_t = *mut CUmemPoolHandle_st; #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaCGScope { cudaCGScopeInvalid = 0, cudaCGScopeGrid = 1, @@ -7219,7 +7217,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitNodeParams() { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaGraphNodeType { cudaGraphNodeTypeKernel = 0, cudaGraphNodeTypeMemcpy = 1, @@ -7243,7 +7241,7 @@ pub struct CUgraphExec_st { pub type cudaGraphExec_t = *mut CUgraphExec_st; #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaGraphExecUpdateResult { cudaGraphExecUpdateSuccess = 0, cudaGraphExecUpdateError = 1, @@ -7257,7 +7255,7 @@ pub enum cudaGraphExecUpdateResult { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaGetDriverEntryPointFlags { cudaEnableDefault = 0, cudaEnableLegacyStream = 1, @@ -7265,7 +7263,7 @@ pub enum cudaGetDriverEntryPointFlags { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaGraphDebugDotFlags { cudaGraphDebugDotFlagsVerbose = 1, cudaGraphDebugDotFlagsKernelNodeParams = 4, @@ -7280,14 +7278,14 @@ pub enum cudaGraphDebugDotFlags { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaGraphInstantiateFlags { cudaGraphInstantiateFlagAutoFreeOnLaunch = 1, cudaGraphInstantiateFlagUseNodePriority = 8, } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaStreamAttrID { cudaStreamAttributeAccessPolicyWindow = 1, cudaStreamAttributeSynchronizationPolicy = 3, @@ -7347,7 +7345,7 @@ fn bindgen_test_layout_cudaStreamAttrValue() { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaKernelNodeAttrID { cudaKernelNodeAttributeAccessPolicyWindow = 1, cudaKernelNodeAttributeCooperative = 2, @@ -7429,7 +7427,7 @@ pub type cuDoubleComplex = double2; pub type cuComplex = cuFloatComplex; #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cudaDataType_t { CUDA_R_16F = 2, CUDA_C_16F = 6, @@ -7468,7 +7466,7 @@ pub type libraryPropertyType_t = ::libc::c_uint; pub use self::libraryPropertyType_t as libraryPropertyType; #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cublasStatus_t { CUBLAS_STATUS_SUCCESS = 0, CUBLAS_STATUS_NOT_INITIALIZED = 1, @@ -7483,7 +7481,7 @@ pub enum cublasStatus_t { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cublasFillMode_t { CUBLAS_FILL_MODE_LOWER = 0, CUBLAS_FILL_MODE_UPPER = 1, @@ -7491,14 +7489,14 @@ pub enum cublasFillMode_t { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cublasDiagType_t { CUBLAS_DIAG_NON_UNIT = 0, CUBLAS_DIAG_UNIT = 1, } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cublasSideMode_t { CUBLAS_SIDE_LEFT = 0, CUBLAS_SIDE_RIGHT = 1, @@ -7508,7 +7506,7 @@ impl cublasOperation_t { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cublasOperation_t { CUBLAS_OP_N = 0, CUBLAS_OP_T = 1, @@ -7517,14 +7515,14 @@ pub enum cublasOperation_t { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cublasPointerMode_t { CUBLAS_POINTER_MODE_HOST = 0, CUBLAS_POINTER_MODE_DEVICE = 1, } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cublasAtomicsMode_t { CUBLAS_ATOMICS_NOT_ALLOWED = 0, CUBLAS_ATOMICS_ALLOWED = 1, @@ -7538,7 +7536,7 @@ impl cublasGemmAlgo_t { } #[repr(i32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cublasGemmAlgo_t { CUBLAS_GEMM_DFALT = -1, CUBLAS_GEMM_ALGO0 = 0, @@ -7585,7 +7583,7 @@ pub enum cublasGemmAlgo_t { } #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cublasMath_t { CUBLAS_DEFAULT_MATH = 0, CUBLAS_TENSOR_OP_MATH = 1, @@ -7596,7 +7594,7 @@ pub enum cublasMath_t { pub use self::cudaDataType as cublasDataType_t; #[repr(u32)] #[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum cublasComputeType_t { CUBLAS_COMPUTE_16F = 64, CUBLAS_COMPUTE_16F_PEDANTIC = 65, diff --git a/rcublas/cublas/Cargo.toml b/rcublas/cublas/Cargo.toml index ac20ab64c..453883549 100644 --- a/rcublas/cublas/Cargo.toml +++ b/rcublas/cublas/Cargo.toml @@ -4,9 +4,9 @@ description = "safe Rust wrapper for CUDA's cuBLAS" version = "0.6.0" edition = "2018" authors = [ - "Bernhard Schuster ", - "Lissa Hyacinth ", - "Maximilian Goisser", + "Bernhard Schuster ", + "Lissa Hyacinth ", + "Maximilian Goisser", ] homepage = "https://github.com/spearow/juice/tree/master/rcublas" repository = "https://github.com/spearow/juice" diff --git a/rcublas/cublas/src/error.rs b/rcublas/cublas/src/error.rs index d26761f69..51474cdad 100644 --- a/rcublas/cublas/src/error.rs +++ b/rcublas/cublas/src/error.rs @@ -3,7 +3,7 @@ #[allow(unused)] pub type Result = std::result::Result; -#[derive(Debug, Copy, Clone, thiserror::Error)] +#[derive(Debug, Clone, Copy, thiserror::Error)] /// Defines cuBLAS errors. pub enum Error { /// Failure with cuBLAS initialization. diff --git a/rcudnn/cudnn-sys/Cargo.toml b/rcudnn/cudnn-sys/Cargo.toml index 197e9f44b..5c974a59b 100644 --- a/rcudnn/cudnn-sys/Cargo.toml +++ b/rcudnn/cudnn-sys/Cargo.toml @@ -3,10 +3,7 @@ name = "rcudnn-sys" description = "FFI bindings to cuDNN" version = "0.5.0" edition = "2018" -authors = [ - "Bernhard Schuster ", - "Maximilian Goisser" -] +authors = ["Bernhard Schuster ", "Maximilian Goisser"] repository = "https://github.com/spearow/juice" homepage = "https://github.com/spearow/juice/tree/master/rcudnn/cublas-sys" keywords = ["cudnn", "cuda", "nvidia", "sys"] diff --git a/rcudnn/cudnn-sys/src/generated.rs b/rcudnn/cudnn-sys/src/generated.rs index 467260d45..6ac096b24 100644 --- a/rcudnn/cudnn-sys/src/generated.rs +++ b/rcudnn/cudnn-sys/src/generated.rs @@ -1,20 +1,21 @@ /* automatically generated by rust-bindgen 0.60.1 */ - //! Defines the FFI for CUDA cuDNN. //! #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] - pub const CUDNN_MAJOR: u32 = 8; -pub const CUDNN_MINOR: u32 = 3; -pub const CUDNN_PATCHLEVEL: u32 = 3; -pub const CUDNN_VERSION: u32 = 8303; +pub const CUDNN_MINOR: u32 = 7; +pub const CUDNN_PATCHLEVEL: u32 = 0; +pub const CUDNN_VERSION: u32 = 8700; +pub const CUDNN_MAX_SM_MAJOR_NUMBER: u32 = 9; +pub const CUDNN_MAX_SM_MINOR_NUMBER: u32 = 0; +pub const CUDNN_MAX_DEVICE_VERSION: u32 = 900; pub const CUDNN_OPS_INFER_MAJOR: u32 = 8; -pub const CUDNN_OPS_INFER_MINOR: u32 = 3; -pub const CUDNN_OPS_INFER_PATCH: u32 = 3; +pub const CUDNN_OPS_INFER_MINOR: u32 = 7; +pub const CUDNN_OPS_INFER_PATCH: u32 = 0; pub const CUDNN_DIM_MAX: u32 = 8; pub const CUDNN_LRN_MIN_N: u32 = 1; pub const CUDNN_LRN_MAX_N: u32 = 16; @@ -22,11 +23,11 @@ pub const CUDNN_LRN_MIN_K: f64 = 0.00001; pub const CUDNN_LRN_MIN_BETA: f64 = 0.01; pub const CUDNN_BN_MIN_EPSILON: f64 = 0.0; pub const CUDNN_OPS_TRAIN_MAJOR: u32 = 8; -pub const CUDNN_OPS_TRAIN_MINOR: u32 = 3; -pub const CUDNN_OPS_TRAIN_PATCH: u32 = 3; +pub const CUDNN_OPS_TRAIN_MINOR: u32 = 7; +pub const CUDNN_OPS_TRAIN_PATCH: u32 = 0; pub const CUDNN_ADV_INFER_MAJOR: u32 = 8; -pub const CUDNN_ADV_INFER_MINOR: u32 = 3; -pub const CUDNN_ADV_INFER_PATCH: u32 = 3; +pub const CUDNN_ADV_INFER_MINOR: u32 = 7; +pub const CUDNN_ADV_INFER_PATCH: u32 = 0; pub const CUDNN_RNN_PADDED_IO_DISABLED: u32 = 0; pub const CUDNN_RNN_PADDED_IO_ENABLED: u32 = 1; pub const CUDNN_SEQDATA_DIM_COUNT: u32 = 4; @@ -36,14 +37,14 @@ pub const CUDNN_ATTN_DISABLE_PROJ_BIASES: u32 = 0; pub const CUDNN_ATTN_ENABLE_PROJ_BIASES: u32 = 2; pub const CUDNN_ATTN_WKIND_COUNT: u32 = 8; pub const CUDNN_ADV_TRAIN_MAJOR: u32 = 8; -pub const CUDNN_ADV_TRAIN_MINOR: u32 = 3; -pub const CUDNN_ADV_TRAIN_PATCH: u32 = 3; +pub const CUDNN_ADV_TRAIN_MINOR: u32 = 7; +pub const CUDNN_ADV_TRAIN_PATCH: u32 = 0; pub const CUDNN_CNN_INFER_MAJOR: u32 = 8; -pub const CUDNN_CNN_INFER_MINOR: u32 = 3; -pub const CUDNN_CNN_INFER_PATCH: u32 = 3; +pub const CUDNN_CNN_INFER_MINOR: u32 = 7; +pub const CUDNN_CNN_INFER_PATCH: u32 = 0; pub const CUDNN_CNN_TRAIN_MAJOR: u32 = 8; -pub const CUDNN_CNN_TRAIN_MINOR: u32 = 3; -pub const CUDNN_CNN_TRAIN_PATCH: u32 = 3; +pub const CUDNN_CNN_TRAIN_MINOR: u32 = 7; +pub const CUDNN_CNN_TRAIN_PATCH: u32 = 0; #[repr(u32)] #[non_exhaustive] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] @@ -222,6 +223,9 @@ pub enum cudaError { cudaErrorMpsServerNotReady = 807, cudaErrorMpsMaxClientsReached = 808, cudaErrorMpsMaxConnectionsReached = 809, + cudaErrorMpsClientTerminated = 810, + cudaErrorCdpNotSupported = 811, + cudaErrorCdpVersionMismatch = 812, cudaErrorStreamCaptureUnsupported = 900, cudaErrorStreamCaptureInvalidated = 901, cudaErrorStreamCaptureMerge = 902, @@ -234,6 +238,7 @@ pub enum cudaError { cudaErrorTimeout = 909, cudaErrorGraphExecUpdateFailure = 910, cudaErrorExternalDevice = 911, + cudaErrorInvalidClusterSize = 912, cudaErrorUnknown = 999, cudaErrorApiFailureBase = 10000, } @@ -1564,6 +1569,14 @@ pub enum cudaSynchronizationPolicy { #[repr(u32)] #[non_exhaustive] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaClusterSchedulingPolicy { + cudaClusterSchedulingPolicyDefault = 0, + cudaClusterSchedulingPolicySpread = 1, + cudaClusterSchedulingPolicyLoadBalancing = 2, +} +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum cudaStreamUpdateCaptureDependenciesFlags { cudaStreamAddCaptureDependencies = 0, cudaStreamSetCaptureDependencies = 1, @@ -2360,12 +2373,19 @@ pub struct cudaFuncAttributes { pub cacheModeCA: ::libc::c_int, pub maxDynamicSharedSizeBytes: ::libc::c_int, pub preferredShmemCarveout: ::libc::c_int, + pub clusterDimMustBeSet: ::libc::c_int, + pub requiredClusterWidth: ::libc::c_int, + pub requiredClusterHeight: ::libc::c_int, + pub requiredClusterDepth: ::libc::c_int, + pub clusterSchedulingPolicyPreference: ::libc::c_int, + pub nonPortableClusterSizeAllowed: ::libc::c_int, + pub reserved: [::libc::c_int; 16usize], } #[test] fn bindgen_test_layout_cudaFuncAttributes() { assert_eq!( ::std::mem::size_of::(), - 56usize, + 144usize, concat!("Size of: ", stringify!(cudaFuncAttributes)) ); assert_eq!( @@ -2543,6 +2563,126 @@ fn bindgen_test_layout_cudaFuncAttributes() { ); } test_field_preferredShmemCarveout(); + fn test_field_clusterDimMustBeSet() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).clusterDimMustBeSet) as usize - ptr as usize + }, + 52usize, + concat!( + "Offset of field: ", + stringify!(cudaFuncAttributes), + "::", + stringify!(clusterDimMustBeSet) + ) + ); + } + test_field_clusterDimMustBeSet(); + fn test_field_requiredClusterWidth() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).requiredClusterWidth) as usize - ptr as usize + }, + 56usize, + concat!( + "Offset of field: ", + stringify!(cudaFuncAttributes), + "::", + stringify!(requiredClusterWidth) + ) + ); + } + test_field_requiredClusterWidth(); + fn test_field_requiredClusterHeight() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).requiredClusterHeight) as usize - ptr as usize + }, + 60usize, + concat!( + "Offset of field: ", + stringify!(cudaFuncAttributes), + "::", + stringify!(requiredClusterHeight) + ) + ); + } + test_field_requiredClusterHeight(); + fn test_field_requiredClusterDepth() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).requiredClusterDepth) as usize - ptr as usize + }, + 64usize, + concat!( + "Offset of field: ", + stringify!(cudaFuncAttributes), + "::", + stringify!(requiredClusterDepth) + ) + ); + } + test_field_requiredClusterDepth(); + fn test_field_clusterSchedulingPolicyPreference() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).clusterSchedulingPolicyPreference) as usize + - ptr as usize + }, + 68usize, + concat!( + "Offset of field: ", + stringify!(cudaFuncAttributes), + "::", + stringify!(clusterSchedulingPolicyPreference) + ) + ); + } + test_field_clusterSchedulingPolicyPreference(); + fn test_field_nonPortableClusterSizeAllowed() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).nonPortableClusterSizeAllowed) as usize - ptr as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(cudaFuncAttributes), + "::", + stringify!(nonPortableClusterSizeAllowed) + ) + ); + } + test_field_nonPortableClusterSizeAllowed(); + fn test_field_reserved() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize + }, + 76usize, + concat!( + "Offset of field: ", + stringify!(cudaFuncAttributes), + "::", + stringify!(reserved) + ) + ); + } + test_field_reserved(); } #[repr(u32)] #[non_exhaustive] @@ -2550,7 +2690,13 @@ fn bindgen_test_layout_cudaFuncAttributes() { pub enum cudaFuncAttribute { cudaFuncAttributeMaxDynamicSharedMemorySize = 8, cudaFuncAttributePreferredSharedMemoryCarveout = 9, - cudaFuncAttributeMax = 10, + cudaFuncAttributeClusterDimMustBeSet = 10, + cudaFuncAttributeRequiredClusterWidth = 11, + cudaFuncAttributeRequiredClusterHeight = 12, + cudaFuncAttributeRequiredClusterDepth = 13, + cudaFuncAttributeNonPortableClusterSizeAllowed = 14, + cudaFuncAttributeClusterSchedulingPolicyPreference = 15, + cudaFuncAttributeMax = 16, } #[repr(u32)] #[non_exhaustive] @@ -2621,13 +2767,6 @@ pub enum cudaMemRangeAttribute { #[repr(u32)] #[non_exhaustive] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaOutputMode { - cudaKeyValuePair = 0, - cudaCSV = 1, -} -#[repr(u32)] -#[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum cudaFlushGPUDirectRDMAWritesOptions { cudaFlushGPUDirectRDMAWritesOptionHost = 1, cudaFlushGPUDirectRDMAWritesOptionMemOps = 2, @@ -2773,8 +2912,14 @@ pub enum cudaDeviceAttr { cudaDevAttrGPUDirectRDMAFlushWritesOptions = 117, cudaDevAttrGPUDirectRDMAWritesOrdering = 118, cudaDevAttrMemoryPoolSupportedHandleTypes = 119, + cudaDevAttrClusterLaunch = 120, cudaDevAttrDeferredMappingCudaArraySupported = 121, - cudaDevAttrMax = 122, + cudaDevAttrReserved122 = 122, + cudaDevAttrReserved123 = 123, + cudaDevAttrReserved124 = 124, + cudaDevAttrIpcEventSupport = 125, + cudaDevAttrMemSyncDomainCount = 126, + cudaDevAttrMax = 127, } #[repr(u32)] #[non_exhaustive] @@ -3314,12 +3459,26 @@ pub struct cudaDeviceProp { pub maxBlocksPerMultiProcessor: ::libc::c_int, pub accessPolicyMaxWindowSize: ::libc::c_int, pub reservedSharedMemPerBlock: usize, + pub hostRegisterSupported: ::libc::c_int, + pub sparseCudaArraySupported: ::libc::c_int, + pub hostRegisterReadOnlySupported: ::libc::c_int, + pub timelineSemaphoreInteropSupported: ::libc::c_int, + pub memoryPoolsSupported: ::libc::c_int, + pub gpuDirectRDMASupported: ::libc::c_int, + pub gpuDirectRDMAFlushWritesOptions: ::libc::c_uint, + pub gpuDirectRDMAWritesOrdering: ::libc::c_int, + pub memoryPoolSupportedHandleTypes: ::libc::c_uint, + pub deferredMappingCudaArraySupported: ::libc::c_int, + pub ipcEventSupported: ::libc::c_int, + pub clusterLaunch: ::libc::c_int, + pub unifiedFunctionPointers: ::libc::c_int, + pub reserved: [::libc::c_int; 63usize], } #[test] fn bindgen_test_layout_cudaDeviceProp() { assert_eq!( ::std::mem::size_of::(), - 728usize, + 1032usize, concat!("Size of: ", stringify!(cudaDeviceProp)) ); assert_eq!( @@ -4690,571 +4849,376 @@ fn bindgen_test_layout_cudaDeviceProp() { ); } test_field_reservedSharedMemPerBlock(); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cudaIpcEventHandle_st { - pub reserved: [::libc::c_char; 64usize], -} -#[test] -fn bindgen_test_layout_cudaIpcEventHandle_st() { - assert_eq!( - ::std::mem::size_of::(), - 64usize, - concat!("Size of: ", stringify!(cudaIpcEventHandle_st)) - ); - assert_eq!( - ::std::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(cudaIpcEventHandle_st)) - ); - fn test_field_reserved() { + fn test_field_hostRegisterSupported() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).hostRegisterSupported) as usize - ptr as usize }, - 0usize, + 728usize, concat!( "Offset of field: ", - stringify!(cudaIpcEventHandle_st), + stringify!(cudaDeviceProp), "::", - stringify!(reserved) + stringify!(hostRegisterSupported) ) ); } - test_field_reserved(); -} -pub type cudaIpcEventHandle_t = cudaIpcEventHandle_st; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cudaIpcMemHandle_st { - pub reserved: [::libc::c_char; 64usize], -} -#[test] -fn bindgen_test_layout_cudaIpcMemHandle_st() { - assert_eq!( - ::std::mem::size_of::(), - 64usize, - concat!("Size of: ", stringify!(cudaIpcMemHandle_st)) - ); - assert_eq!( - ::std::mem::align_of::(), - 1usize, - concat!("Alignment of ", stringify!(cudaIpcMemHandle_st)) - ); - fn test_field_reserved() { + test_field_hostRegisterSupported(); + fn test_field_sparseCudaArraySupported() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).sparseCudaArraySupported) as usize - ptr as usize }, - 0usize, + 732usize, concat!( "Offset of field: ", - stringify!(cudaIpcMemHandle_st), + stringify!(cudaDeviceProp), "::", - stringify!(reserved) + stringify!(sparseCudaArraySupported) ) ); } - test_field_reserved(); -} -pub type cudaIpcMemHandle_t = cudaIpcMemHandle_st; -#[repr(u32)] -#[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaExternalMemoryHandleType { - cudaExternalMemoryHandleTypeOpaqueFd = 1, - cudaExternalMemoryHandleTypeOpaqueWin32 = 2, - cudaExternalMemoryHandleTypeOpaqueWin32Kmt = 3, - cudaExternalMemoryHandleTypeD3D12Heap = 4, - cudaExternalMemoryHandleTypeD3D12Resource = 5, - cudaExternalMemoryHandleTypeD3D11Resource = 6, - cudaExternalMemoryHandleTypeD3D11ResourceKmt = 7, - cudaExternalMemoryHandleTypeNvSciBuf = 8, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct cudaExternalMemoryHandleDesc { - pub type_: cudaExternalMemoryHandleType, - pub handle: cudaExternalMemoryHandleDesc__bindgen_ty_1, - pub size: ::libc::c_ulonglong, - pub flags: ::libc::c_uint, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union cudaExternalMemoryHandleDesc__bindgen_ty_1 { - pub fd: ::libc::c_int, - pub win32: cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1, - pub nvSciBufObject: *const ::libc::c_void, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1 { - pub handle: *mut ::libc::c_void, - pub name: *const ::libc::c_void, -} -#[test] -fn bindgen_test_layout_cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!( - "Size of: ", - stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1) - ) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1) - ) - ); - fn test_field_handle() { + test_field_sparseCudaArraySupported(); + fn test_field_hostRegisterReadOnlySupported() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1, - >::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).handle) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).hostRegisterReadOnlySupported) as usize - ptr as usize }, - 0usize, + 736usize, concat!( "Offset of field: ", - stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1), + stringify!(cudaDeviceProp), "::", - stringify!(handle) + stringify!(hostRegisterReadOnlySupported) ) ); } - test_field_handle(); - fn test_field_name() { + test_field_hostRegisterReadOnlySupported(); + fn test_field_timelineSemaphoreInteropSupported() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1, - >::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).timelineSemaphoreInteropSupported) as usize + - ptr as usize }, - 8usize, + 740usize, concat!( "Offset of field: ", - stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1), + stringify!(cudaDeviceProp), "::", - stringify!(name) + stringify!(timelineSemaphoreInteropSupported) ) ); } - test_field_name(); -} -#[test] -fn bindgen_test_layout_cudaExternalMemoryHandleDesc__bindgen_ty_1() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!( - "Size of: ", - stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1) - ) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1) - ) - ); - fn test_field_fd() { + test_field_timelineSemaphoreInteropSupported(); + fn test_field_memoryPoolsSupported() { assert_eq!( unsafe { - let uninit = - ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).fd) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).memoryPoolsSupported) as usize - ptr as usize }, - 0usize, + 744usize, concat!( "Offset of field: ", - stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1), + stringify!(cudaDeviceProp), "::", - stringify!(fd) + stringify!(memoryPoolsSupported) ) ); } - test_field_fd(); - fn test_field_win32() { + test_field_memoryPoolsSupported(); + fn test_field_gpuDirectRDMASupported() { assert_eq!( unsafe { - let uninit = - ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).win32) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).gpuDirectRDMASupported) as usize - ptr as usize }, - 0usize, + 748usize, concat!( "Offset of field: ", - stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1), + stringify!(cudaDeviceProp), "::", - stringify!(win32) + stringify!(gpuDirectRDMASupported) ) ); } - test_field_win32(); - fn test_field_nvSciBufObject() { + test_field_gpuDirectRDMASupported(); + fn test_field_gpuDirectRDMAFlushWritesOptions() { assert_eq!( unsafe { - let uninit = - ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).nvSciBufObject) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).gpuDirectRDMAFlushWritesOptions) as usize - ptr as usize }, - 0usize, + 752usize, concat!( "Offset of field: ", - stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1), + stringify!(cudaDeviceProp), "::", - stringify!(nvSciBufObject) + stringify!(gpuDirectRDMAFlushWritesOptions) ) ); } - test_field_nvSciBufObject(); -} -#[test] -fn bindgen_test_layout_cudaExternalMemoryHandleDesc() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(cudaExternalMemoryHandleDesc)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cudaExternalMemoryHandleDesc)) - ); - fn test_field_type() { + test_field_gpuDirectRDMAFlushWritesOptions(); + fn test_field_gpuDirectRDMAWritesOrdering() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).gpuDirectRDMAWritesOrdering) as usize - ptr as usize }, - 0usize, + 756usize, concat!( "Offset of field: ", - stringify!(cudaExternalMemoryHandleDesc), + stringify!(cudaDeviceProp), "::", - stringify!(type_) + stringify!(gpuDirectRDMAWritesOrdering) ) ); } - test_field_type(); - fn test_field_handle() { + test_field_gpuDirectRDMAWritesOrdering(); + fn test_field_memoryPoolSupportedHandleTypes() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).handle) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).memoryPoolSupportedHandleTypes) as usize - ptr as usize }, - 8usize, + 760usize, concat!( "Offset of field: ", - stringify!(cudaExternalMemoryHandleDesc), + stringify!(cudaDeviceProp), "::", - stringify!(handle) + stringify!(memoryPoolSupportedHandleTypes) ) ); } - test_field_handle(); - fn test_field_size() { + test_field_memoryPoolSupportedHandleTypes(); + fn test_field_deferredMappingCudaArraySupported() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).deferredMappingCudaArraySupported) as usize + - ptr as usize }, - 24usize, + 764usize, concat!( "Offset of field: ", - stringify!(cudaExternalMemoryHandleDesc), + stringify!(cudaDeviceProp), "::", - stringify!(size) + stringify!(deferredMappingCudaArraySupported) ) ); } - test_field_size(); - fn test_field_flags() { + test_field_deferredMappingCudaArraySupported(); + fn test_field_ipcEventSupported() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).ipcEventSupported) as usize - ptr as usize }, - 32usize, + 768usize, concat!( "Offset of field: ", - stringify!(cudaExternalMemoryHandleDesc), + stringify!(cudaDeviceProp), "::", - stringify!(flags) + stringify!(ipcEventSupported) ) ); } - test_field_flags(); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cudaExternalMemoryBufferDesc { - pub offset: ::libc::c_ulonglong, - pub size: ::libc::c_ulonglong, - pub flags: ::libc::c_uint, -} -#[test] -fn bindgen_test_layout_cudaExternalMemoryBufferDesc() { - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(cudaExternalMemoryBufferDesc)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cudaExternalMemoryBufferDesc)) - ); - fn test_field_offset() { + test_field_ipcEventSupported(); + fn test_field_clusterLaunch() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).offset) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).clusterLaunch) as usize - ptr as usize }, - 0usize, + 772usize, concat!( "Offset of field: ", - stringify!(cudaExternalMemoryBufferDesc), + stringify!(cudaDeviceProp), "::", - stringify!(offset) + stringify!(clusterLaunch) ) ); } - test_field_offset(); - fn test_field_size() { + test_field_clusterLaunch(); + fn test_field_unifiedFunctionPointers() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).unifiedFunctionPointers) as usize - ptr as usize }, - 8usize, + 776usize, concat!( "Offset of field: ", - stringify!(cudaExternalMemoryBufferDesc), + stringify!(cudaDeviceProp), "::", - stringify!(size) + stringify!(unifiedFunctionPointers) ) ); } - test_field_size(); - fn test_field_flags() { + test_field_unifiedFunctionPointers(); + fn test_field_reserved() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize }, - 16usize, + 780usize, concat!( "Offset of field: ", - stringify!(cudaExternalMemoryBufferDesc), + stringify!(cudaDeviceProp), "::", - stringify!(flags) + stringify!(reserved) ) ); } - test_field_flags(); + test_field_reserved(); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct cudaExternalMemoryMipmappedArrayDesc { - pub offset: ::libc::c_ulonglong, - pub formatDesc: cudaChannelFormatDesc, - pub extent: cudaExtent, - pub flags: ::libc::c_uint, - pub numLevels: ::libc::c_uint, +pub struct cudaIpcEventHandle_st { + pub reserved: [::libc::c_char; 64usize], } #[test] -fn bindgen_test_layout_cudaExternalMemoryMipmappedArrayDesc() { +fn bindgen_test_layout_cudaIpcEventHandle_st() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::(), 64usize, - concat!( - "Size of: ", - stringify!(cudaExternalMemoryMipmappedArrayDesc) - ) + concat!("Size of: ", stringify!(cudaIpcEventHandle_st)) ); assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(cudaExternalMemoryMipmappedArrayDesc) - ) + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(cudaIpcEventHandle_st)) ); - fn test_field_offset() { + fn test_field_reserved() { assert_eq!( unsafe { - let uninit = - ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).offset) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalMemoryMipmappedArrayDesc), - "::", - stringify!(offset) - ) - ); - } - test_field_offset(); - fn test_field_formatDesc() { - assert_eq!( - unsafe { - let uninit = - ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).formatDesc) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cudaExternalMemoryMipmappedArrayDesc), - "::", - stringify!(formatDesc) - ) - ); - } - test_field_formatDesc(); - fn test_field_extent() { - assert_eq!( - unsafe { - let uninit = - ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).extent) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(cudaExternalMemoryMipmappedArrayDesc), + stringify!(cudaIpcEventHandle_st), "::", - stringify!(extent) + stringify!(reserved) ) ); } - test_field_extent(); - fn test_field_flags() { + test_field_reserved(); +} +pub type cudaIpcEventHandle_t = cudaIpcEventHandle_st; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cudaIpcMemHandle_st { + pub reserved: [::libc::c_char; 64usize], +} +#[test] +fn bindgen_test_layout_cudaIpcMemHandle_st() { + assert_eq!( + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(cudaIpcMemHandle_st)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(cudaIpcMemHandle_st)) + ); + fn test_field_reserved() { assert_eq!( unsafe { - let uninit = - ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize }, - 56usize, + 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalMemoryMipmappedArrayDesc), + stringify!(cudaIpcMemHandle_st), "::", - stringify!(flags) + stringify!(reserved) ) ); } - test_field_flags(); - fn test_field_numLevels() { - assert_eq!( - unsafe { - let uninit = - ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).numLevels) as usize - ptr as usize - }, - 60usize, - concat!( - "Offset of field: ", - stringify!(cudaExternalMemoryMipmappedArrayDesc), - "::", - stringify!(numLevels) - ) - ); - } - test_field_numLevels(); + test_field_reserved(); } +pub type cudaIpcMemHandle_t = cudaIpcMemHandle_st; #[repr(u32)] #[non_exhaustive] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaExternalSemaphoreHandleType { - cudaExternalSemaphoreHandleTypeOpaqueFd = 1, - cudaExternalSemaphoreHandleTypeOpaqueWin32 = 2, - cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt = 3, - cudaExternalSemaphoreHandleTypeD3D12Fence = 4, - cudaExternalSemaphoreHandleTypeD3D11Fence = 5, - cudaExternalSemaphoreHandleTypeNvSciSync = 6, - cudaExternalSemaphoreHandleTypeKeyedMutex = 7, - cudaExternalSemaphoreHandleTypeKeyedMutexKmt = 8, - cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd = 9, - cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32 = 10, +pub enum cudaExternalMemoryHandleType { + cudaExternalMemoryHandleTypeOpaqueFd = 1, + cudaExternalMemoryHandleTypeOpaqueWin32 = 2, + cudaExternalMemoryHandleTypeOpaqueWin32Kmt = 3, + cudaExternalMemoryHandleTypeD3D12Heap = 4, + cudaExternalMemoryHandleTypeD3D12Resource = 5, + cudaExternalMemoryHandleTypeD3D11Resource = 6, + cudaExternalMemoryHandleTypeD3D11ResourceKmt = 7, + cudaExternalMemoryHandleTypeNvSciBuf = 8, } #[repr(C)] #[derive(Copy, Clone)] -pub struct cudaExternalSemaphoreHandleDesc { - pub type_: cudaExternalSemaphoreHandleType, - pub handle: cudaExternalSemaphoreHandleDesc__bindgen_ty_1, +pub struct cudaExternalMemoryHandleDesc { + pub type_: cudaExternalMemoryHandleType, + pub handle: cudaExternalMemoryHandleDesc__bindgen_ty_1, + pub size: ::libc::c_ulonglong, pub flags: ::libc::c_uint, } #[repr(C)] #[derive(Copy, Clone)] -pub union cudaExternalSemaphoreHandleDesc__bindgen_ty_1 { +pub union cudaExternalMemoryHandleDesc__bindgen_ty_1 { pub fd: ::libc::c_int, - pub win32: cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1, - pub nvSciSyncObj: *const ::libc::c_void, + pub win32: cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1, + pub nvSciBufObject: *const ::libc::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1 { +pub struct cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1 { pub handle: *mut ::libc::c_void, pub name: *const ::libc::c_void, } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1() { +fn bindgen_test_layout_cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::(), 16usize, concat!( "Size of: ", - stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1) + stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1) ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1) + stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1) ) ); fn test_field_handle() { assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1, + cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1, >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).handle) as usize - ptr as usize @@ -5262,7 +5226,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1), + stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1), "::", stringify!(handle) ) @@ -5273,7 +5237,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1, + cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1, >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize @@ -5281,7 +5245,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty 8usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1), + stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1__bindgen_ty_1), "::", stringify!(name) ) @@ -5290,34 +5254,35 @@ fn bindgen_test_layout_cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty test_field_name(); } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreHandleDesc__bindgen_ty_1() { +fn bindgen_test_layout_cudaExternalMemoryHandleDesc__bindgen_ty_1() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::(), 16usize, concat!( "Size of: ", - stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1) + stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1) ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1) + stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1) ) ); fn test_field_fd() { assert_eq!( unsafe { - let uninit = :: std :: mem :: MaybeUninit :: < cudaExternalSemaphoreHandleDesc__bindgen_ty_1 > :: uninit () ; + let uninit = + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).fd) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1), + stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1), "::", stringify!(fd) ) @@ -5327,61 +5292,63 @@ fn bindgen_test_layout_cudaExternalSemaphoreHandleDesc__bindgen_ty_1() { fn test_field_win32() { assert_eq!( unsafe { - let uninit = :: std :: mem :: MaybeUninit :: < cudaExternalSemaphoreHandleDesc__bindgen_ty_1 > :: uninit () ; + let uninit = + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).win32) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1), + stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1), "::", stringify!(win32) ) ); } test_field_win32(); - fn test_field_nvSciSyncObj() { + fn test_field_nvSciBufObject() { assert_eq!( unsafe { - let uninit = :: std :: mem :: MaybeUninit :: < cudaExternalSemaphoreHandleDesc__bindgen_ty_1 > :: uninit () ; + let uninit = + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).nvSciSyncObj) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).nvSciBufObject) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1), + stringify!(cudaExternalMemoryHandleDesc__bindgen_ty_1), "::", - stringify!(nvSciSyncObj) + stringify!(nvSciBufObject) ) ); } - test_field_nvSciSyncObj(); + test_field_nvSciBufObject(); } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreHandleDesc() { +fn bindgen_test_layout_cudaExternalMemoryHandleDesc() { assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(cudaExternalSemaphoreHandleDesc)) + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(cudaExternalMemoryHandleDesc)) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(cudaExternalSemaphoreHandleDesc)) + concat!("Alignment of ", stringify!(cudaExternalMemoryHandleDesc)) ); fn test_field_type() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreHandleDesc), + stringify!(cudaExternalMemoryHandleDesc), "::", stringify!(type_) ) @@ -5391,31 +5358,48 @@ fn bindgen_test_layout_cudaExternalSemaphoreHandleDesc() { fn test_field_handle() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).handle) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreHandleDesc), + stringify!(cudaExternalMemoryHandleDesc), "::", stringify!(handle) ) ); } test_field_handle(); + fn test_field_size() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalMemoryHandleDesc), + "::", + stringify!(size) + ) + ); + } + test_field_size(); fn test_field_flags() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, - 24usize, + 32usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreHandleDesc), + stringify!(cudaExternalMemoryHandleDesc), "::", stringify!(flags) ) @@ -5424,601 +5408,413 @@ fn bindgen_test_layout_cudaExternalSemaphoreHandleDesc() { test_field_flags(); } #[repr(C)] -#[derive(Copy, Clone)] -pub struct cudaExternalSemaphoreSignalParams_v1 { - pub params: cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1, - pub flags: ::libc::c_uint, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1 { - pub fence: cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_1, - pub nvSciSync: cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2, - pub keyedMutex: cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_3, -} -#[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_1 { - pub value: ::libc::c_ulonglong, +pub struct cudaExternalMemoryBufferDesc { + pub offset: ::libc::c_ulonglong, + pub size: ::libc::c_ulonglong, + pub flags: ::libc::c_uint, } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_1() { +fn bindgen_test_layout_cudaExternalMemoryBufferDesc() { assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!( - "Size of: ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_1) - ) + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(cudaExternalMemoryBufferDesc)) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, - concat!( - "Alignment of ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_1) - ) + concat!("Alignment of ", stringify!(cudaExternalMemoryBufferDesc)) ); - fn test_field_value() { + fn test_field_offset() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_1, - >::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).value) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).offset) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_1), + stringify!(cudaExternalMemoryBufferDesc), "::", - stringify!(value) + stringify!(offset) ) ); } - test_field_value(); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2 { - pub fence: *mut ::libc::c_void, - pub reserved: ::libc::c_ulonglong, -} -#[test] -fn bindgen_test_layout_cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!( - "Size of: ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2) - ) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2) - ) - ); - fn test_field_fence() { + test_field_offset(); + fn test_field_size() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2, - >::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).fence) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize }, - 0usize, + 8usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2), + stringify!(cudaExternalMemoryBufferDesc), "::", - stringify!(fence) + stringify!(size) ) ); } - test_field_fence(); - fn test_field_reserved() { + test_field_size(); + fn test_field_flags() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2, - >::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, - 0usize, + 16usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2), + stringify!(cudaExternalMemoryBufferDesc), "::", - stringify!(reserved) + stringify!(flags) ) ); } - test_field_reserved(); + test_field_flags(); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_3 { - pub key: ::libc::c_ulonglong, +pub struct cudaExternalMemoryMipmappedArrayDesc { + pub offset: ::libc::c_ulonglong, + pub formatDesc: cudaChannelFormatDesc, + pub extent: cudaExtent, + pub flags: ::libc::c_uint, + pub numLevels: ::libc::c_uint, } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_3() { +fn bindgen_test_layout_cudaExternalMemoryMipmappedArrayDesc() { assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!( - "Size of: ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_3) - ) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_3) - ) - ); - fn test_field_key() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_3, - >::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_3), - "::", - stringify!(key) - ) - ); - } - test_field_key(); -} -#[test] -fn bindgen_test_layout_cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1() { - assert_eq!( - ::std::mem::size_of::(), - 24usize, + ::std::mem::size_of::(), + 64usize, concat!( "Size of: ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1) + stringify!(cudaExternalMemoryMipmappedArrayDesc) ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1) + stringify!(cudaExternalMemoryMipmappedArrayDesc) ) ); - fn test_field_fence() { + fn test_field_offset() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1, - >::uninit(); + let uninit = + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).fence) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).offset) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1), + stringify!(cudaExternalMemoryMipmappedArrayDesc), "::", - stringify!(fence) + stringify!(offset) ) ); } - test_field_fence(); - fn test_field_nvSciSync() { + test_field_offset(); + fn test_field_formatDesc() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1, - >::uninit(); + let uninit = + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).nvSciSync) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).formatDesc) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1), + stringify!(cudaExternalMemoryMipmappedArrayDesc), "::", - stringify!(nvSciSync) + stringify!(formatDesc) ) ); } - test_field_nvSciSync(); - fn test_field_keyedMutex() { + test_field_formatDesc(); + fn test_field_extent() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1, - >::uninit(); + let uninit = + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).keyedMutex) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).extent) as usize - ptr as usize }, - 16usize, + 32usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1), + stringify!(cudaExternalMemoryMipmappedArrayDesc), "::", - stringify!(keyedMutex) + stringify!(extent) ) ); } - test_field_keyedMutex(); -} -#[test] -fn bindgen_test_layout_cudaExternalSemaphoreSignalParams_v1() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!( - "Size of: ", - stringify!(cudaExternalSemaphoreSignalParams_v1) - ) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(cudaExternalSemaphoreSignalParams_v1) - ) - ); - fn test_field_params() { + test_field_extent(); + fn test_field_flags() { assert_eq!( unsafe { let uninit = - ::std::mem::MaybeUninit::::uninit(); + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).params) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, - 0usize, + 56usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams_v1), + stringify!(cudaExternalMemoryMipmappedArrayDesc), "::", - stringify!(params) + stringify!(flags) ) ); } - test_field_params(); - fn test_field_flags() { + test_field_flags(); + fn test_field_numLevels() { assert_eq!( unsafe { let uninit = - ::std::mem::MaybeUninit::::uninit(); + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).numLevels) as usize - ptr as usize }, - 24usize, + 60usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams_v1), + stringify!(cudaExternalMemoryMipmappedArrayDesc), "::", - stringify!(flags) + stringify!(numLevels) ) ); } - test_field_flags(); + test_field_numLevels(); +} +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaExternalSemaphoreHandleType { + cudaExternalSemaphoreHandleTypeOpaqueFd = 1, + cudaExternalSemaphoreHandleTypeOpaqueWin32 = 2, + cudaExternalSemaphoreHandleTypeOpaqueWin32Kmt = 3, + cudaExternalSemaphoreHandleTypeD3D12Fence = 4, + cudaExternalSemaphoreHandleTypeD3D11Fence = 5, + cudaExternalSemaphoreHandleTypeNvSciSync = 6, + cudaExternalSemaphoreHandleTypeKeyedMutex = 7, + cudaExternalSemaphoreHandleTypeKeyedMutexKmt = 8, + cudaExternalSemaphoreHandleTypeTimelineSemaphoreFd = 9, + cudaExternalSemaphoreHandleTypeTimelineSemaphoreWin32 = 10, } #[repr(C)] #[derive(Copy, Clone)] -pub struct cudaExternalSemaphoreWaitParams_v1 { - pub params: cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1, +pub struct cudaExternalSemaphoreHandleDesc { + pub type_: cudaExternalSemaphoreHandleType, + pub handle: cudaExternalSemaphoreHandleDesc__bindgen_ty_1, pub flags: ::libc::c_uint, } #[repr(C)] #[derive(Copy, Clone)] -pub struct cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1 { - pub fence: cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_1, - pub nvSciSync: cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2, - pub keyedMutex: cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3, +pub union cudaExternalSemaphoreHandleDesc__bindgen_ty_1 { + pub fd: ::libc::c_int, + pub win32: cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1, + pub nvSciSyncObj: *const ::libc::c_void, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_1 { - pub value: ::libc::c_ulonglong, +pub struct cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1 { + pub handle: *mut ::libc::c_void, + pub name: *const ::libc::c_void, } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_1() { +fn bindgen_test_layout_cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1() { assert_eq!( - ::std::mem::size_of::(), - 8usize, + ::std::mem::size_of::(), + 16usize, concat!( "Size of: ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_1) + stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1) ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_1) + stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1) ) ); - fn test_field_value() { + fn test_field_handle() { assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_1, + cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1, >::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).value) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).handle) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_1), + stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1), "::", - stringify!(value) + stringify!(handle) ) ); } - test_field_value(); -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2 { - pub fence: *mut ::libc::c_void, - pub reserved: ::libc::c_ulonglong, + test_field_handle(); + fn test_field_name() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1, + >::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(name) + ) + ); + } + test_field_name(); } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2() { +fn bindgen_test_layout_cudaExternalSemaphoreHandleDesc__bindgen_ty_1() { assert_eq!( - ::std::mem::size_of::(), - 8usize, + ::std::mem::size_of::(), + 16usize, concat!( "Size of: ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2) + stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1) ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2) + stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1) ) ); - fn test_field_fence() { + fn test_field_fd() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2, - >::uninit(); + let uninit = :: std :: mem :: MaybeUninit :: < cudaExternalSemaphoreHandleDesc__bindgen_ty_1 > :: uninit () ; let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).fence) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).fd) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2), + stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1), "::", - stringify!(fence) + stringify!(fd) ) ); } - test_field_fence(); - fn test_field_reserved() { + test_field_fd(); + fn test_field_win32() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2, - >::uninit(); + let uninit = :: std :: mem :: MaybeUninit :: < cudaExternalSemaphoreHandleDesc__bindgen_ty_1 > :: uninit () ; let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).win32) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2), + stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1), "::", - stringify!(reserved) + stringify!(win32) ) ); } - test_field_reserved(); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3 { - pub key: ::libc::c_ulonglong, - pub timeoutMs: ::libc::c_uint, -} -#[test] -fn bindgen_test_layout_cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3() { - assert_eq!( - ::std::mem::size_of::(), - 16usize, - concat!( - "Size of: ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3) - ) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3) - ) - ); - fn test_field_key() { + test_field_win32(); + fn test_field_nvSciSyncObj() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3, - >::uninit(); + let uninit = :: std :: mem :: MaybeUninit :: < cudaExternalSemaphoreHandleDesc__bindgen_ty_1 > :: uninit () ; let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).nvSciSyncObj) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3), - "::", - stringify!(key) - ) - ); - } - test_field_key(); - fn test_field_timeoutMs() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3, - >::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).timeoutMs) as usize - ptr as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3), + stringify!(cudaExternalSemaphoreHandleDesc__bindgen_ty_1), "::", - stringify!(timeoutMs) + stringify!(nvSciSyncObj) ) ); } - test_field_timeoutMs(); + test_field_nvSciSyncObj(); } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1() { +fn bindgen_test_layout_cudaExternalSemaphoreHandleDesc() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::(), 32usize, - concat!( - "Size of: ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1) - ) + concat!("Size of: ", stringify!(cudaExternalSemaphoreHandleDesc)) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, - concat!( - "Alignment of ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1) - ) + concat!("Alignment of ", stringify!(cudaExternalSemaphoreHandleDesc)) ); - fn test_field_fence() { + fn test_field_type() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1, - >::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).fence) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1), + stringify!(cudaExternalSemaphoreHandleDesc), "::", - stringify!(fence) + stringify!(type_) ) ); } - test_field_fence(); - fn test_field_nvSciSync() { + test_field_type(); + fn test_field_handle() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1, - >::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).nvSciSync) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).handle) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1), - "::", - stringify!(nvSciSync) - ) - ); - } - test_field_nvSciSync(); - fn test_field_keyedMutex() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1, - >::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).keyedMutex) as usize - ptr as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1), - "::", - stringify!(keyedMutex) - ) - ); - } - test_field_keyedMutex(); -} -#[test] -fn bindgen_test_layout_cudaExternalSemaphoreWaitParams_v1() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(cudaExternalSemaphoreWaitParams_v1)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(cudaExternalSemaphoreWaitParams_v1) - ) - ); - fn test_field_params() { - assert_eq!( - unsafe { - let uninit = - ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).params) as usize - ptr as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams_v1), + stringify!(cudaExternalSemaphoreHandleDesc), "::", - stringify!(params) + stringify!(handle) ) ); } - test_field_params(); + test_field_handle(); fn test_field_flags() { assert_eq!( unsafe { - let uninit = - ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, - 32usize, + 24usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams_v1), + stringify!(cudaExternalSemaphoreHandleDesc), "::", stringify!(flags) ) @@ -6028,47 +5824,45 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitParams_v1() { } #[repr(C)] #[derive(Copy, Clone)] -pub struct cudaExternalSemaphoreSignalParams { - pub params: cudaExternalSemaphoreSignalParams__bindgen_ty_1, +pub struct cudaExternalSemaphoreSignalParams_v1 { + pub params: cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1, pub flags: ::libc::c_uint, - pub reserved: [::libc::c_uint; 16usize], } #[repr(C)] #[derive(Copy, Clone)] -pub struct cudaExternalSemaphoreSignalParams__bindgen_ty_1 { - pub fence: cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_1, - pub nvSciSync: cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2, - pub keyedMutex: cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_3, - pub reserved: [::libc::c_uint; 12usize], +pub struct cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1 { + pub fence: cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_1, + pub nvSciSync: cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2, + pub keyedMutex: cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_3, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_1 { +pub struct cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_1 { pub value: ::libc::c_ulonglong, } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_1() { +fn bindgen_test_layout_cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_1() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::(), 8usize, concat!( "Size of: ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_1) + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_1) ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_1) + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_1) ) ); fn test_field_value() { assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_1, + cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_1, >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).value) as usize - ptr as usize @@ -6076,7 +5870,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_1), + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_1), "::", stringify!(value) ) @@ -6086,33 +5880,33 @@ fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ } #[repr(C)] #[derive(Copy, Clone)] -pub union cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2 { +pub union cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2 { pub fence: *mut ::libc::c_void, pub reserved: ::libc::c_ulonglong, } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2() { +fn bindgen_test_layout_cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::(), 8usize, concat!( "Size of: ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2) + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2) ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2) + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2) ) ); fn test_field_fence() { assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2, + cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2, >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).fence) as usize - ptr as usize @@ -6120,7 +5914,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2), + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2), "::", stringify!(fence) ) @@ -6131,7 +5925,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2, + cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2, >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize @@ -6139,7 +5933,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2), + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_2), "::", stringify!(reserved) ) @@ -6149,32 +5943,32 @@ fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_3 { +pub struct cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_3 { pub key: ::libc::c_ulonglong, } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_3() { +fn bindgen_test_layout_cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_3() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::(), 8usize, concat!( "Size of: ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_3) + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_3) ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_3) + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_3) ) ); fn test_field_key() { assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_3, + cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_3, >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize @@ -6182,7 +5976,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_3), + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1__bindgen_ty_3), "::", stringify!(key) ) @@ -6191,28 +5985,28 @@ fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ test_field_key(); } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1() { +fn bindgen_test_layout_cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1() { assert_eq!( - ::std::mem::size_of::(), - 72usize, + ::std::mem::size_of::(), + 24usize, concat!( "Size of: ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1) + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1) ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1) + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1) ) ); fn test_field_fence() { assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams__bindgen_ty_1, + cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1, >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).fence) as usize - ptr as usize @@ -6220,7 +6014,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1() { 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1), + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1), "::", stringify!(fence) ) @@ -6231,7 +6025,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1() { assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams__bindgen_ty_1, + cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1, >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).nvSciSync) as usize - ptr as usize @@ -6239,7 +6033,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1() { 8usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1), + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1), "::", stringify!(nvSciSync) ) @@ -6250,7 +6044,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1() { assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams__bindgen_ty_1, + cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1, >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).keyedMutex) as usize - ptr as usize @@ -6258,59 +6052,44 @@ fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1() { 16usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1), + stringify!(cudaExternalSemaphoreSignalParams_v1__bindgen_ty_1), "::", stringify!(keyedMutex) ) ); } test_field_keyedMutex(); - fn test_field_reserved() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreSignalParams__bindgen_ty_1, - >::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1), - "::", - stringify!(reserved) - ) - ); - } - test_field_reserved(); } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreSignalParams() { +fn bindgen_test_layout_cudaExternalSemaphoreSignalParams_v1() { assert_eq!( - ::std::mem::size_of::(), - 144usize, - concat!("Size of: ", stringify!(cudaExternalSemaphoreSignalParams)) + ::std::mem::size_of::(), + 32usize, + concat!( + "Size of: ", + stringify!(cudaExternalSemaphoreSignalParams_v1) + ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreSignalParams) + stringify!(cudaExternalSemaphoreSignalParams_v1) ) ); fn test_field_params() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).params) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams), + stringify!(cudaExternalSemaphoreSignalParams_v1), "::", stringify!(params) ) @@ -6320,81 +6099,63 @@ fn bindgen_test_layout_cudaExternalSemaphoreSignalParams() { fn test_field_flags() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, - 72usize, + 24usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams), + stringify!(cudaExternalSemaphoreSignalParams_v1), "::", stringify!(flags) ) ); } test_field_flags(); - fn test_field_reserved() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize - }, - 76usize, - concat!( - "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalParams), - "::", - stringify!(reserved) - ) - ); - } - test_field_reserved(); } #[repr(C)] #[derive(Copy, Clone)] -pub struct cudaExternalSemaphoreWaitParams { - pub params: cudaExternalSemaphoreWaitParams__bindgen_ty_1, +pub struct cudaExternalSemaphoreWaitParams_v1 { + pub params: cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1, pub flags: ::libc::c_uint, - pub reserved: [::libc::c_uint; 16usize], } #[repr(C)] #[derive(Copy, Clone)] -pub struct cudaExternalSemaphoreWaitParams__bindgen_ty_1 { - pub fence: cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_1, - pub nvSciSync: cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2, - pub keyedMutex: cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3, - pub reserved: [::libc::c_uint; 10usize], +pub struct cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1 { + pub fence: cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_1, + pub nvSciSync: cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2, + pub keyedMutex: cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_1 { +pub struct cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_1 { pub value: ::libc::c_ulonglong, } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_1() { +fn bindgen_test_layout_cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_1() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::(), 8usize, concat!( "Size of: ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_1) + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_1) ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_1) + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_1) ) ); fn test_field_value() { assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_1, + cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_1, >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).value) as usize - ptr as usize @@ -6402,7 +6163,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_1), + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_1), "::", stringify!(value) ) @@ -6412,33 +6173,33 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty } #[repr(C)] #[derive(Copy, Clone)] -pub union cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2 { +pub union cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2 { pub fence: *mut ::libc::c_void, pub reserved: ::libc::c_ulonglong, } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2() { +fn bindgen_test_layout_cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::(), 8usize, concat!( "Size of: ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2) + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2) ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2) + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2) ) ); fn test_field_fence() { assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2, + cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2, >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).fence) as usize - ptr as usize @@ -6446,7 +6207,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2), + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2), "::", stringify!(fence) ) @@ -6457,7 +6218,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2, + cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2, >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize @@ -6465,7 +6226,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2), + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_2), "::", stringify!(reserved) ) @@ -6475,33 +6236,33 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3 { +pub struct cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3 { pub key: ::libc::c_ulonglong, pub timeoutMs: ::libc::c_uint, } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3() { +fn bindgen_test_layout_cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3() { assert_eq!( - ::std::mem::size_of::(), + ::std::mem::size_of::(), 16usize, concat!( "Size of: ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3) + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3) ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3) + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3) ) ); fn test_field_key() { assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3, + cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3, >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize @@ -6509,7 +6270,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3), + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3), "::", stringify!(key) ) @@ -6520,7 +6281,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty assert_eq!( unsafe { let uninit = ::std::mem::MaybeUninit::< - cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3, + cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3, >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).timeoutMs) as usize - ptr as usize @@ -6528,7 +6289,7 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty 8usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3), + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1__bindgen_ty_3), "::", stringify!(timeoutMs) ) @@ -6537,34 +6298,36 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty test_field_timeoutMs(); } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1() { +fn bindgen_test_layout_cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1() { assert_eq!( - ::std::mem::size_of::(), - 72usize, + ::std::mem::size_of::(), + 32usize, concat!( "Size of: ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1) + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1) ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1) + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1) ) ); fn test_field_fence() { assert_eq!( unsafe { - let uninit = :: std :: mem :: MaybeUninit :: < cudaExternalSemaphoreWaitParams__bindgen_ty_1 > :: uninit () ; + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1, + >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).fence) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1), + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1), "::", stringify!(fence) ) @@ -6574,14 +6337,16 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1() { fn test_field_nvSciSync() { assert_eq!( unsafe { - let uninit = :: std :: mem :: MaybeUninit :: < cudaExternalSemaphoreWaitParams__bindgen_ty_1 > :: uninit () ; + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1, + >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).nvSciSync) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1), + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1), "::", stringify!(nvSciSync) ) @@ -6591,61 +6356,50 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1() { fn test_field_keyedMutex() { assert_eq!( unsafe { - let uninit = :: std :: mem :: MaybeUninit :: < cudaExternalSemaphoreWaitParams__bindgen_ty_1 > :: uninit () ; + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1, + >::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).keyedMutex) as usize - ptr as usize }, 16usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1), + stringify!(cudaExternalSemaphoreWaitParams_v1__bindgen_ty_1), "::", stringify!(keyedMutex) ) ); } test_field_keyedMutex(); - fn test_field_reserved() { - assert_eq!( - unsafe { - let uninit = :: std :: mem :: MaybeUninit :: < cudaExternalSemaphoreWaitParams__bindgen_ty_1 > :: uninit () ; - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1), - "::", - stringify!(reserved) - ) - ); - } - test_field_reserved(); } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreWaitParams() { +fn bindgen_test_layout_cudaExternalSemaphoreWaitParams_v1() { assert_eq!( - ::std::mem::size_of::(), - 144usize, - concat!("Size of: ", stringify!(cudaExternalSemaphoreWaitParams)) + ::std::mem::size_of::(), + 40usize, + concat!("Size of: ", stringify!(cudaExternalSemaphoreWaitParams_v1)) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(cudaExternalSemaphoreWaitParams)) + concat!( + "Alignment of ", + stringify!(cudaExternalSemaphoreWaitParams_v1) + ) ); fn test_field_params() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).params) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams), + stringify!(cudaExternalSemaphoreWaitParams_v1), "::", stringify!(params) ) @@ -6655,63 +6409,707 @@ fn bindgen_test_layout_cudaExternalSemaphoreWaitParams() { fn test_field_flags() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, - 72usize, + 32usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams), + stringify!(cudaExternalSemaphoreWaitParams_v1), "::", stringify!(flags) ) ); } test_field_flags(); - fn test_field_reserved() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize - }, - 76usize, - concat!( - "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitParams), - "::", - stringify!(reserved) - ) - ); - } - test_field_reserved(); -} -pub use self::cudaError as cudaError_t; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct CUstream_st { - _unused: [u8; 0], } -pub type cudaStream_t = *mut CUstream_st; #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct CUevent_st { - _unused: [u8; 0], +#[derive(Copy, Clone)] +pub struct cudaExternalSemaphoreSignalParams { + pub params: cudaExternalSemaphoreSignalParams__bindgen_ty_1, + pub flags: ::libc::c_uint, + pub reserved: [::libc::c_uint; 16usize], } -pub type cudaEvent_t = *mut CUevent_st; -pub type cudaGraphicsResource_t = *mut cudaGraphicsResource; -pub use self::cudaOutputMode as cudaOutputMode_t; #[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct CUexternalMemory_st { - _unused: [u8; 0], +#[derive(Copy, Clone)] +pub struct cudaExternalSemaphoreSignalParams__bindgen_ty_1 { + pub fence: cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_1, + pub nvSciSync: cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2, + pub keyedMutex: cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_3, + pub reserved: [::libc::c_uint; 12usize], } -pub type cudaExternalMemory_t = *mut CUexternalMemory_st; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct CUexternalSemaphore_st { - _unused: [u8; 0], +pub struct cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_1 { + pub value: ::libc::c_ulonglong, +} +#[test] +fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!( + "Size of: ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_1) + ) + ); + fn test_field_value() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_1, + >::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).value) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(value) + ) + ); + } + test_field_value(); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2 { + pub fence: *mut ::libc::c_void, + pub reserved: ::libc::c_ulonglong, +} +#[test] +fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!( + "Size of: ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2) + ) + ); + fn test_field_fence() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2, + >::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).fence) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(fence) + ) + ); + } + test_field_fence(); + fn test_field_reserved() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2, + >::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(reserved) + ) + ); + } + test_field_reserved(); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_3 { + pub key: ::libc::c_ulonglong, +} +#[test] +fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_3() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!( + "Size of: ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_3) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_3) + ) + ); + fn test_field_key() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_3, + >::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(key) + ) + ); + } + test_field_key(); +} +#[test] +fn bindgen_test_layout_cudaExternalSemaphoreSignalParams__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!( + "Size of: ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1) + ) + ); + fn test_field_fence() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreSignalParams__bindgen_ty_1, + >::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).fence) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1), + "::", + stringify!(fence) + ) + ); + } + test_field_fence(); + fn test_field_nvSciSync() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreSignalParams__bindgen_ty_1, + >::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).nvSciSync) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1), + "::", + stringify!(nvSciSync) + ) + ); + } + test_field_nvSciSync(); + fn test_field_keyedMutex() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreSignalParams__bindgen_ty_1, + >::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).keyedMutex) as usize - ptr as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1), + "::", + stringify!(keyedMutex) + ) + ); + } + test_field_keyedMutex(); + fn test_field_reserved() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreSignalParams__bindgen_ty_1, + >::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize + }, + 24usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreSignalParams__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); + } + test_field_reserved(); +} +#[test] +fn bindgen_test_layout_cudaExternalSemaphoreSignalParams() { + assert_eq!( + ::std::mem::size_of::(), + 144usize, + concat!("Size of: ", stringify!(cudaExternalSemaphoreSignalParams)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(cudaExternalSemaphoreSignalParams) + ) + ); + fn test_field_params() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).params) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreSignalParams), + "::", + stringify!(params) + ) + ); + } + test_field_params(); + fn test_field_flags() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreSignalParams), + "::", + stringify!(flags) + ) + ); + } + test_field_flags(); + fn test_field_reserved() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize + }, + 76usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreSignalParams), + "::", + stringify!(reserved) + ) + ); + } + test_field_reserved(); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct cudaExternalSemaphoreWaitParams { + pub params: cudaExternalSemaphoreWaitParams__bindgen_ty_1, + pub flags: ::libc::c_uint, + pub reserved: [::libc::c_uint; 16usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct cudaExternalSemaphoreWaitParams__bindgen_ty_1 { + pub fence: cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_1, + pub nvSciSync: cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2, + pub keyedMutex: cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3, + pub reserved: [::libc::c_uint; 10usize], +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_1 { + pub value: ::libc::c_ulonglong, +} +#[test] +fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!( + "Size of: ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_1) + ) + ); + fn test_field_value() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_1, + >::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).value) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_1), + "::", + stringify!(value) + ) + ); + } + test_field_value(); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2 { + pub fence: *mut ::libc::c_void, + pub reserved: ::libc::c_ulonglong, +} +#[test] +fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 8usize, + concat!( + "Size of: ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2) + ) + ); + fn test_field_fence() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2, + >::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).fence) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(fence) + ) + ); + } + test_field_fence(); + fn test_field_reserved() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2, + >::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_2), + "::", + stringify!(reserved) + ) + ); + } + test_field_reserved(); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3 { + pub key: ::libc::c_ulonglong, + pub timeoutMs: ::libc::c_uint, +} +#[test] +fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3) + ) + ); + fn test_field_key() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3, + >::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).key) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(key) + ) + ); + } + test_field_key(); + fn test_field_timeoutMs() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::< + cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3, + >::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).timeoutMs) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1__bindgen_ty_3), + "::", + stringify!(timeoutMs) + ) + ); + } + test_field_timeoutMs(); +} +#[test] +fn bindgen_test_layout_cudaExternalSemaphoreWaitParams__bindgen_ty_1() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!( + "Size of: ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1) + ) + ); + fn test_field_fence() { + assert_eq!( + unsafe { + let uninit = :: std :: mem :: MaybeUninit :: < cudaExternalSemaphoreWaitParams__bindgen_ty_1 > :: uninit () ; + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).fence) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1), + "::", + stringify!(fence) + ) + ); + } + test_field_fence(); + fn test_field_nvSciSync() { + assert_eq!( + unsafe { + let uninit = :: std :: mem :: MaybeUninit :: < cudaExternalSemaphoreWaitParams__bindgen_ty_1 > :: uninit () ; + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).nvSciSync) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1), + "::", + stringify!(nvSciSync) + ) + ); + } + test_field_nvSciSync(); + fn test_field_keyedMutex() { + assert_eq!( + unsafe { + let uninit = :: std :: mem :: MaybeUninit :: < cudaExternalSemaphoreWaitParams__bindgen_ty_1 > :: uninit () ; + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).keyedMutex) as usize - ptr as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1), + "::", + stringify!(keyedMutex) + ) + ); + } + test_field_keyedMutex(); + fn test_field_reserved() { + assert_eq!( + unsafe { + let uninit = :: std :: mem :: MaybeUninit :: < cudaExternalSemaphoreWaitParams__bindgen_ty_1 > :: uninit () ; + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitParams__bindgen_ty_1), + "::", + stringify!(reserved) + ) + ); + } + test_field_reserved(); +} +#[test] +fn bindgen_test_layout_cudaExternalSemaphoreWaitParams() { + assert_eq!( + ::std::mem::size_of::(), + 144usize, + concat!("Size of: ", stringify!(cudaExternalSemaphoreWaitParams)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(cudaExternalSemaphoreWaitParams)) + ); + fn test_field_params() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).params) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitParams), + "::", + stringify!(params) + ) + ); + } + test_field_params(); + fn test_field_flags() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize + }, + 72usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitParams), + "::", + stringify!(flags) + ) + ); + } + test_field_flags(); + fn test_field_reserved() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).reserved) as usize - ptr as usize + }, + 76usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitParams), + "::", + stringify!(reserved) + ) + ); + } + test_field_reserved(); +} +pub use self::cudaError as cudaError_t; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CUstream_st { + _unused: [u8; 0], +} +pub type cudaStream_t = *mut CUstream_st; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CUevent_st { + _unused: [u8; 0], +} +pub type cudaEvent_t = *mut CUevent_st; +pub type cudaGraphicsResource_t = *mut cudaGraphicsResource; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CUexternalMemory_st { + _unused: [u8; 0], +} +pub type cudaExternalMemory_t = *mut CUexternalMemory_st; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CUexternalSemaphore_st { + _unused: [u8; 0], } pub type cudaExternalSemaphore_t = *mut CUexternalSemaphore_st; #[repr(C)] @@ -6719,959 +7117,1389 @@ pub type cudaExternalSemaphore_t = *mut CUexternalSemaphore_st; pub struct CUgraph_st { _unused: [u8; 0], } -pub type cudaGraph_t = *mut CUgraph_st; +pub type cudaGraph_t = *mut CUgraph_st; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CUgraphNode_st { + _unused: [u8; 0], +} +pub type cudaGraphNode_t = *mut CUgraphNode_st; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CUuserObject_st { + _unused: [u8; 0], +} +pub type cudaUserObject_t = *mut CUuserObject_st; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CUfunc_st { + _unused: [u8; 0], +} +pub type cudaFunction_t = *mut CUfunc_st; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct CUmemPoolHandle_st { + _unused: [u8; 0], +} +pub type cudaMemPool_t = *mut CUmemPoolHandle_st; +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaCGScope { + cudaCGScopeInvalid = 0, + cudaCGScopeGrid = 1, + cudaCGScopeMultiGrid = 2, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cudaLaunchParams { + pub func: *mut ::libc::c_void, + pub gridDim: dim3, + pub blockDim: dim3, + pub args: *mut *mut ::libc::c_void, + pub sharedMem: usize, + pub stream: cudaStream_t, +} +#[test] +fn bindgen_test_layout_cudaLaunchParams() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(cudaLaunchParams)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(cudaLaunchParams)) + ); + fn test_field_func() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).func) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaLaunchParams), + "::", + stringify!(func) + ) + ); + } + test_field_func(); + fn test_field_gridDim() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).gridDim) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cudaLaunchParams), + "::", + stringify!(gridDim) + ) + ); + } + test_field_gridDim(); + fn test_field_blockDim() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).blockDim) as usize - ptr as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(cudaLaunchParams), + "::", + stringify!(blockDim) + ) + ); + } + test_field_blockDim(); + fn test_field_args() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).args) as usize - ptr as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(cudaLaunchParams), + "::", + stringify!(args) + ) + ); + } + test_field_args(); + fn test_field_sharedMem() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).sharedMem) as usize - ptr as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(cudaLaunchParams), + "::", + stringify!(sharedMem) + ) + ); + } + test_field_sharedMem(); + fn test_field_stream() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).stream) as usize - ptr as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(cudaLaunchParams), + "::", + stringify!(stream) + ) + ); + } + test_field_stream(); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cudaKernelNodeParams { + pub func: *mut ::libc::c_void, + pub gridDim: dim3, + pub blockDim: dim3, + pub sharedMemBytes: ::libc::c_uint, + pub kernelParams: *mut *mut ::libc::c_void, + pub extra: *mut *mut ::libc::c_void, +} +#[test] +fn bindgen_test_layout_cudaKernelNodeParams() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(cudaKernelNodeParams)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(cudaKernelNodeParams)) + ); + fn test_field_func() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).func) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaKernelNodeParams), + "::", + stringify!(func) + ) + ); + } + test_field_func(); + fn test_field_gridDim() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).gridDim) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cudaKernelNodeParams), + "::", + stringify!(gridDim) + ) + ); + } + test_field_gridDim(); + fn test_field_blockDim() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).blockDim) as usize - ptr as usize + }, + 20usize, + concat!( + "Offset of field: ", + stringify!(cudaKernelNodeParams), + "::", + stringify!(blockDim) + ) + ); + } + test_field_blockDim(); + fn test_field_sharedMemBytes() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).sharedMemBytes) as usize - ptr as usize + }, + 32usize, + concat!( + "Offset of field: ", + stringify!(cudaKernelNodeParams), + "::", + stringify!(sharedMemBytes) + ) + ); + } + test_field_sharedMemBytes(); + fn test_field_kernelParams() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).kernelParams) as usize - ptr as usize + }, + 40usize, + concat!( + "Offset of field: ", + stringify!(cudaKernelNodeParams), + "::", + stringify!(kernelParams) + ) + ); + } + test_field_kernelParams(); + fn test_field_extra() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).extra) as usize - ptr as usize + }, + 48usize, + concat!( + "Offset of field: ", + stringify!(cudaKernelNodeParams), + "::", + stringify!(extra) + ) + ); + } + test_field_extra(); +} #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct CUgraphNode_st { - _unused: [u8; 0], +pub struct cudaExternalSemaphoreSignalNodeParams { + pub extSemArray: *mut cudaExternalSemaphore_t, + pub paramsArray: *const cudaExternalSemaphoreSignalParams, + pub numExtSems: ::libc::c_uint, } -pub type cudaGraphNode_t = *mut CUgraphNode_st; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct CUuserObject_st { - _unused: [u8; 0], +#[test] +fn bindgen_test_layout_cudaExternalSemaphoreSignalNodeParams() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!( + "Size of: ", + stringify!(cudaExternalSemaphoreSignalNodeParams) + ) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(cudaExternalSemaphoreSignalNodeParams) + ) + ); + fn test_field_extSemArray() { + assert_eq!( + unsafe { + let uninit = + ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).extSemArray) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreSignalNodeParams), + "::", + stringify!(extSemArray) + ) + ); + } + test_field_extSemArray(); + fn test_field_paramsArray() { + assert_eq!( + unsafe { + let uninit = + ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).paramsArray) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreSignalNodeParams), + "::", + stringify!(paramsArray) + ) + ); + } + test_field_paramsArray(); + fn test_field_numExtSems() { + assert_eq!( + unsafe { + let uninit = + ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).numExtSems) as usize - ptr as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreSignalNodeParams), + "::", + stringify!(numExtSems) + ) + ); + } + test_field_numExtSems(); } -pub type cudaUserObject_t = *mut CUuserObject_st; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct CUfunc_st { - _unused: [u8; 0], +pub struct cudaExternalSemaphoreWaitNodeParams { + pub extSemArray: *mut cudaExternalSemaphore_t, + pub paramsArray: *const cudaExternalSemaphoreWaitParams, + pub numExtSems: ::libc::c_uint, +} +#[test] +fn bindgen_test_layout_cudaExternalSemaphoreWaitNodeParams() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(cudaExternalSemaphoreWaitNodeParams)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!( + "Alignment of ", + stringify!(cudaExternalSemaphoreWaitNodeParams) + ) + ); + fn test_field_extSemArray() { + assert_eq!( + unsafe { + let uninit = + ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).extSemArray) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitNodeParams), + "::", + stringify!(extSemArray) + ) + ); + } + test_field_extSemArray(); + fn test_field_paramsArray() { + assert_eq!( + unsafe { + let uninit = + ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).paramsArray) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitNodeParams), + "::", + stringify!(paramsArray) + ) + ); + } + test_field_paramsArray(); + fn test_field_numExtSems() { + assert_eq!( + unsafe { + let uninit = + ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).numExtSems) as usize - ptr as usize + }, + 16usize, + concat!( + "Offset of field: ", + stringify!(cudaExternalSemaphoreWaitNodeParams), + "::", + stringify!(numExtSems) + ) + ); + } + test_field_numExtSems(); +} +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaGraphNodeType { + cudaGraphNodeTypeKernel = 0, + cudaGraphNodeTypeMemcpy = 1, + cudaGraphNodeTypeMemset = 2, + cudaGraphNodeTypeHost = 3, + cudaGraphNodeTypeGraph = 4, + cudaGraphNodeTypeEmpty = 5, + cudaGraphNodeTypeWaitEvent = 6, + cudaGraphNodeTypeEventRecord = 7, + cudaGraphNodeTypeExtSemaphoreSignal = 8, + cudaGraphNodeTypeExtSemaphoreWait = 9, + cudaGraphNodeTypeMemAlloc = 10, + cudaGraphNodeTypeMemFree = 11, + cudaGraphNodeTypeCount = 12, } -pub type cudaFunction_t = *mut CUfunc_st; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct CUmemPoolHandle_st { +pub struct CUgraphExec_st { _unused: [u8; 0], } -pub type cudaMemPool_t = *mut CUmemPoolHandle_st; +pub type cudaGraphExec_t = *mut CUgraphExec_st; #[repr(u32)] #[non_exhaustive] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaCGScope { - cudaCGScopeInvalid = 0, - cudaCGScopeGrid = 1, - cudaCGScopeMultiGrid = 2, +pub enum cudaGraphExecUpdateResult { + cudaGraphExecUpdateSuccess = 0, + cudaGraphExecUpdateError = 1, + cudaGraphExecUpdateErrorTopologyChanged = 2, + cudaGraphExecUpdateErrorNodeTypeChanged = 3, + cudaGraphExecUpdateErrorFunctionChanged = 4, + cudaGraphExecUpdateErrorParametersChanged = 5, + cudaGraphExecUpdateErrorNotSupported = 6, + cudaGraphExecUpdateErrorUnsupportedFunctionChange = 7, + cudaGraphExecUpdateErrorAttributesChanged = 8, +} +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaGraphInstantiateResult { + cudaGraphInstantiateSuccess = 0, + cudaGraphInstantiateError = 1, + cudaGraphInstantiateInvalidStructure = 2, + cudaGraphInstantiateNodeOperationNotSupported = 3, + cudaGraphInstantiateMultipleDevicesNotSupported = 4, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct cudaLaunchParams { - pub func: *mut ::libc::c_void, - pub gridDim: dim3, - pub blockDim: dim3, - pub args: *mut *mut ::libc::c_void, - pub sharedMem: usize, - pub stream: cudaStream_t, +pub struct cudaGraphInstantiateParams_st { + pub flags: ::libc::c_ulonglong, + pub uploadStream: cudaStream_t, + pub errNode_out: cudaGraphNode_t, + pub result_out: cudaGraphInstantiateResult, } #[test] -fn bindgen_test_layout_cudaLaunchParams() { +fn bindgen_test_layout_cudaGraphInstantiateParams_st() { assert_eq!( - ::std::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(cudaLaunchParams)) + ::std::mem::size_of::(), + 32usize, + concat!("Size of: ", stringify!(cudaGraphInstantiateParams_st)) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(cudaLaunchParams)) + concat!("Alignment of ", stringify!(cudaGraphInstantiateParams_st)) ); - fn test_field_func() { + fn test_field_flags() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).func) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaLaunchParams), + stringify!(cudaGraphInstantiateParams_st), "::", - stringify!(func) + stringify!(flags) ) ); } - test_field_func(); - fn test_field_gridDim() { + test_field_flags(); + fn test_field_uploadStream() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).gridDim) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).uploadStream) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", - stringify!(cudaLaunchParams), - "::", - stringify!(gridDim) - ) - ); - } - test_field_gridDim(); - fn test_field_blockDim() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).blockDim) as usize - ptr as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(cudaLaunchParams), - "::", - stringify!(blockDim) - ) - ); - } - test_field_blockDim(); - fn test_field_args() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).args) as usize - ptr as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(cudaLaunchParams), + stringify!(cudaGraphInstantiateParams_st), "::", - stringify!(args) + stringify!(uploadStream) ) ); } - test_field_args(); - fn test_field_sharedMem() { + test_field_uploadStream(); + fn test_field_errNode_out() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).sharedMem) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).errNode_out) as usize - ptr as usize }, - 40usize, + 16usize, concat!( "Offset of field: ", - stringify!(cudaLaunchParams), + stringify!(cudaGraphInstantiateParams_st), "::", - stringify!(sharedMem) + stringify!(errNode_out) ) ); } - test_field_sharedMem(); - fn test_field_stream() { + test_field_errNode_out(); + fn test_field_result_out() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).stream) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).result_out) as usize - ptr as usize }, - 48usize, + 24usize, concat!( "Offset of field: ", - stringify!(cudaLaunchParams), + stringify!(cudaGraphInstantiateParams_st), "::", - stringify!(stream) + stringify!(result_out) ) ); } - test_field_stream(); + test_field_result_out(); } +pub type cudaGraphInstantiateParams = cudaGraphInstantiateParams_st; #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct cudaKernelNodeParams { - pub func: *mut ::libc::c_void, - pub gridDim: dim3, - pub blockDim: dim3, - pub sharedMemBytes: ::libc::c_uint, - pub kernelParams: *mut *mut ::libc::c_void, - pub extra: *mut *mut ::libc::c_void, +pub struct cudaGraphExecUpdateResultInfo_st { + pub result: cudaGraphExecUpdateResult, + pub errorNode: cudaGraphNode_t, + pub errorFromNode: cudaGraphNode_t, } #[test] -fn bindgen_test_layout_cudaKernelNodeParams() { +fn bindgen_test_layout_cudaGraphExecUpdateResultInfo_st() { assert_eq!( - ::std::mem::size_of::(), - 56usize, - concat!("Size of: ", stringify!(cudaKernelNodeParams)) + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(cudaGraphExecUpdateResultInfo_st)) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(cudaKernelNodeParams)) + concat!( + "Alignment of ", + stringify!(cudaGraphExecUpdateResultInfo_st) + ) ); - fn test_field_func() { + fn test_field_result() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).func) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).result) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaKernelNodeParams), + stringify!(cudaGraphExecUpdateResultInfo_st), "::", - stringify!(func) + stringify!(result) ) ); } - test_field_func(); - fn test_field_gridDim() { + test_field_result(); + fn test_field_errorNode() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).gridDim) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).errorNode) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", - stringify!(cudaKernelNodeParams), - "::", - stringify!(gridDim) - ) - ); - } - test_field_gridDim(); - fn test_field_blockDim() { - assert_eq!( - unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); - let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).blockDim) as usize - ptr as usize - }, - 20usize, - concat!( - "Offset of field: ", - stringify!(cudaKernelNodeParams), + stringify!(cudaGraphExecUpdateResultInfo_st), "::", - stringify!(blockDim) + stringify!(errorNode) ) ); } - test_field_blockDim(); - fn test_field_sharedMemBytes() { + test_field_errorNode(); + fn test_field_errorFromNode() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).sharedMemBytes) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).errorFromNode) as usize - ptr as usize }, - 32usize, + 16usize, concat!( "Offset of field: ", - stringify!(cudaKernelNodeParams), + stringify!(cudaGraphExecUpdateResultInfo_st), "::", - stringify!(sharedMemBytes) + stringify!(errorFromNode) ) ); } - test_field_sharedMemBytes(); - fn test_field_kernelParams() { + test_field_errorFromNode(); +} +pub type cudaGraphExecUpdateResultInfo = cudaGraphExecUpdateResultInfo_st; +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaGetDriverEntryPointFlags { + cudaEnableDefault = 0, + cudaEnableLegacyStream = 1, + cudaEnablePerThreadDefaultStream = 2, +} +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaDriverEntryPointQueryResult { + cudaDriverEntryPointSuccess = 0, + cudaDriverEntryPointSymbolNotFound = 1, + cudaDriverEntryPointVersionNotSufficent = 2, +} +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaGraphDebugDotFlags { + cudaGraphDebugDotFlagsVerbose = 1, + cudaGraphDebugDotFlagsKernelNodeParams = 4, + cudaGraphDebugDotFlagsMemcpyNodeParams = 8, + cudaGraphDebugDotFlagsMemsetNodeParams = 16, + cudaGraphDebugDotFlagsHostNodeParams = 32, + cudaGraphDebugDotFlagsEventNodeParams = 64, + cudaGraphDebugDotFlagsExtSemasSignalNodeParams = 128, + cudaGraphDebugDotFlagsExtSemasWaitNodeParams = 256, + cudaGraphDebugDotFlagsKernelNodeAttributes = 512, + cudaGraphDebugDotFlagsHandles = 1024, +} +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaGraphInstantiateFlags { + cudaGraphInstantiateFlagAutoFreeOnLaunch = 1, + cudaGraphInstantiateFlagUpload = 2, + cudaGraphInstantiateFlagDeviceLaunch = 4, + cudaGraphInstantiateFlagUseNodePriority = 8, +} +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaLaunchMemSyncDomain { + cudaLaunchMemSyncDomainDefault = 0, + cudaLaunchMemSyncDomainRemote = 1, +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cudaLaunchMemSyncDomainMap_st { + pub default_: ::libc::c_uchar, + pub remote: ::libc::c_uchar, +} +#[test] +fn bindgen_test_layout_cudaLaunchMemSyncDomainMap_st() { + assert_eq!( + ::std::mem::size_of::(), + 2usize, + concat!("Size of: ", stringify!(cudaLaunchMemSyncDomainMap_st)) + ); + assert_eq!( + ::std::mem::align_of::(), + 1usize, + concat!("Alignment of ", stringify!(cudaLaunchMemSyncDomainMap_st)) + ); + fn test_field_default_() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).kernelParams) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).default_) as usize - ptr as usize }, - 40usize, + 0usize, concat!( "Offset of field: ", - stringify!(cudaKernelNodeParams), + stringify!(cudaLaunchMemSyncDomainMap_st), "::", - stringify!(kernelParams) + stringify!(default_) ) ); } - test_field_kernelParams(); - fn test_field_extra() { + test_field_default_(); + fn test_field_remote() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).extra) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).remote) as usize - ptr as usize }, - 48usize, + 1usize, concat!( "Offset of field: ", - stringify!(cudaKernelNodeParams), + stringify!(cudaLaunchMemSyncDomainMap_st), "::", - stringify!(extra) + stringify!(remote) ) ); } - test_field_extra(); + test_field_remote(); +} +pub type cudaLaunchMemSyncDomainMap = cudaLaunchMemSyncDomainMap_st; +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaLaunchAttributeID { + cudaLaunchAttributeIgnore = 0, + cudaLaunchAttributeAccessPolicyWindow = 1, + cudaLaunchAttributeCooperative = 2, + cudaLaunchAttributeSynchronizationPolicy = 3, + cudaLaunchAttributeClusterDimension = 4, + cudaLaunchAttributeClusterSchedulingPolicyPreference = 5, + cudaLaunchAttributeProgrammaticStreamSerialization = 6, + cudaLaunchAttributeProgrammaticEvent = 7, + cudaLaunchAttributePriority = 8, + cudaLaunchAttributeMemSyncDomainMap = 9, + cudaLaunchAttributeMemSyncDomain = 10, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union cudaLaunchAttributeValue { + pub pad: [::libc::c_char; 64usize], + pub accessPolicyWindow: cudaAccessPolicyWindow, + pub cooperative: ::libc::c_int, + pub syncPolicy: cudaSynchronizationPolicy, + pub clusterDim: cudaLaunchAttributeValue__bindgen_ty_1, + pub clusterSchedulingPolicyPreference: cudaClusterSchedulingPolicy, + pub programmaticStreamSerializationAllowed: ::libc::c_int, + pub programmaticEvent: cudaLaunchAttributeValue__bindgen_ty_2, + pub priority: ::libc::c_int, + pub memSyncDomainMap: cudaLaunchMemSyncDomainMap, + pub memSyncDomain: cudaLaunchMemSyncDomain, } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct cudaExternalSemaphoreSignalNodeParams { - pub extSemArray: *mut cudaExternalSemaphore_t, - pub paramsArray: *const cudaExternalSemaphoreSignalParams, - pub numExtSems: ::libc::c_uint, +pub struct cudaLaunchAttributeValue__bindgen_ty_1 { + pub x: ::libc::c_uint, + pub y: ::libc::c_uint, + pub z: ::libc::c_uint, } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreSignalNodeParams() { +fn bindgen_test_layout_cudaLaunchAttributeValue__bindgen_ty_1() { assert_eq!( - ::std::mem::size_of::(), - 24usize, + ::std::mem::size_of::(), + 12usize, concat!( "Size of: ", - stringify!(cudaExternalSemaphoreSignalNodeParams) + stringify!(cudaLaunchAttributeValue__bindgen_ty_1) ) ); assert_eq!( - ::std::mem::align_of::(), - 8usize, + ::std::mem::align_of::(), + 4usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreSignalNodeParams) + stringify!(cudaLaunchAttributeValue__bindgen_ty_1) ) ); - fn test_field_extSemArray() { + fn test_field_x() { assert_eq!( unsafe { let uninit = - ::std::mem::MaybeUninit::::uninit(); + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).extSemArray) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).x) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalNodeParams), + stringify!(cudaLaunchAttributeValue__bindgen_ty_1), "::", - stringify!(extSemArray) + stringify!(x) ) ); } - test_field_extSemArray(); - fn test_field_paramsArray() { + test_field_x(); + fn test_field_y() { assert_eq!( unsafe { let uninit = - ::std::mem::MaybeUninit::::uninit(); + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).paramsArray) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).y) as usize - ptr as usize }, - 8usize, + 4usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalNodeParams), + stringify!(cudaLaunchAttributeValue__bindgen_ty_1), "::", - stringify!(paramsArray) + stringify!(y) ) ); } - test_field_paramsArray(); - fn test_field_numExtSems() { + test_field_y(); + fn test_field_z() { assert_eq!( unsafe { let uninit = - ::std::mem::MaybeUninit::::uninit(); + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).numExtSems) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).z) as usize - ptr as usize }, - 16usize, + 8usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreSignalNodeParams), + stringify!(cudaLaunchAttributeValue__bindgen_ty_1), "::", - stringify!(numExtSems) + stringify!(z) ) ); } - test_field_numExtSems(); + test_field_z(); } #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct cudaExternalSemaphoreWaitNodeParams { - pub extSemArray: *mut cudaExternalSemaphore_t, - pub paramsArray: *const cudaExternalSemaphoreWaitParams, - pub numExtSems: ::libc::c_uint, +pub struct cudaLaunchAttributeValue__bindgen_ty_2 { + pub event: cudaEvent_t, + pub flags: ::libc::c_int, + pub triggerAtBlockStart: ::libc::c_int, } #[test] -fn bindgen_test_layout_cudaExternalSemaphoreWaitNodeParams() { - assert_eq!( - ::std::mem::size_of::(), - 24usize, - concat!("Size of: ", stringify!(cudaExternalSemaphoreWaitNodeParams)) +fn bindgen_test_layout_cudaLaunchAttributeValue__bindgen_ty_2() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!( + "Size of: ", + stringify!(cudaLaunchAttributeValue__bindgen_ty_2) + ) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, concat!( "Alignment of ", - stringify!(cudaExternalSemaphoreWaitNodeParams) + stringify!(cudaLaunchAttributeValue__bindgen_ty_2) ) ); - fn test_field_extSemArray() { + fn test_field_event() { assert_eq!( unsafe { let uninit = - ::std::mem::MaybeUninit::::uninit(); + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).extSemArray) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).event) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitNodeParams), + stringify!(cudaLaunchAttributeValue__bindgen_ty_2), "::", - stringify!(extSemArray) + stringify!(event) ) ); } - test_field_extSemArray(); - fn test_field_paramsArray() { + test_field_event(); + fn test_field_flags() { assert_eq!( unsafe { let uninit = - ::std::mem::MaybeUninit::::uninit(); + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).paramsArray) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize }, 8usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitNodeParams), + stringify!(cudaLaunchAttributeValue__bindgen_ty_2), "::", - stringify!(paramsArray) + stringify!(flags) ) ); } - test_field_paramsArray(); - fn test_field_numExtSems() { + test_field_flags(); + fn test_field_triggerAtBlockStart() { assert_eq!( unsafe { let uninit = - ::std::mem::MaybeUninit::::uninit(); + ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).numExtSems) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).triggerAtBlockStart) as usize - ptr as usize }, - 16usize, + 12usize, concat!( "Offset of field: ", - stringify!(cudaExternalSemaphoreWaitNodeParams), + stringify!(cudaLaunchAttributeValue__bindgen_ty_2), "::", - stringify!(numExtSems) + stringify!(triggerAtBlockStart) ) ); } - test_field_numExtSems(); -} -#[repr(u32)] -#[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaGraphNodeType { - cudaGraphNodeTypeKernel = 0, - cudaGraphNodeTypeMemcpy = 1, - cudaGraphNodeTypeMemset = 2, - cudaGraphNodeTypeHost = 3, - cudaGraphNodeTypeGraph = 4, - cudaGraphNodeTypeEmpty = 5, - cudaGraphNodeTypeWaitEvent = 6, - cudaGraphNodeTypeEventRecord = 7, - cudaGraphNodeTypeExtSemaphoreSignal = 8, - cudaGraphNodeTypeExtSemaphoreWait = 9, - cudaGraphNodeTypeMemAlloc = 10, - cudaGraphNodeTypeMemFree = 11, - cudaGraphNodeTypeCount = 12, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct CUgraphExec_st { - _unused: [u8; 0], -} -pub type cudaGraphExec_t = *mut CUgraphExec_st; -#[repr(u32)] -#[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaGraphExecUpdateResult { - cudaGraphExecUpdateSuccess = 0, - cudaGraphExecUpdateError = 1, - cudaGraphExecUpdateErrorTopologyChanged = 2, - cudaGraphExecUpdateErrorNodeTypeChanged = 3, - cudaGraphExecUpdateErrorFunctionChanged = 4, - cudaGraphExecUpdateErrorParametersChanged = 5, - cudaGraphExecUpdateErrorNotSupported = 6, - cudaGraphExecUpdateErrorUnsupportedFunctionChange = 7, - cudaGraphExecUpdateErrorAttributesChanged = 8, -} -#[repr(u32)] -#[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaGetDriverEntryPointFlags { - cudaEnableDefault = 0, - cudaEnableLegacyStream = 1, - cudaEnablePerThreadDefaultStream = 2, -} -#[repr(u32)] -#[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaGraphDebugDotFlags { - cudaGraphDebugDotFlagsVerbose = 1, - cudaGraphDebugDotFlagsKernelNodeParams = 4, - cudaGraphDebugDotFlagsMemcpyNodeParams = 8, - cudaGraphDebugDotFlagsMemsetNodeParams = 16, - cudaGraphDebugDotFlagsHostNodeParams = 32, - cudaGraphDebugDotFlagsEventNodeParams = 64, - cudaGraphDebugDotFlagsExtSemasSignalNodeParams = 128, - cudaGraphDebugDotFlagsExtSemasWaitNodeParams = 256, - cudaGraphDebugDotFlagsKernelNodeAttributes = 512, - cudaGraphDebugDotFlagsHandles = 1024, -} -#[repr(u32)] -#[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaGraphInstantiateFlags { - cudaGraphInstantiateFlagAutoFreeOnLaunch = 1, - cudaGraphInstantiateFlagUseNodePriority = 8, -} -#[repr(u32)] -#[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaStreamAttrID { - cudaStreamAttributeAccessPolicyWindow = 1, - cudaStreamAttributeSynchronizationPolicy = 3, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union cudaStreamAttrValue { - pub accessPolicyWindow: cudaAccessPolicyWindow, - pub syncPolicy: cudaSynchronizationPolicy, + test_field_triggerAtBlockStart(); } #[test] -fn bindgen_test_layout_cudaStreamAttrValue() { +fn bindgen_test_layout_cudaLaunchAttributeValue() { assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(cudaStreamAttrValue)) + ::std::mem::size_of::(), + 64usize, + concat!("Size of: ", stringify!(cudaLaunchAttributeValue)) ); assert_eq!( - ::std::mem::align_of::(), + ::std::mem::align_of::(), 8usize, - concat!("Alignment of ", stringify!(cudaStreamAttrValue)) + concat!("Alignment of ", stringify!(cudaLaunchAttributeValue)) ); + fn test_field_pad() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).pad) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaLaunchAttributeValue), + "::", + stringify!(pad) + ) + ); + } + test_field_pad(); fn test_field_accessPolicyWindow() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).accessPolicyWindow) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaStreamAttrValue), + stringify!(cudaLaunchAttributeValue), "::", stringify!(accessPolicyWindow) ) ); } test_field_accessPolicyWindow(); + fn test_field_cooperative() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).cooperative) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudaLaunchAttributeValue), + "::", + stringify!(cooperative) + ) + ); + } + test_field_cooperative(); fn test_field_syncPolicy() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); ::std::ptr::addr_of!((*ptr).syncPolicy) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaStreamAttrValue), + stringify!(cudaLaunchAttributeValue), "::", stringify!(syncPolicy) ) ); } test_field_syncPolicy(); -} -#[repr(u32)] -#[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaKernelNodeAttrID { - cudaKernelNodeAttributeAccessPolicyWindow = 1, - cudaKernelNodeAttributeCooperative = 2, - cudaKernelNodeAttributePriority = 8, -} -#[repr(C)] -#[derive(Copy, Clone)] -pub union cudaKernelNodeAttrValue { - pub accessPolicyWindow: cudaAccessPolicyWindow, - pub cooperative: ::libc::c_int, - pub priority: ::libc::c_int, -} -#[test] -fn bindgen_test_layout_cudaKernelNodeAttrValue() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(cudaKernelNodeAttrValue)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(cudaKernelNodeAttrValue)) - ); - fn test_field_accessPolicyWindow() { + fn test_field_clusterDim() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).accessPolicyWindow) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).clusterDim) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaKernelNodeAttrValue), + stringify!(cudaLaunchAttributeValue), "::", - stringify!(accessPolicyWindow) + stringify!(clusterDim) ) ); } - test_field_accessPolicyWindow(); - fn test_field_cooperative() { + test_field_clusterDim(); + fn test_field_clusterSchedulingPolicyPreference() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).cooperative) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).clusterSchedulingPolicyPreference) as usize + - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaKernelNodeAttrValue), + stringify!(cudaLaunchAttributeValue), "::", - stringify!(cooperative) + stringify!(clusterSchedulingPolicyPreference) ) ); } - test_field_cooperative(); - fn test_field_priority() { + test_field_clusterSchedulingPolicyPreference(); + fn test_field_programmaticStreamSerializationAllowed() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).priority) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).programmaticStreamSerializationAllowed) as usize + - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(cudaKernelNodeAttrValue), + stringify!(cudaLaunchAttributeValue), "::", - stringify!(priority) + stringify!(programmaticStreamSerializationAllowed) ) ); } - test_field_priority(); -} -#[repr(u32)] -#[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaSurfaceBoundaryMode { - cudaBoundaryModeZero = 0, - cudaBoundaryModeClamp = 1, - cudaBoundaryModeTrap = 2, -} -#[repr(u32)] -#[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaSurfaceFormatMode { - cudaFormatModeForced = 0, - cudaFormatModeAuto = 1, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct surfaceReference { - pub channelDesc: cudaChannelFormatDesc, -} -#[test] -fn bindgen_test_layout_surfaceReference() { - assert_eq!( - ::std::mem::size_of::(), - 20usize, - concat!("Size of: ", stringify!(surfaceReference)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(surfaceReference)) - ); - fn test_field_channelDesc() { + test_field_programmaticStreamSerializationAllowed(); + fn test_field_programmaticEvent() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).channelDesc) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).programmaticEvent) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(surfaceReference), + stringify!(cudaLaunchAttributeValue), "::", - stringify!(channelDesc) + stringify!(programmaticEvent) ) ); } - test_field_channelDesc(); -} -pub type cudaSurfaceObject_t = ::libc::c_ulonglong; -#[repr(u32)] -#[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaTextureAddressMode { - cudaAddressModeWrap = 0, - cudaAddressModeClamp = 1, - cudaAddressModeMirror = 2, - cudaAddressModeBorder = 3, -} -#[repr(u32)] -#[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaTextureFilterMode { - cudaFilterModePoint = 0, - cudaFilterModeLinear = 1, -} -#[repr(u32)] -#[non_exhaustive] -#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] -pub enum cudaTextureReadMode { - cudaReadModeElementType = 0, - cudaReadModeNormalizedFloat = 1, -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct textureReference { - pub normalized: ::libc::c_int, - pub filterMode: cudaTextureFilterMode, - pub addressMode: [cudaTextureAddressMode; 3usize], - pub channelDesc: cudaChannelFormatDesc, - pub sRGB: ::libc::c_int, - pub maxAnisotropy: ::libc::c_uint, - pub mipmapFilterMode: cudaTextureFilterMode, - pub mipmapLevelBias: f32, - pub minMipmapLevelClamp: f32, - pub maxMipmapLevelClamp: f32, - pub disableTrilinearOptimization: ::libc::c_int, - pub __cudaReserved: [::libc::c_int; 14usize], -} -#[test] -fn bindgen_test_layout_textureReference() { - assert_eq!( - ::std::mem::size_of::(), - 124usize, - concat!("Size of: ", stringify!(textureReference)) - ); - assert_eq!( - ::std::mem::align_of::(), - 4usize, - concat!("Alignment of ", stringify!(textureReference)) - ); - fn test_field_normalized() { + test_field_programmaticEvent(); + fn test_field_priority() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).normalized) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).priority) as usize - ptr as usize }, 0usize, concat!( "Offset of field: ", - stringify!(textureReference), + stringify!(cudaLaunchAttributeValue), "::", - stringify!(normalized) + stringify!(priority) ) ); } - test_field_normalized(); - fn test_field_filterMode() { + test_field_priority(); + fn test_field_memSyncDomainMap() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).filterMode) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).memSyncDomainMap) as usize - ptr as usize }, - 4usize, + 0usize, concat!( "Offset of field: ", - stringify!(textureReference), + stringify!(cudaLaunchAttributeValue), "::", - stringify!(filterMode) + stringify!(memSyncDomainMap) ) ); } - test_field_filterMode(); - fn test_field_addressMode() { + test_field_memSyncDomainMap(); + fn test_field_memSyncDomain() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).addressMode) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).memSyncDomain) as usize - ptr as usize }, - 8usize, + 0usize, concat!( "Offset of field: ", - stringify!(textureReference), + stringify!(cudaLaunchAttributeValue), "::", - stringify!(addressMode) + stringify!(memSyncDomain) ) ); } - test_field_addressMode(); - fn test_field_channelDesc() { + test_field_memSyncDomain(); +} +#[repr(C)] +#[derive(Copy, Clone)] +pub struct cudaLaunchAttribute_st { + pub id: cudaLaunchAttributeID, + pub pad: [::libc::c_char; 4usize], + pub val: cudaLaunchAttributeValue, +} +#[test] +fn bindgen_test_layout_cudaLaunchAttribute_st() { + assert_eq!( + ::std::mem::size_of::(), + 72usize, + concat!("Size of: ", stringify!(cudaLaunchAttribute_st)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(cudaLaunchAttribute_st)) + ); + fn test_field_id() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).channelDesc) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).id) as usize - ptr as usize }, - 20usize, + 0usize, concat!( "Offset of field: ", - stringify!(textureReference), + stringify!(cudaLaunchAttribute_st), "::", - stringify!(channelDesc) + stringify!(id) ) ); } - test_field_channelDesc(); - fn test_field_sRGB() { + test_field_id(); + fn test_field_pad() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).sRGB) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).pad) as usize - ptr as usize }, - 40usize, + 4usize, concat!( "Offset of field: ", - stringify!(textureReference), + stringify!(cudaLaunchAttribute_st), "::", - stringify!(sRGB) + stringify!(pad) ) ); } - test_field_sRGB(); - fn test_field_maxAnisotropy() { + test_field_pad(); + fn test_field_val() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).maxAnisotropy) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).val) as usize - ptr as usize }, - 44usize, + 8usize, concat!( "Offset of field: ", - stringify!(textureReference), + stringify!(cudaLaunchAttribute_st), "::", - stringify!(maxAnisotropy) + stringify!(val) ) ); } - test_field_maxAnisotropy(); - fn test_field_mipmapFilterMode() { + test_field_val(); +} +pub type cudaLaunchAttribute = cudaLaunchAttribute_st; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cudaLaunchConfig_st { + pub gridDim: dim3, + pub blockDim: dim3, + pub dynamicSmemBytes: usize, + pub stream: cudaStream_t, + pub attrs: *mut cudaLaunchAttribute, + pub numAttrs: ::libc::c_uint, +} +#[test] +fn bindgen_test_layout_cudaLaunchConfig_st() { + assert_eq!( + ::std::mem::size_of::(), + 56usize, + concat!("Size of: ", stringify!(cudaLaunchConfig_st)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(cudaLaunchConfig_st)) + ); + fn test_field_gridDim() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mipmapFilterMode) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).gridDim) as usize - ptr as usize }, - 48usize, + 0usize, concat!( "Offset of field: ", - stringify!(textureReference), + stringify!(cudaLaunchConfig_st), "::", - stringify!(mipmapFilterMode) + stringify!(gridDim) ) ); } - test_field_mipmapFilterMode(); - fn test_field_mipmapLevelBias() { + test_field_gridDim(); + fn test_field_blockDim() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).mipmapLevelBias) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).blockDim) as usize - ptr as usize }, - 52usize, + 12usize, concat!( "Offset of field: ", - stringify!(textureReference), + stringify!(cudaLaunchConfig_st), "::", - stringify!(mipmapLevelBias) + stringify!(blockDim) ) ); } - test_field_mipmapLevelBias(); - fn test_field_minMipmapLevelClamp() { + test_field_blockDim(); + fn test_field_dynamicSmemBytes() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).minMipmapLevelClamp) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).dynamicSmemBytes) as usize - ptr as usize }, - 56usize, + 24usize, concat!( "Offset of field: ", - stringify!(textureReference), + stringify!(cudaLaunchConfig_st), "::", - stringify!(minMipmapLevelClamp) + stringify!(dynamicSmemBytes) ) ); } - test_field_minMipmapLevelClamp(); - fn test_field_maxMipmapLevelClamp() { + test_field_dynamicSmemBytes(); + fn test_field_stream() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).maxMipmapLevelClamp) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).stream) as usize - ptr as usize }, - 60usize, + 32usize, concat!( "Offset of field: ", - stringify!(textureReference), + stringify!(cudaLaunchConfig_st), "::", - stringify!(maxMipmapLevelClamp) + stringify!(stream) ) ); } - test_field_maxMipmapLevelClamp(); - fn test_field_disableTrilinearOptimization() { + test_field_stream(); + fn test_field_attrs() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).disableTrilinearOptimization) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).attrs) as usize - ptr as usize }, - 64usize, + 40usize, concat!( "Offset of field: ", - stringify!(textureReference), + stringify!(cudaLaunchConfig_st), "::", - stringify!(disableTrilinearOptimization) + stringify!(attrs) ) ); } - test_field_disableTrilinearOptimization(); - fn test_field___cudaReserved() { + test_field_attrs(); + fn test_field_numAttrs() { assert_eq!( unsafe { - let uninit = ::std::mem::MaybeUninit::::uninit(); + let uninit = ::std::mem::MaybeUninit::::uninit(); let ptr = uninit.as_ptr(); - ::std::ptr::addr_of!((*ptr).__cudaReserved) as usize - ptr as usize + ::std::ptr::addr_of!((*ptr).numAttrs) as usize - ptr as usize }, - 68usize, + 48usize, concat!( "Offset of field: ", - stringify!(textureReference), + stringify!(cudaLaunchConfig_st), "::", - stringify!(__cudaReserved) + stringify!(numAttrs) ) ); } - test_field___cudaReserved(); + test_field_numAttrs(); +} +pub type cudaLaunchConfig_t = cudaLaunchConfig_st; +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaSurfaceBoundaryMode { + cudaBoundaryModeZero = 0, + cudaBoundaryModeClamp = 1, + cudaBoundaryModeTrap = 2, +} +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaSurfaceFormatMode { + cudaFormatModeForced = 0, + cudaFormatModeAuto = 1, +} +pub type cudaSurfaceObject_t = ::libc::c_ulonglong; +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaTextureAddressMode { + cudaAddressModeWrap = 0, + cudaAddressModeClamp = 1, + cudaAddressModeMirror = 2, + cudaAddressModeBorder = 3, +} +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaTextureFilterMode { + cudaFilterModePoint = 0, + cudaFilterModeLinear = 1, +} +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudaTextureReadMode { + cudaReadModeElementType = 0, + cudaReadModeNormalizedFloat = 1, } #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -7957,6 +8785,8 @@ pub enum cudaDataType_t { CUDA_C_64I = 25, CUDA_R_64U = 26, CUDA_C_64U = 27, + CUDA_R_8F_E4M3 = 28, + CUDA_R_8F_E5M2 = 29, } pub use self::cudaDataType_t as cudaDataType; pub const libraryPropertyType_t_MAJOR_VERSION: libraryPropertyType_t = 0; @@ -8082,8 +8912,10 @@ extern "C" { pub fn cudaGetDeviceCount(count: *mut ::libc::c_int) -> cudaError_t; } extern "C" { - pub fn cudaGetDeviceProperties(prop: *mut cudaDeviceProp, device: ::libc::c_int) - -> cudaError_t; + pub fn cudaGetDeviceProperties_v2( + prop: *mut cudaDeviceProp, + device: ::libc::c_int, + ) -> cudaError_t; } extern "C" { pub fn cudaDeviceGetAttribute( @@ -8123,6 +8955,13 @@ extern "C" { pub fn cudaChooseDevice(device: *mut ::libc::c_int, prop: *const cudaDeviceProp) -> cudaError_t; } +extern "C" { + pub fn cudaInitDevice( + device: ::libc::c_int, + deviceFlags: ::libc::c_uint, + flags: ::libc::c_uint, + ) -> cudaError_t; +} extern "C" { pub fn cudaSetDevice(device: ::libc::c_int) -> cudaError_t; } @@ -8163,6 +9002,12 @@ extern "C" { extern "C" { pub fn cudaStreamGetFlags(hStream: cudaStream_t, flags: *mut ::libc::c_uint) -> cudaError_t; } +extern "C" { + pub fn cudaStreamGetId( + hStream: cudaStream_t, + streamId: *mut ::libc::c_ulonglong, + ) -> cudaError_t; +} extern "C" { pub fn cudaCtxResetPersistingL2Cache() -> cudaError_t; } @@ -8172,15 +9017,15 @@ extern "C" { extern "C" { pub fn cudaStreamGetAttribute( hStream: cudaStream_t, - attr: cudaStreamAttrID, - value_out: *mut cudaStreamAttrValue, + attr: cudaLaunchAttributeID, + value_out: *mut cudaLaunchAttributeValue, ) -> cudaError_t; } extern "C" { pub fn cudaStreamSetAttribute( hStream: cudaStream_t, - attr: cudaStreamAttrID, - value: *const cudaStreamAttrValue, + attr: cudaLaunchAttributeID, + value: *const cudaLaunchAttributeValue, ) -> cudaError_t; } extern "C" { @@ -8234,13 +9079,6 @@ extern "C" { pCaptureStatus: *mut cudaStreamCaptureStatus, ) -> cudaError_t; } -extern "C" { - pub fn cudaStreamGetCaptureInfo( - stream: cudaStream_t, - pCaptureStatus: *mut cudaStreamCaptureStatus, - pId: *mut ::libc::c_ulonglong, - ) -> cudaError_t; -} extern "C" { pub fn cudaStreamGetCaptureInfo_v2( stream: cudaStream_t, @@ -8345,6 +9183,13 @@ extern "C" { stream: cudaStream_t, ) -> cudaError_t; } +extern "C" { + pub fn cudaLaunchKernelExC( + config: *const cudaLaunchConfig_t, + func: *const ::libc::c_void, + args: *mut *mut ::libc::c_void, + ) -> cudaError_t; +} extern "C" { pub fn cudaLaunchCooperativeKernel( func: *const ::libc::c_void, @@ -8425,6 +9270,20 @@ extern "C" { flags: ::libc::c_uint, ) -> cudaError_t; } +extern "C" { + pub fn cudaOccupancyMaxPotentialClusterSize( + clusterSize: *mut ::libc::c_int, + func: *const ::libc::c_void, + launchConfig: *const cudaLaunchConfig_t, + ) -> cudaError_t; +} +extern "C" { + pub fn cudaOccupancyMaxActiveClusters( + numClusters: *mut ::libc::c_int, + func: *const ::libc::c_void, + launchConfig: *const cudaLaunchConfig_t, + ) -> cudaError_t; +} extern "C" { pub fn cudaMallocManaged( devPtr: *mut *mut ::libc::c_void, @@ -9041,68 +9900,6 @@ extern "C" { resource: cudaGraphicsResource_t, ) -> cudaError_t; } -extern "C" { - pub fn cudaBindTexture( - offset: *mut usize, - texref: *const textureReference, - devPtr: *const ::libc::c_void, - desc: *const cudaChannelFormatDesc, - size: usize, - ) -> cudaError_t; -} -extern "C" { - pub fn cudaBindTexture2D( - offset: *mut usize, - texref: *const textureReference, - devPtr: *const ::libc::c_void, - desc: *const cudaChannelFormatDesc, - width: usize, - height: usize, - pitch: usize, - ) -> cudaError_t; -} -extern "C" { - pub fn cudaBindTextureToArray( - texref: *const textureReference, - array: cudaArray_const_t, - desc: *const cudaChannelFormatDesc, - ) -> cudaError_t; -} -extern "C" { - pub fn cudaBindTextureToMipmappedArray( - texref: *const textureReference, - mipmappedArray: cudaMipmappedArray_const_t, - desc: *const cudaChannelFormatDesc, - ) -> cudaError_t; -} -extern "C" { - pub fn cudaUnbindTexture(texref: *const textureReference) -> cudaError_t; -} -extern "C" { - pub fn cudaGetTextureAlignmentOffset( - offset: *mut usize, - texref: *const textureReference, - ) -> cudaError_t; -} -extern "C" { - pub fn cudaGetTextureReference( - texref: *mut *const textureReference, - symbol: *const ::libc::c_void, - ) -> cudaError_t; -} -extern "C" { - pub fn cudaBindSurfaceToArray( - surfref: *const surfaceReference, - array: cudaArray_const_t, - desc: *const cudaChannelFormatDesc, - ) -> cudaError_t; -} -extern "C" { - pub fn cudaGetSurfaceReference( - surfref: *mut *const surfaceReference, - symbol: *const ::libc::c_void, - ) -> cudaError_t; -} extern "C" { pub fn cudaGetChannelDesc( desc: *mut cudaChannelFormatDesc, @@ -9201,15 +9998,15 @@ extern "C" { extern "C" { pub fn cudaGraphKernelNodeGetAttribute( hNode: cudaGraphNode_t, - attr: cudaKernelNodeAttrID, - value_out: *mut cudaKernelNodeAttrValue, + attr: cudaLaunchAttributeID, + value_out: *mut cudaLaunchAttributeValue, ) -> cudaError_t; } extern "C" { pub fn cudaGraphKernelNodeSetAttribute( hNode: cudaGraphNode_t, - attr: cudaKernelNodeAttrID, - value: *const cudaKernelNodeAttrValue, + attr: cudaLaunchAttributeID, + value: *const cudaLaunchAttributeValue, ) -> cudaError_t; } extern "C" { @@ -9570,9 +10367,7 @@ extern "C" { pub fn cudaGraphInstantiate( pGraphExec: *mut cudaGraphExec_t, graph: cudaGraph_t, - pErrorNode: *mut cudaGraphNode_t, - pLogBuffer: *mut ::libc::c_char, - bufferSize: usize, + flags: ::libc::c_ulonglong, ) -> cudaError_t; } extern "C" { @@ -9582,6 +10377,19 @@ extern "C" { flags: ::libc::c_ulonglong, ) -> cudaError_t; } +extern "C" { + pub fn cudaGraphInstantiateWithParams( + pGraphExec: *mut cudaGraphExec_t, + graph: cudaGraph_t, + instantiateParams: *mut cudaGraphInstantiateParams, + ) -> cudaError_t; +} +extern "C" { + pub fn cudaGraphExecGetFlags( + graphExec: cudaGraphExec_t, + flags: *mut ::libc::c_ulonglong, + ) -> cudaError_t; +} extern "C" { pub fn cudaGraphExecKernelNodeSetParams( hGraphExec: cudaGraphExec_t, @@ -9695,8 +10503,7 @@ extern "C" { pub fn cudaGraphExecUpdate( hGraphExec: cudaGraphExec_t, hGraph: cudaGraph_t, - hErrorNode_out: *mut cudaGraphNode_t, - updateResult_out: *mut cudaGraphExecUpdateResult, + resultInfo: *mut cudaGraphExecUpdateResultInfo, ) -> cudaError_t; } extern "C" { @@ -9753,6 +10560,7 @@ extern "C" { symbol: *const ::libc::c_char, funcPtr: *mut *mut ::libc::c_void, flags: ::libc::c_ulonglong, + driverStatus: *mut cudaDriverEntryPointQueryResult, ) -> cudaError_t; } extern "C" { @@ -9779,6 +10587,9 @@ pub type cudnnHandle_t = *mut cudnnContext; extern "C" { pub fn cudnnGetVersion() -> usize; } +extern "C" { + pub fn cudnnGetMaxDeviceVersion() -> usize; +} extern "C" { pub fn cudnnGetCudartVersion() -> usize; } @@ -9918,6 +10729,9 @@ pub enum cudnnDataType_t { CUDNN_DATA_BFLOAT16 = 9, CUDNN_DATA_INT64 = 10, CUDNN_DATA_BOOLEAN = 11, + CUDNN_DATA_FP8_E4M3 = 12, + CUDNN_DATA_FP8_E5M2 = 13, + CUDNN_DATA_FAST_FLOAT_FOR_FP8 = 14, } #[repr(u32)] #[non_exhaustive] @@ -13975,6 +14789,60 @@ extern "C" { pub fn cudnnCnnTrainVersionCheck() -> cudnnStatus_t; } pub type cudnnBackendDescriptor_t = *mut ::libc::c_void; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct cudnnFractionStruct { + pub numerator: i64, + pub denominator: i64, +} +#[test] +fn bindgen_test_layout_cudnnFractionStruct() { + assert_eq!( + ::std::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(cudnnFractionStruct)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(cudnnFractionStruct)) + ); + fn test_field_numerator() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).numerator) as usize - ptr as usize + }, + 0usize, + concat!( + "Offset of field: ", + stringify!(cudnnFractionStruct), + "::", + stringify!(numerator) + ) + ); + } + test_field_numerator(); + fn test_field_denominator() { + assert_eq!( + unsafe { + let uninit = ::std::mem::MaybeUninit::::uninit(); + let ptr = uninit.as_ptr(); + ::std::ptr::addr_of!((*ptr).denominator) as usize - ptr as usize + }, + 8usize, + concat!( + "Offset of field: ", + stringify!(cudnnFractionStruct), + "::", + stringify!(denominator) + ) + ); + } + test_field_denominator(); +} +pub type cudnnFraction_t = cudnnFractionStruct; #[repr(u32)] #[non_exhaustive] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] @@ -13999,6 +14867,8 @@ pub enum cudnnPointwiseMode_t { CUDNN_POINTWISE_SIN = 18, CUDNN_POINTWISE_SQRT = 4, CUDNN_POINTWISE_TAN = 19, + CUDNN_POINTWISE_ERF = 20, + CUDNN_POINTWISE_IDENTITY = 21, CUDNN_POINTWISE_RELU_FWD = 100, CUDNN_POINTWISE_TANH_FWD = 101, CUDNN_POINTWISE_SIGMOID_FWD = 102, @@ -14006,6 +14876,7 @@ pub enum cudnnPointwiseMode_t { CUDNN_POINTWISE_GELU_FWD = 104, CUDNN_POINTWISE_SOFTPLUS_FWD = 105, CUDNN_POINTWISE_SWISH_FWD = 106, + CUDNN_POINTWISE_GELU_APPROX_TANH_FWD = 107, CUDNN_POINTWISE_RELU_BWD = 200, CUDNN_POINTWISE_TANH_BWD = 201, CUDNN_POINTWISE_SIGMOID_BWD = 202, @@ -14013,6 +14884,7 @@ pub enum cudnnPointwiseMode_t { CUDNN_POINTWISE_GELU_BWD = 204, CUDNN_POINTWISE_SOFTPLUS_BWD = 205, CUDNN_POINTWISE_SWISH_BWD = 206, + CUDNN_POINTWISE_GELU_APPROX_TANH_BWD = 207, CUDNN_POINTWISE_CMP_EQ = 300, CUDNN_POINTWISE_CMP_NEQ = 301, CUDNN_POINTWISE_CMP_GT = 302, @@ -14022,6 +14894,12 @@ pub enum cudnnPointwiseMode_t { CUDNN_POINTWISE_LOGICAL_AND = 400, CUDNN_POINTWISE_LOGICAL_OR = 401, CUDNN_POINTWISE_LOGICAL_NOT = 402, + CUDNN_POINTWISE_GEN_INDEX = 501, + CUDNN_POINTWISE_BINARY_SELECT = 601, +} +impl cudnnResampleMode_t { + pub const CUDNN_RESAMPLE_AVGPOOL_INCLUDE_PADDING: cudnnResampleMode_t = + cudnnResampleMode_t::CUDNN_RESAMPLE_AVGPOOL; } #[repr(u32)] #[non_exhaustive] @@ -14030,11 +14908,19 @@ pub enum cudnnResampleMode_t { CUDNN_RESAMPLE_NEAREST = 0, CUDNN_RESAMPLE_BILINEAR = 1, CUDNN_RESAMPLE_AVGPOOL = 2, + CUDNN_RESAMPLE_AVGPOOL_EXCLUDE_PADDING = 4, CUDNN_RESAMPLE_MAXPOOL = 3, } #[repr(u32)] #[non_exhaustive] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudnnSignalMode_t { + CUDNN_SIGNAL_SET = 0, + CUDNN_SIGNAL_WAIT = 1, +} +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum cudnnGenStatsMode_t { CUDNN_GENSTATS_SUM_SQSUM = 0, } @@ -14048,6 +14934,14 @@ pub enum cudnnBnFinalizeStatsMode_t { #[repr(u32)] #[non_exhaustive] #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudnnRngDistribution_t { + CUDNN_RNG_DISTRIBUTION_BERNOULLI = 0, + CUDNN_RNG_DISTRIBUTION_UNIFORM = 1, + CUDNN_RNG_DISTRIBUTION_NORMAL = 2, +} +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub enum cudnnBackendAttributeName_t { CUDNN_ATTR_POINTWISE_MODE = 0, CUDNN_ATTR_POINTWISE_MATH_PREC = 1, @@ -14058,6 +14952,7 @@ pub enum cudnnBackendAttributeName_t { CUDNN_ATTR_POINTWISE_ELU_ALPHA = 6, CUDNN_ATTR_POINTWISE_SOFTPLUS_BETA = 7, CUDNN_ATTR_POINTWISE_SWISH_BETA = 8, + CUDNN_ATTR_POINTWISE_AXIS = 9, CUDNN_ATTR_CONVOLUTION_COMP_TYPE = 100, CUDNN_ATTR_CONVOLUTION_CONV_MODE = 101, CUDNN_ATTR_CONVOLUTION_DILATIONS = 102, @@ -14076,6 +14971,7 @@ pub enum cudnnBackendAttributeName_t { CUDNN_ATTR_EXECUTION_PLAN_WORKSPACE_SIZE = 402, CUDNN_ATTR_EXECUTION_PLAN_COMPUTED_INTERMEDIATE_UIDS = 403, CUDNN_ATTR_EXECUTION_PLAN_RUN_ONLY_INTERMEDIATE_UIDS = 404, + CUDNN_ATTR_EXECUTION_PLAN_JSON_REPRESENTATION = 405, CUDNN_ATTR_INTERMEDIATE_INFO_UNIQUE_ID = 500, CUDNN_ATTR_INTERMEDIATE_INFO_SIZE = 501, CUDNN_ATTR_INTERMEDIATE_INFO_DEPENDENT_DATA_UIDS = 502, @@ -14166,6 +15062,9 @@ pub enum cudnnBackendAttributeName_t { CUDNN_ATTR_OPERATION_MATMUL_CDESC = 1522, CUDNN_ATTR_OPERATION_MATMUL_DESC = 1523, CUDNN_ATTR_OPERATION_MATMUL_IRREGULARLY_STRIDED_BATCH_COUNT = 1524, + CUDNN_ATTR_OPERATION_MATMUL_GEMM_M_OVERRIDE_DESC = 1525, + CUDNN_ATTR_OPERATION_MATMUL_GEMM_N_OVERRIDE_DESC = 1526, + CUDNN_ATTR_OPERATION_MATMUL_GEMM_K_OVERRIDE_DESC = 1527, CUDNN_ATTR_REDUCTION_OPERATOR = 1600, CUDNN_ATTR_REDUCTION_COMP_TYPE = 1601, CUDNN_ATTR_OPERATION_REDUCTION_XDESC = 1610, @@ -14203,6 +15102,54 @@ pub enum cudnnBackendAttributeName_t { CUDNN_ATTR_OPERATION_RESAMPLE_BWD_ALPHA = 1723, CUDNN_ATTR_OPERATION_RESAMPLE_BWD_BETA = 1724, CUDNN_ATTR_OPERATION_RESAMPLE_BWD_DESC = 1725, + CUDNN_ATTR_OPERATION_RESAMPLE_BWD_XDESC = 1726, + CUDNN_ATTR_OPERATION_RESAMPLE_BWD_YDESC = 1727, + CUDNN_ATTR_OPERATION_CONCAT_AXIS = 1800, + CUDNN_ATTR_OPERATION_CONCAT_INPUT_DESCS = 1801, + CUDNN_ATTR_OPERATION_CONCAT_INPLACE_INDEX = 1802, + CUDNN_ATTR_OPERATION_CONCAT_OUTPUT_DESC = 1803, + CUDNN_ATTR_OPERATION_SIGNAL_MODE = 1900, + CUDNN_ATTR_OPERATION_SIGNAL_FLAGDESC = 1901, + CUDNN_ATTR_OPERATION_SIGNAL_VALUE = 1902, + CUDNN_ATTR_OPERATION_SIGNAL_XDESC = 1903, + CUDNN_ATTR_OPERATION_SIGNAL_YDESC = 1904, + CUDNN_ATTR_OPERATION_NORM_FWD_MODE = 2000, + CUDNN_ATTR_OPERATION_NORM_FWD_PHASE = 2001, + CUDNN_ATTR_OPERATION_NORM_FWD_XDESC = 2002, + CUDNN_ATTR_OPERATION_NORM_FWD_MEAN_DESC = 2003, + CUDNN_ATTR_OPERATION_NORM_FWD_INV_VARIANCE_DESC = 2004, + CUDNN_ATTR_OPERATION_NORM_FWD_SCALE_DESC = 2005, + CUDNN_ATTR_OPERATION_NORM_FWD_BIAS_DESC = 2006, + CUDNN_ATTR_OPERATION_NORM_FWD_EPSILON_DESC = 2007, + CUDNN_ATTR_OPERATION_NORM_FWD_EXP_AVG_FACTOR_DESC = 2008, + CUDNN_ATTR_OPERATION_NORM_FWD_INPUT_RUNNING_MEAN_DESC = 2009, + CUDNN_ATTR_OPERATION_NORM_FWD_INPUT_RUNNING_VAR_DESC = 2010, + CUDNN_ATTR_OPERATION_NORM_FWD_OUTPUT_RUNNING_MEAN_DESC = 2011, + CUDNN_ATTR_OPERATION_NORM_FWD_OUTPUT_RUNNING_VAR_DESC = 2012, + CUDNN_ATTR_OPERATION_NORM_FWD_YDESC = 2013, + CUDNN_ATTR_OPERATION_NORM_FWD_PEER_STAT_DESCS = 2014, + CUDNN_ATTR_OPERATION_NORM_BWD_MODE = 2100, + CUDNN_ATTR_OPERATION_NORM_BWD_XDESC = 2101, + CUDNN_ATTR_OPERATION_NORM_BWD_MEAN_DESC = 2102, + CUDNN_ATTR_OPERATION_NORM_BWD_INV_VARIANCE_DESC = 2103, + CUDNN_ATTR_OPERATION_NORM_BWD_DYDESC = 2104, + CUDNN_ATTR_OPERATION_NORM_BWD_SCALE_DESC = 2105, + CUDNN_ATTR_OPERATION_NORM_BWD_EPSILON_DESC = 2106, + CUDNN_ATTR_OPERATION_NORM_BWD_DSCALE_DESC = 2107, + CUDNN_ATTR_OPERATION_NORM_BWD_DBIAS_DESC = 2108, + CUDNN_ATTR_OPERATION_NORM_BWD_DXDESC = 2109, + CUDNN_ATTR_OPERATION_NORM_BWD_PEER_STAT_DESCS = 2110, + CUDNN_ATTR_OPERATION_RESHAPE_XDESC = 2200, + CUDNN_ATTR_OPERATION_RESHAPE_YDESC = 2201, + CUDNN_ATTR_RNG_DISTRIBUTION = 2300, + CUDNN_ATTR_RNG_NORMAL_DIST_MEAN = 2301, + CUDNN_ATTR_RNG_NORMAL_DIST_STANDARD_DEVIATION = 2302, + CUDNN_ATTR_RNG_UNIFORM_DIST_MAXIMUM = 2303, + CUDNN_ATTR_RNG_UNIFORM_DIST_MINIMUM = 2304, + CUDNN_ATTR_RNG_BERNOULLI_DIST_PROBABILITY = 2305, + CUDNN_ATTR_OPERATION_RNG_YDESC = 2310, + CUDNN_ATTR_OPERATION_RNG_SEED = 2311, + CUDNN_ATTR_OPERATION_RNG_DESC = 2312, } #[repr(u32)] #[non_exhaustive] @@ -14232,6 +15179,12 @@ pub enum cudnnBackendAttributeType_t { CUDNN_TYPE_RESAMPLE_MODE = 21, CUDNN_TYPE_PADDING_MODE = 22, CUDNN_TYPE_INT32 = 23, + CUDNN_TYPE_CHAR = 24, + CUDNN_TYPE_SIGNAL_MODE = 25, + CUDNN_TYPE_FRACTION = 26, + CUDNN_TYPE_NORM_MODE = 27, + CUDNN_TYPE_NORM_FWD_PHASE = 28, + CUDNN_TYPE_RNG_DISTRIBUTION = 29, } #[repr(u32)] #[non_exhaustive] @@ -14264,6 +15217,13 @@ pub enum cudnnBackendDescriptorType_t { CUDNN_BACKEND_RESAMPLE_DESCRIPTOR = 24, CUDNN_BACKEND_OPERATION_RESAMPLE_FWD_DESCRIPTOR = 25, CUDNN_BACKEND_OPERATION_RESAMPLE_BWD_DESCRIPTOR = 26, + CUDNN_BACKEND_OPERATION_CONCAT_DESCRIPTOR = 27, + CUDNN_BACKEND_OPERATION_SIGNAL_DESCRIPTOR = 28, + CUDNN_BACKEND_OPERATION_NORM_FORWARD_DESCRIPTOR = 29, + CUDNN_BACKEND_OPERATION_NORM_BACKWARD_DESCRIPTOR = 30, + CUDNN_BACKEND_OPERATION_RESHAPE_DESCRIPTOR = 31, + CUDNN_BACKEND_RNG_DESCRIPTOR = 32, + CUDNN_BACKEND_OPERATION_RNG_DESCRIPTOR = 33, } #[repr(u32)] #[non_exhaustive] @@ -14318,7 +15278,11 @@ pub enum cudnnBackendKnobType_t { CUDNN_KNOB_TYPE_LDGC = 22, CUDNN_KNOB_TYPE_SPECFILT = 23, CUDNN_KNOB_TYPE_KERNEL_CFG = 24, - CUDNN_KNOB_TYPE_COUNTS = 25, + CUDNN_KNOB_TYPE_WORKSPACE = 25, + CUDNN_KNOB_TYPE_TILE_CGA = 26, + CUDNN_KNOB_TYPE_TILE_CGA_M = 27, + CUDNN_KNOB_TYPE_TILE_CGA_N = 28, + CUDNN_KNOB_TYPE_COUNTS = 29, } #[repr(u32)] #[non_exhaustive] @@ -14355,6 +15319,22 @@ pub enum cudnnPaddingMode_t { CUDNN_NEG_INF_PAD = 1, CUDNN_EDGE_VAL_PAD = 2, } +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudnnBackendNormMode_t { + CUDNN_LAYER_NORM = 0, + CUDNN_INSTANCE_NORM = 1, + CUDNN_BATCH_NORM = 2, + CUDNN_GROUP_NORM = 3, +} +#[repr(u32)] +#[non_exhaustive] +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub enum cudnnBackendNormFwdPhase_t { + CUDNN_NORM_FWD_INFERENCE = 0, + CUDNN_NORM_FWD_TRAINING = 1, +} extern "C" { pub fn cudnnBackendCreateDescriptor( descriptorType: cudnnBackendDescriptorType_t, diff --git a/rcudnn/cudnn/Cargo.toml b/rcudnn/cudnn/Cargo.toml index 5ff0762cd..0cf1c28ef 100644 --- a/rcudnn/cudnn/Cargo.toml +++ b/rcudnn/cudnn/Cargo.toml @@ -4,10 +4,10 @@ description = "safe Rust wrapper for CUDA's cuDNN" version = "1.8.0" edition = "2018" authors = [ - "Bernhard Schuster ", - "Lissa Hyacinth ", - "MichaelHirn", - "Maximilian Goisser", + "Bernhard Schuster ", + "Lissa Hyacinth ", + "MichaelHirn", + "Maximilian Goisser", ] repository = "https://github.com/spearow/juice" homepage = "https://github.com/spearow/juice/tree/master/rcudnn" @@ -22,6 +22,9 @@ num = "0.4" thiserror = "1.0" [dev-dependencies] -coaster = { default-features = false, features = ["native", "cuda"], path = "../../coaster" , version = "0.2.0"} +coaster = { default-features = false, features = [ + "native", + "cuda", +], path = "../../coaster", version = "0.2.0" } env_logger = "0.9" log = "0.4" diff --git a/rcudnn/cudnn/benches/cudnn_overhead.rs b/rcudnn/cudnn/benches/cudnn_overhead.rs index b12420696..ec257a4ce 100644 --- a/rcudnn/cudnn/benches/cudnn_overhead.rs +++ b/rcudnn/cudnn/benches/cudnn_overhead.rs @@ -1,8 +1,5 @@ -#![feature(test)] - extern crate coaster as co; extern crate rcudnn; -extern crate test; #[cfg(test)] mod cudnn_spec { diff --git a/rcudnn/cudnn/src/error.rs b/rcudnn/cudnn/src/error.rs index 3f40a0599..ecb3005f9 100644 --- a/rcudnn/cudnn/src/error.rs +++ b/rcudnn/cudnn/src/error.rs @@ -4,7 +4,7 @@ pub type Result = std::result::Result; #[non_exhaustive] -#[derive(Debug, Copy, Clone, thiserror::Error)] +#[derive(Debug, Clone, Copy, thiserror::Error)] /// Defines CUDA's cuDNN errors. pub enum Error { /// Failure with CUDA cuDNN initialization. diff --git a/remote-test/README.md b/remote-test/README.md index d385f3373..33cc1b487 100644 --- a/remote-test/README.md +++ b/remote-test/README.md @@ -146,4 +146,4 @@ test src/lib.rs - (line 25) ... ok test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out succeeded -``` \ No newline at end of file +``` diff --git a/remote-test/launch.sh b/remote-test/launch.sh index cdd34c8e9..5d7b255a5 100755 --- a/remote-test/launch.sh +++ b/remote-test/launch.sh @@ -1,10 +1,9 @@ #!/usr/bin/env sh set -e cargo check --tests -fly -t spearow login -n juice-crashtesters --concourse-url https://ci.spearow.io -fly -t spearow execute \ - --tag simsalabim \ +fly -t fff login -n juice-crashtesters --concourse-url https://ci.fff.rs +fly -t fff execute \ --tag framework:cuda \ --tag framework:opencl \ - -c ./remote-test/test.yml \ - --input juice=. + -c ./test.yml \ + --input juice=.. diff --git a/rust-blas/Cargo.toml b/rust-blas/Cargo.toml index 8d0c554f3..dca4e1803 100644 --- a/rust-blas/Cargo.toml +++ b/rust-blas/Cargo.toml @@ -2,10 +2,10 @@ name = "rust-blas" version = "0.2.0" authors = [ - "Paul Kassianik ", - "Lissa Hyacinth ", - "Bernhard Schuster ", - "Michael Yang ", + "Paul Kassianik ", + "Lissa Hyacinth ", + "Bernhard Schuster ", + "Michael Yang ", ] description = "BLAS bindings and wrappers, fork of rblas" documentation = "http://mikkyang.github.io/rust-blas/doc/rblas/index.html"