pub struct CachedKernel {
pub program: Box<dyn Program>,
pub device: String,
pub code: String,
pub entry_point: String,
pub var_names: Vec<String>,
pub globals: Vec<usize>,
pub outs: Vec<usize>,
pub ins: Vec<usize>,
pub host_parallel_safe: bool,
pub global_size: [Arc<UOp>; 3],
pub local_size: Option<[Arc<UOp>; 3]>,
}Expand description
Cached kernel that can be reused across tensors.
Note: This struct does not implement Clone because Box<dyn Program> is not Clone.
Use Arc<CachedKernel> for sharing.
Fields§
§program: Box<dyn Program>The compiled, executable program.
device: StringDevice string (e.g., “CPU”, “CUDA:0”).
code: StringGenerated source code (for debugging/profiling).
entry_point: StringEntry point name.
var_names: Vec<String>Variable names in order for converting HashMap to positional vals. Matches the order expected by the compiled program.
globals: Vec<usize>Global buffer slots in kernel argument order. Matches Tinygrad’s ProgramSpec.globals semantics.
outs: Vec<usize>Output buffer slots written by STORE operations. Matches Tinygrad’s ProgramSpec.outs semantics.
ins: Vec<usize>Input buffer slots read by LOAD operations. Matches Tinygrad’s ProgramSpec.ins semantics.
host_parallel_safe: boolWhether host-level scheduling may overlap this program with other kernels.
Thread-safety is required by the Program trait. This flag is about
backend/kernel semantics, not Rust synchronization safety.
global_size: [Arc<UOp>; 3]Symbolic global work size evaluated with runtime vars before dispatch.
local_size: Option<[Arc<UOp>; 3]>Symbolic local work size. None means direct global-id execution.
Auto 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> 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