From 03cf21e5ddc769af54db47d20451aebea6e8658a Mon Sep 17 00:00:00 2001 From: Corey Lowman Date: Thu, 30 Oct 2025 09:42:32 -0400 Subject: [PATCH] #474 Block cuCtxCreate_v4() --- bindings_generator/src/main.rs | 21 ++++-------- bindings_generator/src/merge.rs | 4 ++- src/driver/sys/mod.rs | 60 --------------------------------- 3 files changed, 10 insertions(+), 75 deletions(-) diff --git a/bindings_generator/src/main.rs b/bindings_generator/src/main.rs index b9dd2c70..5fa46583 100644 --- a/bindings_generator/src/main.rs +++ b/bindings_generator/src/main.rs @@ -58,6 +58,8 @@ fn create_modules() -> Vec { functions: vec![ "^cuCheckpoint.*", "cuDeviceGetNvSciSyncAttributes", + // NOTE: see https://github.com/coreylowman/cudarc/issues/474 + "cuCtxCreate_v4", ], vars: vec![], }, @@ -108,10 +110,7 @@ fn create_modules() -> Vec { allowlist_recursively: true, blocklist: Filters { types: vec![], - functions: vec![ - "curandGenerateBinomial", - "curandGenerateBinomialMethod", - ], + functions: vec!["curandGenerateBinomial", "curandGenerateBinomialMethod"], vars: vec![], }, libs: vec!["curand"], @@ -238,10 +237,7 @@ fn create_modules() -> Vec { allowlist_recursively: true, blocklist: Filters { types: vec!["^cusolverMg.*"], - functions: vec![ - "^cusolverMg.*", - "^cusolverDnLogger.*", - ], + functions: vec!["^cusolverMg.*", "^cusolverDnLogger.*"], vars: vec!["^cusolverMg.*"], }, libs: vec!["cusolver"], @@ -285,7 +281,7 @@ fn create_modules() -> Vec { vars: vec!["^nvtx.*"], }, allowlist_recursively: true, - blocklist: Filters { + blocklist: Filters { types: vec![], functions: vec!["nvtxInitialize"], vars: vec![], @@ -341,10 +337,7 @@ fn create_modules() -> Vec { }, libs: vec!["cupti"], clang_args: vec![], - raw_lines: vec![ - "use crate::driver::sys::*;", - "use crate::runtime::sys::*;", - ], + raw_lines: vec!["use crate::driver::sys::*;", "use crate::runtime::sys::*;"], }, ] } @@ -530,7 +523,7 @@ fn create_bindings(modules: &[ModuleConfig], cuda_versions: &[&str]) -> Result<( } else { vec!["cuda_nvcc"] }; - + let archive_pb = multi_progress.add(ProgressBar::new(names.len() as u64)); archive_pb.set_style( ProgressStyle::default_bar().template("{msg} {wide_bar} {pos}/{len} ({eta})")?, diff --git a/bindings_generator/src/merge.rs b/bindings_generator/src/merge.rs index 09acb0c1..5de72671 100644 --- a/bindings_generator/src/merge.rs +++ b/bindings_generator/src/merge.rs @@ -193,7 +193,9 @@ impl BindingMerger { .or_default() .insert(version, func.clone()); } - other => println!("WARNING: Unhandled foreign item {other:?} in {path:?}... SKIPPING"), + other => println!( + "WARNING: Unhandled foreign item {other:?} in {path:?}... SKIPPING" + ), } } } diff --git a/src/driver/sys/mod.rs b/src/driver/sys/mod.rs index 31990aac..718e45f5 100644 --- a/src/driver/sys/mod.rs +++ b/src/driver/sys/mod.rs @@ -8572,19 +8572,6 @@ extern "C" { flags: ::core::ffi::c_uint, dev: CUdevice, ) -> CUresult; - #[cfg(any( - feature = "cuda-12050", - feature = "cuda-12060", - feature = "cuda-12080", - feature = "cuda-12090", - feature = "cuda-13000" - ))] - pub fn cuCtxCreate_v4( - pctx: *mut CUcontext, - ctxCreateParams: *mut CUctxCreateParams, - flags: ::core::ffi::c_uint, - dev: CUdevice, - ) -> CUresult; pub fn cuCtxDestroy_v2(ctx: CUcontext) -> CUresult; pub fn cuCtxDetach(ctx: CUcontext) -> CUresult; pub fn cuCtxDisablePeerAccess(peerContext: CUcontext) -> CUresult; @@ -11920,21 +11907,6 @@ mod loaded { ) -> CUresult { (culib().cuCtxCreate_v3)(pctx, paramsArray, numParams, flags, dev) } - #[cfg(any( - feature = "cuda-12050", - feature = "cuda-12060", - feature = "cuda-12080", - feature = "cuda-12090", - feature = "cuda-13000" - ))] - pub unsafe fn cuCtxCreate_v4( - pctx: *mut CUcontext, - ctxCreateParams: *mut CUctxCreateParams, - flags: ::core::ffi::c_uint, - dev: CUdevice, - ) -> CUresult { - (culib().cuCtxCreate_v4)(pctx, ctxCreateParams, flags, dev) - } pub unsafe fn cuCtxDestroy_v2(ctx: CUcontext) -> CUresult { (culib().cuCtxDestroy_v2)(ctx) } @@ -16550,19 +16522,6 @@ mod loaded { flags: ::core::ffi::c_uint, dev: CUdevice, ) -> CUresult, - #[cfg(any( - feature = "cuda-12050", - feature = "cuda-12060", - feature = "cuda-12080", - feature = "cuda-12090", - feature = "cuda-13000" - ))] - pub cuCtxCreate_v4: unsafe extern "C" fn( - pctx: *mut CUcontext, - ctxCreateParams: *mut CUctxCreateParams, - flags: ::core::ffi::c_uint, - dev: CUdevice, - ) -> CUresult, pub cuCtxDestroy_v2: unsafe extern "C" fn(ctx: CUcontext) -> CUresult, pub cuCtxDetach: unsafe extern "C" fn(ctx: CUcontext) -> CUresult, pub cuCtxDisablePeerAccess: unsafe extern "C" fn(peerContext: CUcontext) -> CUresult, @@ -20001,17 +19960,6 @@ mod loaded { .get(b"cuCtxCreate_v3\0") .map(|sym| *sym) .expect("Expected symbol in library"); - #[cfg(any( - feature = "cuda-12050", - feature = "cuda-12060", - feature = "cuda-12080", - feature = "cuda-12090", - feature = "cuda-13000" - ))] - let cuCtxCreate_v4 = __library - .get(b"cuCtxCreate_v4\0") - .map(|sym| *sym) - .expect("Expected symbol in library"); let cuCtxDestroy_v2 = __library .get(b"cuCtxDestroy_v2\0") .map(|sym| *sym) @@ -23218,14 +23166,6 @@ mod loaded { feature = "cuda-12090" ))] cuCtxCreate_v3, - #[cfg(any( - feature = "cuda-12050", - feature = "cuda-12060", - feature = "cuda-12080", - feature = "cuda-12090", - feature = "cuda-13000" - ))] - cuCtxCreate_v4, cuCtxDestroy_v2, cuCtxDetach, cuCtxDisablePeerAccess,