Skip to main content

CudaMegakernelPlanCache

Struct CudaMegakernelPlanCache 

Source
pub struct CudaMegakernelPlanCache { /* private fields */ }
Expand description

Bounded LRU cache for CUDA megakernel topology plans.

Implementations§

Source§

impl CudaMegakernelPlanCache

Source

pub fn new() -> Self

Create a cache with the default production entry bound.

Source

pub fn with_max_entries(max_entries: usize) -> Self

Create a cache with an explicit entry bound.

Source

pub fn get_or_insert_with( &mut self, key: CudaMegakernelPlanCacheKey, build: impl FnOnce() -> CudaMegakernelTopologyDecision, ) -> Result<CudaMegakernelCachedPlan, CudaMegakernelMemoryError>

Return a cached plan or insert a newly selected topology decision.

Source

pub fn get_or_select_topology( &mut self, graph_layout_hash: u64, analysis_kind: CudaMegakernelAnalysisKind, device: CudaMegakernelDeviceKey, sample: CudaMegakernelScheduleSample, graph: CudaMegakernelGraphShape, memory: CudaMegakernelMemoryBudget, launch_overhead_ns: f64, fusion_pressure: f64, ) -> Result<CudaMegakernelCachedPlan, CudaMegakernelMemoryError>

Return a cached topology plan or select and cache one from the current CUDA telemetry sample.

This is the hot-path convenience API: callers provide stable graph, analysis, device, and telemetry inputs, while the cache owns the pressure bucketing needed to avoid stale sparse/dense decisions.

Source

pub fn get_or_plan_execution( &mut self, graph_layout_hash: u64, analysis_kind: CudaMegakernelAnalysisKind, device: CudaMegakernelDeviceKey, sample: CudaMegakernelScheduleSample, graph: CudaMegakernelGraphShape, bytes_per_node: u64, bytes_per_edge: u64, frontier_bytes: u64, scratch_bytes: u64, output_bytes: u64, budget_bytes: u64, launch_overhead_ns: f64, fusion_pressure: f64, ) -> Result<CudaMegakernelExecutionPlan, CudaMegakernelMemoryError>

Return a cache-backed, memory-validated CUDA megakernel execution plan.

The cache key uses sparse-plan memory pressure because sparse is the lower-bound resident footprint shared by every topology. A cache hit reuses the prior topology decision, then this method validates the exact current dense/fused/sparse byte budget before returning a launchable plan. If the cached non-sparse topology no longer fits, the method downgrades to sparse only after proving the sparse plan fits.

Source

pub fn stats(&self) -> CudaMegakernelPlanCacheStats

Return cache counters.

Source

pub fn clear(&mut self)

Drop every cached plan and preserve counters for observability.

Trait Implementations§

Source§

impl Debug for CudaMegakernelPlanCache

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for CudaMegakernelPlanCache

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more