From ee19c987af587f75764435699f456eae7d49e229 Mon Sep 17 00:00:00 2001 From: Robert Remen Date: Tue, 24 Sep 2024 12:45:00 +0000 Subject: [PATCH] feat: enable compilation without Bellman CUDA --- Cargo.toml | 3 +- README.md | 22 +- .../Cargo.toml | 2 +- .../src/main.rs | 0 crates/gpu-ffi-bindings-generator/Cargo.toml | 15 + crates/gpu-ffi-bindings-generator/src/main.rs | 14 + crates/gpu-ffi/Cargo.toml | 2 +- crates/gpu-ffi/build.rs | 114 +- crates/gpu-ffi/src/bindings.rs | 1097 ++--------------- crates/gpu-ffi/src/lib.rs | 4 + 10 files changed, 162 insertions(+), 1111 deletions(-) rename crates/{bindings-generator => cudart-sys-bindings-generator}/Cargo.toml (89%) rename crates/{bindings-generator => cudart-sys-bindings-generator}/src/main.rs (100%) create mode 100644 crates/gpu-ffi-bindings-generator/Cargo.toml create mode 100644 crates/gpu-ffi-bindings-generator/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index 21ec19c..a510002 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,12 +17,13 @@ version = "0.150.9" [workspace.dependencies] # Local dependencies -bindings-generator = { version = "=0.150.9", path = "crates/bindings-generator" } boojum-cuda = { version = "=0.150.9", path = "crates/boojum-cuda" } era_criterion_cuda = { version = "=0.150.9", path = "crates/criterion-cuda" } era_cudart = { version = "=0.150.9", path = "crates/cudart" } era_cudart_sys = { version = "=0.150.9", path = "crates/cudart-sys" } +era_cudart_sys_bindings_generator = { version = "=0.150.9", path = "crates/cudart-sys-bindings-generator" } gpu-ffi = { version = "=0.150.9", path = "crates/gpu-ffi", package = "zksync-gpu-ffi" } +gpu-ffi-bindings-generator = { version = "=0.150.9", path = "crates/gpu-ffi", package = "zksync-gpu-ffi-bindings-generator" } gpu-prover = { version = "=0.150.9", path = "crates/gpu-prover", package = "zksync-gpu-prover" } shivini = { version = "=0.150.9", path = "crates/shivini" } wrapper-prover = { version = "=0.150.9", path = "crates/wrapper-prover", package = "zksync-wrapper-prover" } diff --git a/README.md b/README.md index d96e085..5216edd 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,18 @@ GPU acceleration for cryptography used in ZKsync project. In order to work with the workspace, you'll need. - [Cmake 3.24 or higher](https://apt.kitware.com/) -- [CUDA toolkit](https://developer.nvidia.com/cuda-downloads) +- [CUDA toolkit 12.0 or higher](https://developer.nvidia.com/cuda-downloads) - [Bellman CUDA](github.com/matter-labs/matter-labs/era-bellman-cuda) -For Bellman CUDA the easiest way to install is: +For Bellman CUDA, clone it to a directory of your choice: ``` git clone git@github.com:matter-labs/era-bellman-cuda.git +``` + +Optionally also build it with the following commands (otherwise it will be built automatically while building the `gpu-ffi` crate): + +``` cmake -Bera-bellman-cuda/build -Sera-bellman-cuda/ -DCMAKE_BUILD_TYPE=Release cmake --build era-bellman-cuda/build/ ``` @@ -25,20 +30,21 @@ Then add the following variable to your config (`.bashrc`/`.zshrc`): export BELLMAN_CUDA_DIR=/era-bellman-cuda ``` -Alternatively, if you can't or don't want to install the CUDA toolkit, you can compile the crates `cudart-sys` and `boojum-cuda` and crates that depend on them without CUDA toolkit. +Alternatively, if you can't or don't want to install the CUDA toolkit or Bellman CUDA, you can compile the crates in this workspace without a CUDA toolkit installation and Bellman CUDA. Doing so will result in stubs replacing calls to CUDA API and any GPU device code. The code will compile but any call to one of the stubs will result in an error during runtime. To compile in this mode, either include the rucstc `cfg` flag named `no_cuda`, for example by setting the `RUSTFLAGS` environment variable to `--cfg no_cuda`, or by setting the environment variable `ZKSYNC_USE_CUDA_STUBS` to `1` or `true` or `yes` in any capitalization. ## Crates -- [bindings-generator](./crates/bindings-generator/) -- [cudart-sys](./crates/cudart-sys/) -- [cudart](./crates/cudart/) -- [criterion-cuda](./crates/criterion-cuda/) - [boojum-cuda](./crates/boojum-cuda/) -- [shivini](./crates/shivini/) +- [criterion-cuda](./crates/criterion-cuda/) +- [cudart](./crates/cudart/) +- [cudart-sys](./crates/cudart-sys/) +- [cudart-sys-bindings-generator](crates/cudart-sys-bindings-generator/) - [gpu-ffi](./crates/gpu-ffi/) +- [gpu-ffi-bindings-generator](./crates/gpu-ffi-bindings-generator/) - [gpu-prover](./crates/gpu-prover/) +- [shivini](./crates/shivini/) - [wrapper-prover](./crates/wrapper-prover/) ## License diff --git a/crates/bindings-generator/Cargo.toml b/crates/cudart-sys-bindings-generator/Cargo.toml similarity index 89% rename from crates/bindings-generator/Cargo.toml rename to crates/cudart-sys-bindings-generator/Cargo.toml index 274fdbc..d1c9bf4 100644 --- a/crates/bindings-generator/Cargo.toml +++ b/crates/cudart-sys-bindings-generator/Cargo.toml @@ -7,7 +7,7 @@ keywords.workspace = true categories.workspace = true repository.workspace = true version.workspace = true -name = "era_cuda_bindings_generator" +name = "era_cudart_sys_bindings_generator" description = "CUDA Bindings generator for ZKsync" publish = false diff --git a/crates/bindings-generator/src/main.rs b/crates/cudart-sys-bindings-generator/src/main.rs similarity index 100% rename from crates/bindings-generator/src/main.rs rename to crates/cudart-sys-bindings-generator/src/main.rs diff --git a/crates/gpu-ffi-bindings-generator/Cargo.toml b/crates/gpu-ffi-bindings-generator/Cargo.toml new file mode 100644 index 0000000..0390c6e --- /dev/null +++ b/crates/gpu-ffi-bindings-generator/Cargo.toml @@ -0,0 +1,15 @@ +[package] +edition.workspace = true +authors.workspace = true +homepage.workspace = true +license.workspace = true +keywords.workspace = true +categories.workspace = true +repository.workspace = true +version.workspace = true +name = "zksync-gpu-ffi-bindings-generator" +description = "ZKsync gpu-ffi bindings generator" +publish = false + +[dependencies] +bindgen = "0.70" diff --git a/crates/gpu-ffi-bindings-generator/src/main.rs b/crates/gpu-ffi-bindings-generator/src/main.rs new file mode 100644 index 0000000..1213536 --- /dev/null +++ b/crates/gpu-ffi-bindings-generator/src/main.rs @@ -0,0 +1,14 @@ +fn main() { + let bellman_cuda_dir = std::env::var("BELLMAN_CUDA_DIR").unwrap(); + let bellman_cuda_path = std::path::Path::new(&bellman_cuda_dir); + let header = bellman_cuda_path.join("src").join("bellman-cuda.h"); + let bindings = bindgen::Builder::default() + .header(header.to_str().unwrap()) + .generate_comments(false) + .layout_tests(false) + .size_t_is_usize(false) + .generate() + .expect("Unable to generate bindings") + .to_string(); + println!("{bindings}"); +} diff --git a/crates/gpu-ffi/Cargo.toml b/crates/gpu-ffi/Cargo.toml index fb2d478..de68395 100644 --- a/crates/gpu-ffi/Cargo.toml +++ b/crates/gpu-ffi/Cargo.toml @@ -11,6 +11,7 @@ name = "zksync-gpu-ffi" description = "ZKsync GPU FFI" [dependencies] +era_cudart_sys.workspace = true futures = "0.3.8" futures-locks = "0.7" derivative = "2.2" @@ -19,7 +20,6 @@ crossbeam = "0.8" [build-dependencies] era_cudart_sys.workspace = true -bindgen = "0.59.1" cmake = "0.1" [dev-dependencies] diff --git a/crates/gpu-ffi/build.rs b/crates/gpu-ffi/build.rs index a741aa4..a862a38 100644 --- a/crates/gpu-ffi/build.rs +++ b/crates/gpu-ffi/build.rs @@ -1,81 +1,45 @@ -extern crate bindgen; -use era_cudart_sys::get_cuda_lib_path; +#![allow(unexpected_cfgs)] + +use era_cudart_sys::{get_cuda_lib_path, get_cuda_version, is_no_cuda, no_cuda_message}; use std::env::var; use std::path::Path; -use std::{env, path::PathBuf}; -// build.rs +use std::env; fn main() { - let bellman_cuda_path = if let Ok(path) = std::env::var("BELLMAN_CUDA_DIR") { - path - } else { - // we need to instruct rustc so that it will find libbellman-cuda.a - // - if dep is resolved via git(cargo checks ~/.cargo/git/checkouts/) - // - if dep is resolved via local path - // - if you want to build on a macos or only for rust analyzer - // just `export BELLMAN_CUDA_DIR=$PWD/bellman-cuda` - // so we will benefit from env variable for now - todo!("set BELLMAN_CUDA_DIR=$PWD") - }; - - generate_bindings(&bellman_cuda_path); - - #[cfg(not(target_os = "macos"))] - link_multiexp_library(&bellman_cuda_path); // FIXME enable -} - -fn generate_bindings(bellman_cuda_path: &str) { - println!("generating bindings"); - let header_file = &format!("{}/src/bellman-cuda.h", bellman_cuda_path); - const OUT_FILE: &str = "bindings.rs"; - println!("cargo:rerun-if-changed={}", header_file); - - let bindings = bindgen::Builder::default() - // The input header we would like to generate - // bindings for. - .header(header_file) - // Tell cargo to invalidate the built crate whenever any of the - // included header files changed. - .parse_callbacks(Box::new(bindgen::CargoCallbacks)) - // Finish the builder and generate the bindings. - .generate() - // Unwrap the Result and panic on failure. - .expect("Unable to generate bindings"); - - // Write the bindings to the $OUT_DIR/bindings.rs file. - let out_path = PathBuf::from(format!( - "{}/{}", - env::current_dir().unwrap().to_str().unwrap(), - "src" - )); - println!("out path {:?}", out_path.to_str()); - bindings - .write_to_file(out_path.join(OUT_FILE)) - .expect("Couldn't write bindings!"); -} - -fn link_multiexp_library(bellman_cuda_path: &str) { - let bellman_cuda_lib_path = if Path::new(bellman_cuda_path).join("build").exists() { - Path::new(bellman_cuda_path) - .join("build") - .join("src") - .to_str() - .unwrap() - .to_string() + println!("cargo::rustc-check-cfg=cfg(no_cuda)"); + if is_no_cuda() { + println!("cargo::warning={}", no_cuda_message!()); + println!("cargo::rustc-cfg=no_cuda"); } else { - let cudaarchs = var("CUDAARCHS").unwrap_or("native".to_string()); - let dst = cmake::Config::new(bellman_cuda_path) - .profile("Release") - .define("CMAKE_CUDA_ARCHITECTURES", cudaarchs) - .build(); - dst.to_str().unwrap().to_string() - }; - println!("cargo:rustc-link-search=native={bellman_cuda_lib_path}"); - println!("cargo:rustc-link-lib=static=bellman-cuda"); - let cuda_lib_path = get_cuda_lib_path().unwrap(); - let cuda_lib_path_str = cuda_lib_path.to_str().unwrap(); - println!("cargo:rustc-link-search=native={cuda_lib_path_str}"); - println!("cargo:rustc-link-lib=cudart"); - #[cfg(target_os = "linux")] - println!("cargo:rustc-link-lib=stdc++"); + let cuda_version = + get_cuda_version().expect("Failed to determine the CUDA Toolkit version."); + if !cuda_version.starts_with("12.") { + println!("cargo::warning=CUDA Toolkit version {cuda_version} detected. This crate is only tested with CUDA Toolkit version 12.*."); + } + let bellman_cuda_dir = var("BELLMAN_CUDA_DIR").unwrap(); + let bellman_cuda_path = Path::new(&bellman_cuda_dir); + let bellman_cuda_lib_path = if Path::new(bellman_cuda_path).join("build").exists() { + Path::new(bellman_cuda_path) + .join("build") + .join("src") + .to_str() + .unwrap() + .to_string() + } else { + let cudaarchs = var("CUDAARCHS").unwrap_or("native".to_string()); + let dst = cmake::Config::new(bellman_cuda_path) + .profile("Release") + .define("CMAKE_CUDA_ARCHITECTURES", cudaarchs) + .build(); + dst.to_str().unwrap().to_string() + }; + println!("cargo:rustc-link-search=native={bellman_cuda_lib_path}"); + println!("cargo:rustc-link-lib=static=bellman-cuda"); + let cuda_lib_path = get_cuda_lib_path().unwrap(); + let cuda_lib_path_str = cuda_lib_path.to_str().unwrap(); + println!("cargo:rustc-link-search=native={cuda_lib_path_str}"); + println!("cargo:rustc-link-lib=cudart"); + #[cfg(target_os = "linux")] + println!("cargo:rustc-link-lib=stdc++"); + } } diff --git a/crates/gpu-ffi/src/bindings.rs b/crates/gpu-ffi/src/bindings.rs index d0cb590..59e1681 100644 --- a/crates/gpu-ffi/src/bindings.rs +++ b/crates/gpu-ffi/src/bindings.rs @@ -1,4 +1,4 @@ -/* automatically generated by rust-bindgen 0.59.2 */ +/* automatically generated by rust-bindgen 0.70.1 */ pub const __bool_true_false_are_defined: u32 = 1; pub const true_: u32 = 1; @@ -13,43 +13,6 @@ pub struct max_align_t { pub __bindgen_padding_0: u64, pub __clang_max_align_nonce2: u128, } -#[test] -fn bindgen_test_layout_max_align_t() { - assert_eq!( - ::std::mem::size_of::(), - 32usize, - concat!("Size of: ", stringify!(max_align_t)) - ); - assert_eq!( - ::std::mem::align_of::(), - 16usize, - concat!("Alignment of ", stringify!(max_align_t)) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).__clang_max_align_nonce1 as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce1) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).__clang_max_align_nonce2 as *const _ as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(max_align_t), - "::", - stringify!(__clang_max_align_nonce2) - ) - ); -} pub const bc_error_bc_success: bc_error = 0; pub const bc_error_bc_error_invalid_value: bc_error = 1; pub const bc_error_bc_error_memory_allocation: bc_error = 2; @@ -60,175 +23,106 @@ pub type bc_error = ::std::os::raw::c_uint; pub struct bc_stream { pub handle: *mut ::std::os::raw::c_void, } -#[test] -fn bindgen_test_layout_bc_stream() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(bc_stream)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(bc_stream)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(bc_stream), - "::", - stringify!(handle) - ) - ); -} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct bc_event { pub handle: *mut ::std::os::raw::c_void, } -#[test] -fn bindgen_test_layout_bc_event() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(bc_event)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(bc_event)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(bc_event), - "::", - stringify!(handle) - ) - ); -} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct bc_mem_pool { pub handle: *mut ::std::os::raw::c_void, } -#[test] -fn bindgen_test_layout_bc_mem_pool() { - assert_eq!( - ::std::mem::size_of::(), - 8usize, - concat!("Size of: ", stringify!(bc_mem_pool)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(bc_mem_pool)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).handle as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(bc_mem_pool), - "::", - stringify!(handle) - ) - ); -} pub type bc_host_fn = ::std::option::Option; -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_get_device_count(count: *mut ::std::os::raw::c_int) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_get_device(device_id: *mut ::std::os::raw::c_int) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_set_device(device_id: ::std::os::raw::c_int) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_stream_create(stream: *mut bc_stream, blocking_sync: bool) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_stream_wait_event(stream: bc_stream, event: bc_event) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_stream_synchronize(stream: bc_stream) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_stream_query(stream: bc_stream) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_stream_destroy(stream: bc_stream) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_launch_host_fn( stream: bc_stream, fn_: bc_host_fn, user_data: *mut ::std::os::raw::c_void, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_event_create( event: *mut bc_event, blocking_sync: bool, disable_timing: bool, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_event_record(event: bc_event, stream: bc_stream) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_event_synchronize(event: bc_event) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_event_query(event: bc_event) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_event_destroy(event: bc_event) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_event_elapsed_time(ms: *mut f32, start: bc_event, end: bc_event) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_mem_get_info(free: *mut size_t, total: *mut size_t) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_malloc(ptr: *mut *mut ::std::os::raw::c_void, size: size_t) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_malloc_host(ptr: *mut *mut ::std::os::raw::c_void, size: size_t) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_free(ptr: *mut ::std::os::raw::c_void) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_free_host(ptr: *mut ::std::os::raw::c_void) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_host_register(ptr: *mut ::std::os::raw::c_void, size: size_t) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_host_unregister(ptr: *mut ::std::os::raw::c_void) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_device_disable_peer_access(device_id: ::std::os::raw::c_int) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_device_enable_peer_access(device_id: ::std::os::raw::c_int) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_memcpy( dst: *mut ::std::os::raw::c_void, src: *const ::std::os::raw::c_void, count: size_t, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_memcpy_async( dst: *mut ::std::os::raw::c_void, src: *const ::std::os::raw::c_void, @@ -236,14 +130,14 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_memset( ptr: *mut ::std::os::raw::c_void, value: ::std::os::raw::c_int, count: size_t, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_memset_async( ptr: *mut ::std::os::raw::c_void, value: ::std::os::raw::c_int, @@ -251,26 +145,26 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_mem_pool_create(pool: *mut bc_mem_pool, device_id: ::std::os::raw::c_int) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_mem_pool_destroy(pool: bc_mem_pool) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_mem_pool_disable_peer_access( pool: bc_mem_pool, device_id: ::std::os::raw::c_int, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_mem_pool_enable_peer_access( pool: bc_mem_pool, device_id: ::std::os::raw::c_int, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_malloc_from_pool_async( ptr: *mut *mut ::std::os::raw::c_void, size: size_t, @@ -278,16 +172,16 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn bc_free_async(ptr: *mut ::std::os::raw::c_void, stream: bc_stream) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_set_up( powers_of_w_coarse_log_count: ::std::os::raw::c_uint, powers_of_g_coarse_log_count: ::std::os::raw::c_uint, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_set_value( target: *mut ::std::os::raw::c_void, value: *const ::std::os::raw::c_void, @@ -295,21 +189,21 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_set_value_zero( target: *mut ::std::os::raw::c_void, count: ::std::os::raw::c_uint, stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_set_value_one( target: *mut ::std::os::raw::c_void, count: ::std::os::raw::c_uint, stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_ax( a: *const ::std::os::raw::c_void, x: *const ::std::os::raw::c_void, @@ -318,7 +212,7 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_a_plus_x( a: *const ::std::os::raw::c_void, x: *const ::std::os::raw::c_void, @@ -327,7 +221,7 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_x_plus_y( x: *const ::std::os::raw::c_void, y: *const ::std::os::raw::c_void, @@ -336,7 +230,7 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_ax_plus_y( a: *const ::std::os::raw::c_void, x: *const ::std::os::raw::c_void, @@ -346,7 +240,7 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_x_minus_y( x: *const ::std::os::raw::c_void, y: *const ::std::os::raw::c_void, @@ -355,7 +249,7 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_ax_minus_y( a: *const ::std::os::raw::c_void, x: *const ::std::os::raw::c_void, @@ -365,7 +259,7 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_x_minus_ay( a: *const ::std::os::raw::c_void, x: *const ::std::os::raw::c_void, @@ -375,7 +269,7 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_x_mul_y( x: *const ::std::os::raw::c_void, y: *const ::std::os::raw::c_void, @@ -393,80 +287,7 @@ pub struct ff_grand_product_configuration { pub outputs: *mut ::std::os::raw::c_void, pub count: ::std::os::raw::c_uint, } -#[test] -fn bindgen_test_layout_ff_grand_product_configuration() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(ff_grand_product_configuration)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ff_grand_product_configuration)) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).mem_pool as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ff_grand_product_configuration), - "::", - stringify!(mem_pool) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).stream as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ff_grand_product_configuration), - "::", - stringify!(stream) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).inputs as *const _ as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ff_grand_product_configuration), - "::", - stringify!(inputs) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).outputs as *const _ as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ff_grand_product_configuration), - "::", - stringify!(outputs) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).count as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ff_grand_product_configuration), - "::", - stringify!(count) - ) - ); -} -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_grand_product(configuration: ff_grand_product_configuration) -> bc_error; } #[repr(C)] @@ -479,101 +300,7 @@ pub struct ff_multiply_by_powers_configuration { pub outputs: *mut ::std::os::raw::c_void, pub count: ::std::os::raw::c_uint, } -#[test] -fn bindgen_test_layout_ff_multiply_by_powers_configuration() { - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ff_multiply_by_powers_configuration)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(ff_multiply_by_powers_configuration) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).mem_pool as *const _ - as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ff_multiply_by_powers_configuration), - "::", - stringify!(mem_pool) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).stream as *const _ - as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ff_multiply_by_powers_configuration), - "::", - stringify!(stream) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).inputs as *const _ - as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ff_multiply_by_powers_configuration), - "::", - stringify!(inputs) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).base as *const _ - as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ff_multiply_by_powers_configuration), - "::", - stringify!(base) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).outputs as *const _ - as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ff_multiply_by_powers_configuration), - "::", - stringify!(outputs) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).count as *const _ - as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ff_multiply_by_powers_configuration), - "::", - stringify!(count) - ) - ); -} -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_multiply_by_powers(configuration: ff_multiply_by_powers_configuration) -> bc_error; } #[repr(C)] @@ -585,74 +312,7 @@ pub struct ff_inverse_configuration { pub outputs: *mut ::std::os::raw::c_void, pub count: ::std::os::raw::c_uint, } -#[test] -fn bindgen_test_layout_ff_inverse_configuration() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(ff_inverse_configuration)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ff_inverse_configuration)) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).mem_pool as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ff_inverse_configuration), - "::", - stringify!(mem_pool) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stream as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ff_inverse_configuration), - "::", - stringify!(stream) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).inputs as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ff_inverse_configuration), - "::", - stringify!(inputs) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).outputs as *const _ as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ff_inverse_configuration), - "::", - stringify!(outputs) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ff_inverse_configuration), - "::", - stringify!(count) - ) - ); -} -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_inverse(configuration: ff_inverse_configuration) -> bc_error; } #[repr(C)] @@ -665,91 +325,6 @@ pub struct ff_poly_evaluate_configuration { pub result: *mut ::std::os::raw::c_void, pub count: ::std::os::raw::c_uint, } -#[test] -fn bindgen_test_layout_ff_poly_evaluate_configuration() { - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(ff_poly_evaluate_configuration)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ff_poly_evaluate_configuration)) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).mem_pool as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ff_poly_evaluate_configuration), - "::", - stringify!(mem_pool) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).stream as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ff_poly_evaluate_configuration), - "::", - stringify!(stream) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).values as *const _ as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ff_poly_evaluate_configuration), - "::", - stringify!(values) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).point as *const _ as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ff_poly_evaluate_configuration), - "::", - stringify!(point) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).result as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ff_poly_evaluate_configuration), - "::", - stringify!(result) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).count as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ff_poly_evaluate_configuration), - "::", - stringify!(count) - ) - ); -} #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct ff_sort_u32_configuration { @@ -759,81 +334,10 @@ pub struct ff_sort_u32_configuration { pub sorted_values: *mut ::std::os::raw::c_void, pub count: ::std::os::raw::c_uint, } -#[test] -fn bindgen_test_layout_ff_sort_u32_configuration() { - assert_eq!( - ::std::mem::size_of::(), - 40usize, - concat!("Size of: ", stringify!(ff_sort_u32_configuration)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ff_sort_u32_configuration)) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).mem_pool as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ff_sort_u32_configuration), - "::", - stringify!(mem_pool) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).stream as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ff_sort_u32_configuration), - "::", - stringify!(stream) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).values as *const _ as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ff_sort_u32_configuration), - "::", - stringify!(values) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).sorted_values as *const _ as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ff_sort_u32_configuration), - "::", - stringify!(sorted_values) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).count as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ff_sort_u32_configuration), - "::", - stringify!(count) - ) - ); -} -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_poly_evaluate(configuration: ff_poly_evaluate_configuration) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_get_powers_of_w( target: *mut ::std::os::raw::c_void, log_degree: ::std::os::raw::c_uint, @@ -844,7 +348,7 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_get_powers_of_g( target: *mut ::std::os::raw::c_void, log_degree: ::std::os::raw::c_uint, @@ -855,7 +359,7 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_omega_shift( values: *const ::std::os::raw::c_void, result: *mut ::std::os::raw::c_void, @@ -867,7 +371,7 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_bit_reverse( values: *const ::std::os::raw::c_void, result: *mut ::std::os::raw::c_void, @@ -875,7 +379,7 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_bit_reverse_multigpu( values: *mut *const ::std::os::raw::c_void, results: *mut *mut ::std::os::raw::c_void, @@ -885,7 +389,7 @@ extern "C" { log_devices_count: ::std::os::raw::c_uint, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_select( source: *const ::std::os::raw::c_void, destination: *mut ::std::os::raw::c_void, @@ -894,13 +398,13 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_sort_u32(configuration: ff_sort_u32_configuration) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ff_tear_down() -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn pn_set_up() -> bc_error; } #[repr(C)] @@ -914,122 +418,12 @@ pub struct generate_permutation_polynomials_configuration { pub columns_count: ::std::os::raw::c_uint, pub log_rows_count: ::std::os::raw::c_uint, } -#[test] -fn bindgen_test_layout_generate_permutation_polynomials_configuration() { - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!( - "Size of: ", - stringify!(generate_permutation_polynomials_configuration) - ) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!( - "Alignment of ", - stringify!(generate_permutation_polynomials_configuration) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).mem_pool - as *const _ as usize - }, - 0usize, - concat!( - "Offset of field: ", - stringify!(generate_permutation_polynomials_configuration), - "::", - stringify!(mem_pool) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).stream - as *const _ as usize - }, - 8usize, - concat!( - "Offset of field: ", - stringify!(generate_permutation_polynomials_configuration), - "::", - stringify!(stream) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).indexes - as *const _ as usize - }, - 16usize, - concat!( - "Offset of field: ", - stringify!(generate_permutation_polynomials_configuration), - "::", - stringify!(indexes) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).scalars - as *const _ as usize - }, - 24usize, - concat!( - "Offset of field: ", - stringify!(generate_permutation_polynomials_configuration), - "::", - stringify!(scalars) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).target - as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(generate_permutation_polynomials_configuration), - "::", - stringify!(target) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).columns_count - as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(generate_permutation_polynomials_configuration), - "::", - stringify!(columns_count) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())) - .log_rows_count as *const _ as usize - }, - 44usize, - concat!( - "Offset of field: ", - stringify!(generate_permutation_polynomials_configuration), - "::", - stringify!(log_rows_count) - ) - ); -} -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn pn_generate_permutation_polynomials( configuration: generate_permutation_polynomials_configuration, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn pn_set_values_from_packed_bits( values: *mut ::std::os::raw::c_void, packet_bits: *const ::std::os::raw::c_void, @@ -1037,7 +431,7 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn pn_distribute_values( src: *const ::std::os::raw::c_void, dst: *mut ::std::os::raw::c_void, @@ -1046,10 +440,10 @@ extern "C" { stream: bc_stream, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn pn_tear_down() -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn msm_set_up() -> bc_error; } #[repr(C)] @@ -1068,164 +462,13 @@ pub struct msm_configuration { pub d2h_copy_finished_callback: bc_host_fn, pub d2h_copy_finished_callback_data: *mut ::std::os::raw::c_void, } -#[test] -fn bindgen_test_layout_msm_configuration() { - assert_eq!( - ::std::mem::size_of::(), - 96usize, - concat!("Size of: ", stringify!(msm_configuration)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(msm_configuration)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).mem_pool as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(msm_configuration), - "::", - stringify!(mem_pool) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stream as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(msm_configuration), - "::", - stringify!(stream) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).bases as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(msm_configuration), - "::", - stringify!(bases) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).scalars as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(msm_configuration), - "::", - stringify!(scalars) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).results as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(msm_configuration), - "::", - stringify!(results) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).log_scalars_count as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(msm_configuration), - "::", - stringify!(log_scalars_count) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).h2d_copy_finished as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(msm_configuration), - "::", - stringify!(h2d_copy_finished) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).h2d_copy_finished_callback as *const _ - as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(msm_configuration), - "::", - stringify!(h2d_copy_finished_callback) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).h2d_copy_finished_callback_data - as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(msm_configuration), - "::", - stringify!(h2d_copy_finished_callback_data) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).d2h_copy_finished as *const _ as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(msm_configuration), - "::", - stringify!(d2h_copy_finished) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).d2h_copy_finished_callback as *const _ - as usize - }, - 80usize, - concat!( - "Offset of field: ", - stringify!(msm_configuration), - "::", - stringify!(d2h_copy_finished_callback) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).d2h_copy_finished_callback_data - as *const _ as usize - }, - 88usize, - concat!( - "Offset of field: ", - stringify!(msm_configuration), - "::", - stringify!(d2h_copy_finished_callback_data) - ) - ); -} -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn msm_execute_async(configuration: msm_configuration) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn msm_tear_down() -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ntt_set_up() -> bc_error; } #[repr(C)] @@ -1248,213 +491,17 @@ pub struct ntt_configuration { pub d2h_copy_finished_callback: bc_host_fn, pub d2h_copy_finished_callback_data: *mut ::std::os::raw::c_void, } -#[test] -fn bindgen_test_layout_ntt_configuration() { - assert_eq!( - ::std::mem::size_of::(), - 96usize, - concat!("Size of: ", stringify!(ntt_configuration)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(ntt_configuration)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).mem_pool as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(mem_pool) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).stream as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(stream) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).inputs as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(inputs) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).outputs as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(outputs) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).log_values_count as *const _ as usize - }, - 32usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(log_values_count) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).bit_reversed_inputs as *const _ as usize - }, - 36usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(bit_reversed_inputs) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).inverse as *const _ as usize }, - 37usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(inverse) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).can_overwrite_inputs as *const _ as usize - }, - 38usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(can_overwrite_inputs) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).log_extension_degree as *const _ as usize - }, - 40usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(log_extension_degree) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).coset_index as *const _ as usize }, - 44usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(coset_index) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).h2d_copy_finished as *const _ as usize - }, - 48usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(h2d_copy_finished) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).h2d_copy_finished_callback as *const _ - as usize - }, - 56usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(h2d_copy_finished_callback) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).h2d_copy_finished_callback_data - as *const _ as usize - }, - 64usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(h2d_copy_finished_callback_data) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).d2h_copy_finished as *const _ as usize - }, - 72usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(d2h_copy_finished) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).d2h_copy_finished_callback as *const _ - as usize - }, - 80usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(d2h_copy_finished_callback) - ) - ); - assert_eq!( - unsafe { - &(*(::std::ptr::null::())).d2h_copy_finished_callback_data - as *const _ as usize - }, - 88usize, - concat!( - "Offset of field: ", - stringify!(ntt_configuration), - "::", - stringify!(d2h_copy_finished_callback_data) - ) - ); -} -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ntt_execute_async(configuration: ntt_configuration) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ntt_execute_async_multigpu( configurations: *const ntt_configuration, dev_ids: *const ::std::os::raw::c_int, log_n_devs: ::std::os::raw::c_uint, ) -> bc_error; } -extern "C" { +era_cudart_sys::cuda_fn_and_stub! { pub fn ntt_tear_down() -> bc_error; } + diff --git a/crates/gpu-ffi/src/lib.rs b/crates/gpu-ffi/src/lib.rs index d2367dc..a2be014 100644 --- a/crates/gpu-ffi/src/lib.rs +++ b/crates/gpu-ffi/src/lib.rs @@ -1,3 +1,7 @@ +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + // #![feature(array_chunks)] // pub mod error; // pub mod utils;