pub struct PtxModuleCache { /* private fields */ }Expand description
Process-wide NVRTC module cache for a single PTX source string.
The first call to PtxModuleCache::get_or_compile compiles the
source via cudarc::nvrtc::compile_ptx, loads the module on the
supplied context, and stores the resulting Arc<CudaModule>.
Subsequent calls return the cached module without recompiling.
The label is woven into the error message so the originating
backend stays identifiable in logs; the wording matches each
caller’s previous bespoke format! so existing log assertions
continue to hold.
Implementations§
Source§impl PtxModuleCache
impl PtxModuleCache
pub const fn new() -> Self
pub fn get(&self) -> Option<&Arc<CudaModule>>
Sourcepub fn get_or_compile(
&self,
ctx: &Arc<CudaContext>,
label: &'static str,
source: &str,
) -> Result<&Arc<CudaModule>, GpuError>
pub fn get_or_compile( &self, ctx: &Arc<CudaContext>, label: &'static str, source: &str, ) -> Result<&Arc<CudaModule>, GpuError>
Compile source and load it on ctx the first time; return
the cached Arc<CudaModule> on every subsequent call.
Trait Implementations§
Source§impl Default for PtxModuleCache
impl Default for PtxModuleCache
Source§fn default() -> PtxModuleCache
fn default() -> PtxModuleCache
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for PtxModuleCache
impl RefUnwindSafe for PtxModuleCache
impl Send for PtxModuleCache
impl Sync for PtxModuleCache
impl Unpin for PtxModuleCache
impl UnsafeUnpin for PtxModuleCache
impl UnwindSafe for PtxModuleCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more