pub struct TensorKernelRegistry { /* private fields */ }Expand description
Registry of computational kernels with dynamic lookup and versioning.
Implementations§
Source§impl TensorKernelRegistry
impl TensorKernelRegistry
Sourcepub fn register(
&mut self,
name: String,
version: u32,
precision: KernelPrecision,
target: KernelTarget,
flops_per_element: f64,
tags: Vec<String>,
) -> u64
pub fn register( &mut self, name: String, version: u32, precision: KernelPrecision, target: KernelTarget, flops_per_element: f64, tags: Vec<String>, ) -> u64
Register a new kernel and return its assigned kernel_id.
§Arguments
name— Operation name (e.g."matmul").version— Caller-supplied version number.precision— Numeric precision.target— Execution target.flops_per_element— Approximate FLOPs per output element.tags— Searchable tag strings.
Sourcepub fn lookup(&mut self, query: &KernelQuery) -> Vec<&KernelDescriptor>
pub fn lookup(&mut self, query: &KernelQuery) -> Vec<&KernelDescriptor>
Query the registry and return matching KernelDescriptor references.
All non-None query fields must match. Results are sorted by
(name asc, version desc, kernel_id asc).
Increments KernelRegistryStats::total_lookups.
Sourcepub fn best_for(
&mut self,
name: &str,
precision: KernelPrecision,
) -> Option<&KernelDescriptor>
pub fn best_for( &mut self, name: &str, precision: KernelPrecision, ) -> Option<&KernelDescriptor>
Select the best kernel for name + precision.
Target preference: Simd > Cpu > Gpu > Generic. Within the same target,
the highest version wins.
Increments KernelRegistryStats::total_lookups.
Sourcepub fn remove(&mut self, kernel_id: u64) -> bool
pub fn remove(&mut self, kernel_id: u64) -> bool
Remove a kernel by id.
Returns true if the kernel existed and was removed, false otherwise.
Sourcepub fn get(&self, kernel_id: u64) -> Option<&KernelDescriptor>
pub fn get(&self, kernel_id: u64) -> Option<&KernelDescriptor>
Retrieve a kernel by id without modifying stats.
Sourcepub fn stats(&self) -> &KernelRegistryStats
pub fn stats(&self) -> &KernelRegistryStats
Return a reference to the current registry statistics.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TensorKernelRegistry
impl RefUnwindSafe for TensorKernelRegistry
impl Send for TensorKernelRegistry
impl Sync for TensorKernelRegistry
impl Unpin for TensorKernelRegistry
impl UnsafeUnpin for TensorKernelRegistry
impl UnwindSafe for TensorKernelRegistry
Blanket Implementations§
impl<T> Allocation for T
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> 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>
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