pub struct PreparedKernel {
pub id: u64,
pub ast: Arc<UOp>,
pub kernel: Arc<CachedKernel>,
pub device: DeviceSpec,
pub buffer_indices: Vec<usize>,
pub output_indices: Vec<usize>,
pub vals: Vec<i64>,
pub fixedvars: HashMap<String, i64>,
pub dependencies: Vec<u64>,
pub buffer_ptrs: Vec<usize>,
pub buffer_ids: Vec<BufferId>,
pub runtime_vars: Vec<RuntimeVar>,
}Expand description
A pre-compiled kernel ready for execution.
Variable values are stored as positional vals: Vec<i64> rather than a named
HashMap, matching Tinygrad’s vals: tuple[int, ...] parameter style.
Fields§
§id: u64Unique identifier (from original AST).
ast: Arc<UOp>§kernel: Arc<CachedKernel>Compiled kernel program (Arc-shared from cache).
device: DeviceSpecDevice this kernel executes on.
buffer_indices: Vec<usize>Indices into ExecutionPlan::buffers for this kernel’s buffers.
Ordered as expected by the kernel (matches codegen buffer order).
output_indices: Vec<usize>Indices of output buffers within buffer_indices.
vals: Vec<i64>Variable values in positional order (matches var_names in CachedKernel).
fixedvars: HashMap<String, i64>Fixed variable bindings captured at prepare time.
These mirror Tinygrad’s fixedvars semantics: values fixed by scheduling
(for example from bound ranges) are not overridden by execute_with_vars.
dependencies: Vec<u64>Kernel IDs that must complete before this one (dependencies).
buffer_ptrs: Vec<usize>Pre-computed raw buffer addresses for low-allocation execution. Computed once during prepare(), stable for the lifetime of ExecutionPlan. SAFETY: Pointers are valid as long as ExecutionPlan owns the buffers.
buffer_ids: Vec<BufferId>Pre-computed buffer IDs for dependency tracking.
runtime_vars: Vec<RuntimeVar>Cached (name, min_val, max_val) triples for every DefineVar reachable
from ast. Populated at construction so validate_runtime_var_bounds
doesn’t re-toposort on every execute call.
Trait Implementations§
Source§impl Clone for PreparedKernel
impl Clone for PreparedKernel
Source§fn clone(&self) -> PreparedKernel
fn clone(&self) -> PreparedKernel
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 PreparedKernel
impl !RefUnwindSafe for PreparedKernel
impl Send for PreparedKernel
impl Sync for PreparedKernel
impl Unpin for PreparedKernel
impl UnsafeUnpin for PreparedKernel
impl !UnwindSafe for PreparedKernel
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> 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