pub struct CachedKernel {
pub fingerprint: u64,
pub ptx: Arc<EmittedPtx>,
pub compiled: CompiledHandle,
/* private fields */
}Expand description
Cached PTX module entry.
integrity_hash is a BLAKE3 over ptx.text computed at construction
time and re-verified on every KernelCache::get (jit S-3). It defends
against in-memory poisoning by a sibling holder of a mutable reference
and forms the basis of the integrity tag stored in the on-disk
persistence layer (see DiskCacheConfig). The field is pub so
downstream tests and observability can inspect the recorded hash, but
construction via CachedKernel::new is the only path that produces a
correct-by-construction value — KernelCache::put calls verify
before accepting the entry, so a hand-crafted CachedKernel with a
mismatched hash will be rejected.
Fields§
§fingerprint: u64The blueprint that produced this PTX (for diagnostics).
ptx: Arc<EmittedPtx>The emitted PTX text.
compiled: CompiledHandleThe cuda module handle is only meaningful when the cuda feature is
on; for the stub path we keep ().
Implementations§
Source§impl CachedKernel
impl CachedKernel
Sourcepub fn integrity_hash(&self) -> &[u8; 32]
pub fn integrity_hash(&self) -> &[u8; 32]
Borrow the stored BLAKE3 integrity hash over ptx.text. Prefer this
over reaching for the (hidden) field directly — the field is
retained as pub for source compatibility only and may be sealed
to pub(crate) in a future minor release.
Sourcepub fn new(
fingerprint: u64,
ptx: Arc<EmittedPtx>,
compiled: CompiledHandle,
) -> Self
pub fn new( fingerprint: u64, ptx: Arc<EmittedPtx>, compiled: CompiledHandle, ) -> Self
Construct a CachedKernel, computing integrity_hash from
ptx.text. This is the only way to obtain a correct-by-
construction value; the older struct-literal pattern still works
(the field is pub for backward compatibility) but the literal
must provide a matching hash or KernelCache::put will reject it.
Sourcepub fn verify_integrity(&self) -> bool
pub fn verify_integrity(&self) -> bool
Re-compute the integrity hash and compare it against the stored
value. Returns true iff the PTX text has not been tampered with
since Self::new ran.
Trait Implementations§
Source§impl Clone for CachedKernel
impl Clone for CachedKernel
Source§fn clone(&self) -> CachedKernel
fn clone(&self) -> CachedKernel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CachedKernel
impl RefUnwindSafe for CachedKernel
impl Send for CachedKernel
impl Sync for CachedKernel
impl Unpin for CachedKernel
impl UnsafeUnpin for CachedKernel
impl UnwindSafe for CachedKernel
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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