mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-10 07:08:03 -05:00
chore(ci): make build script regenerate bindings at all times
- git diff shows no diff
This commit is contained in:
4
Makefile
4
Makefile
@@ -419,8 +419,8 @@ clippy_cuda_backend: install_rs_check_toolchain
|
||||
-p tfhe-cuda-backend -- --no-deps -D warnings
|
||||
|
||||
.PHONY: check_rust_bindings_did_not_change # Check rust bindings are up to date for tfhe-cuda-backend
|
||||
check_rust_bindings_did_not_change:
|
||||
cargo build -p tfhe-cuda-backend && \
|
||||
check_rust_bindings_did_not_change:
|
||||
cargo build -p tfhe-cuda-backend && "$(MAKE)" fmt_gpu && \
|
||||
git diff --quiet HEAD -- backends/tfhe-cuda-backend/src/bindings.rs || \
|
||||
( echo "Generated bindings have changed! Please run 'git add backends/tfhe-cuda-backend/src/bindings.rs' \
|
||||
and commit the changes." && exit 1 )
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
use std::{env, fs};
|
||||
|
||||
fn main() {
|
||||
if let Ok(val) = env::var("DOCS_RS") {
|
||||
@@ -60,31 +60,26 @@ fn main() {
|
||||
|
||||
let out_path = PathBuf::from("src").join("bindings.rs");
|
||||
|
||||
// Check modification times
|
||||
let header_modified = fs::metadata(header_path).unwrap().modified().unwrap();
|
||||
let bindings_modified = if out_path.exists() {
|
||||
fs::metadata(&out_path).unwrap().modified().unwrap()
|
||||
} else {
|
||||
std::time::SystemTime::UNIX_EPOCH // If bindings file doesn't exist, consider it older
|
||||
};
|
||||
// Regenerate bindings only if header has been modified
|
||||
if header_modified > bindings_modified {
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header(header_path)
|
||||
.clang_arg("-x")
|
||||
.clang_arg("c++")
|
||||
.clang_arg("-std=c++17")
|
||||
.clang_arg("-I/usr/include")
|
||||
.clang_arg("-I/usr/local/include")
|
||||
.ctypes_prefix("ffi")
|
||||
.raw_line("use crate::ffi;")
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header(header_path)
|
||||
// allow only what we are interested in, the custom types appearing in the interface
|
||||
.allowlist_type("PBS_TYPE")
|
||||
.allowlist_type("SHIFT_OR_ROTATE_TYPE")
|
||||
// and the functions reachable from the headers included in wrapper.h
|
||||
.allowlist_function(".*")
|
||||
.clang_arg("-x")
|
||||
.clang_arg("c++")
|
||||
.clang_arg("-std=c++17")
|
||||
.clang_arg("-I/usr/include")
|
||||
.clang_arg("-I/usr/local/include")
|
||||
.ctypes_prefix("ffi")
|
||||
.raw_line("use crate::ffi;")
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
|
||||
bindings
|
||||
.write_to_file(&out_path)
|
||||
.expect("Couldn't write bindings!");
|
||||
}
|
||||
bindings
|
||||
.write_to_file(&out_path)
|
||||
.expect("Couldn't write bindings!");
|
||||
} else {
|
||||
panic!(
|
||||
"Error: platform not supported, tfhe-cuda-backend not built (only Linux is supported)"
|
||||
|
||||
@@ -2,243 +2,6 @@
|
||||
|
||||
use crate::ffi;
|
||||
|
||||
pub const _STDINT_H: u32 = 1;
|
||||
pub const _FEATURES_H: u32 = 1;
|
||||
pub const _ISOC95_SOURCE: u32 = 1;
|
||||
pub const _ISOC99_SOURCE: u32 = 1;
|
||||
pub const _ISOC11_SOURCE: u32 = 1;
|
||||
pub const _ISOC2X_SOURCE: u32 = 1;
|
||||
pub const _POSIX_SOURCE: u32 = 1;
|
||||
pub const _POSIX_C_SOURCE: u32 = 200809;
|
||||
pub const _XOPEN_SOURCE: u32 = 700;
|
||||
pub const _XOPEN_SOURCE_EXTENDED: u32 = 1;
|
||||
pub const _LARGEFILE64_SOURCE: u32 = 1;
|
||||
pub const _DEFAULT_SOURCE: u32 = 1;
|
||||
pub const _ATFILE_SOURCE: u32 = 1;
|
||||
pub const _DYNAMIC_STACK_SIZE_SOURCE: u32 = 1;
|
||||
pub const __GLIBC_USE_ISOC2X: u32 = 1;
|
||||
pub const __USE_ISOC11: u32 = 1;
|
||||
pub const __USE_ISOC99: u32 = 1;
|
||||
pub const __USE_ISOC95: u32 = 1;
|
||||
pub const __USE_ISOCXX11: u32 = 1;
|
||||
pub const __USE_POSIX: u32 = 1;
|
||||
pub const __USE_POSIX2: u32 = 1;
|
||||
pub const __USE_POSIX199309: u32 = 1;
|
||||
pub const __USE_POSIX199506: u32 = 1;
|
||||
pub const __USE_XOPEN2K: u32 = 1;
|
||||
pub const __USE_XOPEN2K8: u32 = 1;
|
||||
pub const __USE_XOPEN: u32 = 1;
|
||||
pub const __USE_XOPEN_EXTENDED: u32 = 1;
|
||||
pub const __USE_UNIX98: u32 = 1;
|
||||
pub const _LARGEFILE_SOURCE: u32 = 1;
|
||||
pub const __USE_XOPEN2K8XSI: u32 = 1;
|
||||
pub const __USE_XOPEN2KXSI: u32 = 1;
|
||||
pub const __USE_LARGEFILE: u32 = 1;
|
||||
pub const __USE_LARGEFILE64: u32 = 1;
|
||||
pub const __WORDSIZE: u32 = 64;
|
||||
pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
|
||||
pub const __SYSCALL_WORDSIZE: u32 = 64;
|
||||
pub const __TIMESIZE: u32 = 64;
|
||||
pub const __USE_MISC: u32 = 1;
|
||||
pub const __USE_ATFILE: u32 = 1;
|
||||
pub const __USE_DYNAMIC_STACK_SIZE: u32 = 1;
|
||||
pub const __USE_GNU: u32 = 1;
|
||||
pub const __USE_FORTIFY_LEVEL: u32 = 0;
|
||||
pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
|
||||
pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
|
||||
pub const _STDC_PREDEF_H: u32 = 1;
|
||||
pub const __STDC_IEC_559__: u32 = 1;
|
||||
pub const __STDC_IEC_60559_BFP__: u32 = 201404;
|
||||
pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
|
||||
pub const __STDC_IEC_60559_COMPLEX__: u32 = 201404;
|
||||
pub const __STDC_ISO_10646__: u32 = 201706;
|
||||
pub const __GNU_LIBRARY__: u32 = 6;
|
||||
pub const __GLIBC__: u32 = 2;
|
||||
pub const __GLIBC_MINOR__: u32 = 35;
|
||||
pub const _SYS_CDEFS_H: u32 = 1;
|
||||
pub const __glibc_c99_flexarr_available: u32 = 1;
|
||||
pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0;
|
||||
pub const __HAVE_GENERIC_SELECTION: u32 = 0;
|
||||
pub const __GLIBC_USE_LIB_EXT2: u32 = 1;
|
||||
pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 1;
|
||||
pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 1;
|
||||
pub const __GLIBC_USE_IEC_60559_EXT: u32 = 1;
|
||||
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 1;
|
||||
pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 1;
|
||||
pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 1;
|
||||
pub const _BITS_TYPES_H: u32 = 1;
|
||||
pub const _BITS_TYPESIZES_H: u32 = 1;
|
||||
pub const __OFF_T_MATCHES_OFF64_T: u32 = 1;
|
||||
pub const __INO_T_MATCHES_INO64_T: u32 = 1;
|
||||
pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
|
||||
pub const __STATFS_MATCHES_STATFS64: u32 = 1;
|
||||
pub const __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64: u32 = 1;
|
||||
pub const __FD_SETSIZE: u32 = 1024;
|
||||
pub const _BITS_TIME64_H: u32 = 1;
|
||||
pub const _BITS_WCHAR_H: u32 = 1;
|
||||
pub const _BITS_STDINT_INTN_H: u32 = 1;
|
||||
pub const _BITS_STDINT_UINTN_H: u32 = 1;
|
||||
pub const INT8_MIN: i32 = -128;
|
||||
pub const INT16_MIN: i32 = -32768;
|
||||
pub const INT32_MIN: i32 = -2147483648;
|
||||
pub const INT8_MAX: u32 = 127;
|
||||
pub const INT16_MAX: u32 = 32767;
|
||||
pub const INT32_MAX: u32 = 2147483647;
|
||||
pub const UINT8_MAX: u32 = 255;
|
||||
pub const UINT16_MAX: u32 = 65535;
|
||||
pub const UINT32_MAX: u32 = 4294967295;
|
||||
pub const INT_LEAST8_MIN: i32 = -128;
|
||||
pub const INT_LEAST16_MIN: i32 = -32768;
|
||||
pub const INT_LEAST32_MIN: i32 = -2147483648;
|
||||
pub const INT_LEAST8_MAX: u32 = 127;
|
||||
pub const INT_LEAST16_MAX: u32 = 32767;
|
||||
pub const INT_LEAST32_MAX: u32 = 2147483647;
|
||||
pub const UINT_LEAST8_MAX: u32 = 255;
|
||||
pub const UINT_LEAST16_MAX: u32 = 65535;
|
||||
pub const UINT_LEAST32_MAX: u32 = 4294967295;
|
||||
pub const INT_FAST8_MIN: i32 = -128;
|
||||
pub const INT_FAST16_MIN: i64 = -9223372036854775808;
|
||||
pub const INT_FAST32_MIN: i64 = -9223372036854775808;
|
||||
pub const INT_FAST8_MAX: u32 = 127;
|
||||
pub const INT_FAST16_MAX: u64 = 9223372036854775807;
|
||||
pub const INT_FAST32_MAX: u64 = 9223372036854775807;
|
||||
pub const UINT_FAST8_MAX: u32 = 255;
|
||||
pub const UINT_FAST16_MAX: i32 = -1;
|
||||
pub const UINT_FAST32_MAX: i32 = -1;
|
||||
pub const INTPTR_MIN: i64 = -9223372036854775808;
|
||||
pub const INTPTR_MAX: u64 = 9223372036854775807;
|
||||
pub const UINTPTR_MAX: i32 = -1;
|
||||
pub const PTRDIFF_MIN: i64 = -9223372036854775808;
|
||||
pub const PTRDIFF_MAX: u64 = 9223372036854775807;
|
||||
pub const SIG_ATOMIC_MIN: i32 = -2147483648;
|
||||
pub const SIG_ATOMIC_MAX: u32 = 2147483647;
|
||||
pub const SIZE_MAX: i32 = -1;
|
||||
pub const WINT_MIN: u32 = 0;
|
||||
pub const WINT_MAX: u32 = 4294967295;
|
||||
pub const INT8_WIDTH: u32 = 8;
|
||||
pub const UINT8_WIDTH: u32 = 8;
|
||||
pub const INT16_WIDTH: u32 = 16;
|
||||
pub const UINT16_WIDTH: u32 = 16;
|
||||
pub const INT32_WIDTH: u32 = 32;
|
||||
pub const UINT32_WIDTH: u32 = 32;
|
||||
pub const INT64_WIDTH: u32 = 64;
|
||||
pub const UINT64_WIDTH: u32 = 64;
|
||||
pub const INT_LEAST8_WIDTH: u32 = 8;
|
||||
pub const UINT_LEAST8_WIDTH: u32 = 8;
|
||||
pub const INT_LEAST16_WIDTH: u32 = 16;
|
||||
pub const UINT_LEAST16_WIDTH: u32 = 16;
|
||||
pub const INT_LEAST32_WIDTH: u32 = 32;
|
||||
pub const UINT_LEAST32_WIDTH: u32 = 32;
|
||||
pub const INT_LEAST64_WIDTH: u32 = 64;
|
||||
pub const UINT_LEAST64_WIDTH: u32 = 64;
|
||||
pub const INT_FAST8_WIDTH: u32 = 8;
|
||||
pub const UINT_FAST8_WIDTH: u32 = 8;
|
||||
pub const INT_FAST16_WIDTH: u32 = 64;
|
||||
pub const UINT_FAST16_WIDTH: u32 = 64;
|
||||
pub const INT_FAST32_WIDTH: u32 = 64;
|
||||
pub const UINT_FAST32_WIDTH: u32 = 64;
|
||||
pub const INT_FAST64_WIDTH: u32 = 64;
|
||||
pub const UINT_FAST64_WIDTH: u32 = 64;
|
||||
pub const INTPTR_WIDTH: u32 = 64;
|
||||
pub const UINTPTR_WIDTH: u32 = 64;
|
||||
pub const INTMAX_WIDTH: u32 = 64;
|
||||
pub const UINTMAX_WIDTH: u32 = 64;
|
||||
pub const PTRDIFF_WIDTH: u32 = 64;
|
||||
pub const SIG_ATOMIC_WIDTH: u32 = 32;
|
||||
pub const SIZE_WIDTH: u32 = 64;
|
||||
pub const WCHAR_WIDTH: u32 = 32;
|
||||
pub const WINT_WIDTH: u32 = 32;
|
||||
pub type __u_char = ffi::c_uchar;
|
||||
pub type __u_short = ffi::c_ushort;
|
||||
pub type __u_int = ffi::c_uint;
|
||||
pub type __u_long = ffi::c_ulong;
|
||||
pub type __int8_t = ffi::c_schar;
|
||||
pub type __uint8_t = ffi::c_uchar;
|
||||
pub type __int16_t = ffi::c_short;
|
||||
pub type __uint16_t = ffi::c_ushort;
|
||||
pub type __int32_t = ffi::c_int;
|
||||
pub type __uint32_t = ffi::c_uint;
|
||||
pub type __int64_t = ffi::c_long;
|
||||
pub type __uint64_t = ffi::c_ulong;
|
||||
pub type __int_least8_t = __int8_t;
|
||||
pub type __uint_least8_t = __uint8_t;
|
||||
pub type __int_least16_t = __int16_t;
|
||||
pub type __uint_least16_t = __uint16_t;
|
||||
pub type __int_least32_t = __int32_t;
|
||||
pub type __uint_least32_t = __uint32_t;
|
||||
pub type __int_least64_t = __int64_t;
|
||||
pub type __uint_least64_t = __uint64_t;
|
||||
pub type __quad_t = ffi::c_long;
|
||||
pub type __u_quad_t = ffi::c_ulong;
|
||||
pub type __intmax_t = ffi::c_long;
|
||||
pub type __uintmax_t = ffi::c_ulong;
|
||||
pub type __dev_t = ffi::c_ulong;
|
||||
pub type __uid_t = ffi::c_uint;
|
||||
pub type __gid_t = ffi::c_uint;
|
||||
pub type __ino_t = ffi::c_ulong;
|
||||
pub type __ino64_t = ffi::c_ulong;
|
||||
pub type __mode_t = ffi::c_uint;
|
||||
pub type __nlink_t = ffi::c_ulong;
|
||||
pub type __off_t = ffi::c_long;
|
||||
pub type __off64_t = ffi::c_long;
|
||||
pub type __pid_t = ffi::c_int;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct __fsid_t {
|
||||
pub __val: [ffi::c_int; 2usize],
|
||||
}
|
||||
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
|
||||
const _: () = {
|
||||
["Size of __fsid_t"][::std::mem::size_of::<__fsid_t>() - 8usize];
|
||||
["Alignment of __fsid_t"][::std::mem::align_of::<__fsid_t>() - 4usize];
|
||||
["Offset of field: __fsid_t::__val"][::std::mem::offset_of!(__fsid_t, __val) - 0usize];
|
||||
};
|
||||
pub type __clock_t = ffi::c_long;
|
||||
pub type __rlim_t = ffi::c_ulong;
|
||||
pub type __rlim64_t = ffi::c_ulong;
|
||||
pub type __id_t = ffi::c_uint;
|
||||
pub type __time_t = ffi::c_long;
|
||||
pub type __useconds_t = ffi::c_uint;
|
||||
pub type __suseconds_t = ffi::c_long;
|
||||
pub type __suseconds64_t = ffi::c_long;
|
||||
pub type __daddr_t = ffi::c_int;
|
||||
pub type __key_t = ffi::c_int;
|
||||
pub type __clockid_t = ffi::c_int;
|
||||
pub type __timer_t = *mut ffi::c_void;
|
||||
pub type __blksize_t = ffi::c_long;
|
||||
pub type __blkcnt_t = ffi::c_long;
|
||||
pub type __blkcnt64_t = ffi::c_long;
|
||||
pub type __fsblkcnt_t = ffi::c_ulong;
|
||||
pub type __fsblkcnt64_t = ffi::c_ulong;
|
||||
pub type __fsfilcnt_t = ffi::c_ulong;
|
||||
pub type __fsfilcnt64_t = ffi::c_ulong;
|
||||
pub type __fsword_t = ffi::c_long;
|
||||
pub type __ssize_t = ffi::c_long;
|
||||
pub type __syscall_slong_t = ffi::c_long;
|
||||
pub type __syscall_ulong_t = ffi::c_ulong;
|
||||
pub type __loff_t = __off64_t;
|
||||
pub type __caddr_t = *mut ffi::c_char;
|
||||
pub type __intptr_t = ffi::c_long;
|
||||
pub type __socklen_t = ffi::c_uint;
|
||||
pub type __sig_atomic_t = ffi::c_int;
|
||||
pub type int_least8_t = __int_least8_t;
|
||||
pub type int_least16_t = __int_least16_t;
|
||||
pub type int_least32_t = __int_least32_t;
|
||||
pub type int_least64_t = __int_least64_t;
|
||||
pub type uint_least8_t = __uint_least8_t;
|
||||
pub type uint_least16_t = __uint_least16_t;
|
||||
pub type uint_least32_t = __uint_least32_t;
|
||||
pub type uint_least64_t = __uint_least64_t;
|
||||
pub type int_fast8_t = ffi::c_schar;
|
||||
pub type int_fast16_t = ffi::c_long;
|
||||
pub type int_fast32_t = ffi::c_long;
|
||||
pub type int_fast64_t = ffi::c_long;
|
||||
pub type uint_fast8_t = ffi::c_uchar;
|
||||
pub type uint_fast16_t = ffi::c_ulong;
|
||||
pub type uint_fast32_t = ffi::c_ulong;
|
||||
pub type uint_fast64_t = ffi::c_ulong;
|
||||
pub type intmax_t = __intmax_t;
|
||||
pub type uintmax_t = __uintmax_t;
|
||||
extern "C" {
|
||||
pub fn cuda_convert_lwe_ciphertext_vector_to_gpu_64(
|
||||
stream: *mut ffi::c_void,
|
||||
@@ -274,10 +37,6 @@ extern "C" {
|
||||
pub const PBS_TYPE_MULTI_BIT: PBS_TYPE = 0;
|
||||
pub const PBS_TYPE_CLASSICAL: PBS_TYPE = 1;
|
||||
pub type PBS_TYPE = ffi::c_uint;
|
||||
pub const PBS_VARIANT_DEFAULT: PBS_VARIANT = 0;
|
||||
pub const PBS_VARIANT_CG: PBS_VARIANT = 1;
|
||||
pub const PBS_VARIANT_TBC: PBS_VARIANT = 2;
|
||||
pub type PBS_VARIANT = ffi::c_uint;
|
||||
extern "C" {
|
||||
pub fn scratch_cuda_integer_compress_radix_ciphertext_64(
|
||||
streams: *const *mut ffi::c_void,
|
||||
@@ -361,10 +120,6 @@ extern "C" {
|
||||
mem_ptr_void: *mut *mut i8,
|
||||
);
|
||||
}
|
||||
pub const OUTPUT_CARRY_NONE: OUTPUT_CARRY = 0;
|
||||
pub const OUTPUT_CARRY_GENERATED: OUTPUT_CARRY = 1;
|
||||
pub const OUTPUT_CARRY_PROPAGATED: OUTPUT_CARRY = 2;
|
||||
pub type OUTPUT_CARRY = ffi::c_uint;
|
||||
pub const SHIFT_OR_ROTATE_TYPE_LEFT_SHIFT: SHIFT_OR_ROTATE_TYPE = 0;
|
||||
pub const SHIFT_OR_ROTATE_TYPE_RIGHT_SHIFT: SHIFT_OR_ROTATE_TYPE = 1;
|
||||
pub const SHIFT_OR_ROTATE_TYPE_LEFT_ROTATE: SHIFT_OR_ROTATE_TYPE = 2;
|
||||
@@ -386,13 +141,6 @@ pub const COMPARISON_TYPE_LE: COMPARISON_TYPE = 5;
|
||||
pub const COMPARISON_TYPE_MAX: COMPARISON_TYPE = 6;
|
||||
pub const COMPARISON_TYPE_MIN: COMPARISON_TYPE = 7;
|
||||
pub type COMPARISON_TYPE = ffi::c_uint;
|
||||
pub const CMP_ORDERING_IS_INFERIOR: CMP_ORDERING = 0;
|
||||
pub const CMP_ORDERING_IS_EQUAL: CMP_ORDERING = 1;
|
||||
pub const CMP_ORDERING_IS_SUPERIOR: CMP_ORDERING = 2;
|
||||
pub type CMP_ORDERING = ffi::c_uint;
|
||||
pub const SIGNED_OPERATION_ADDITION: SIGNED_OPERATION = 1;
|
||||
pub const SIGNED_OPERATION_SUBTRACTION: SIGNED_OPERATION = -1;
|
||||
pub type SIGNED_OPERATION = ffi::c_int;
|
||||
extern "C" {
|
||||
pub fn scratch_cuda_apply_univariate_lut_kb_64(
|
||||
streams: *const *mut ffi::c_void,
|
||||
|
||||
Reference in New Issue
Block a user