pub struct KernelCaps {
pub strided_input: bool,
pub requires_broadcast: bool,
}Expand description
Per-binding capability flags. Today carries one flag — strided_input
— that signals “this kernel walks input strides explicitly and so
can consume non-contiguous input layouts (including stride-0
broadcast axes) without auto-Contiguize materializing them first.”
The executor’s contiguize gate consults this to skip the materialize
step for capable kernels, so broadcast/transpose/slice layouts can
reach the kernel as metadata-only views.
Default is the conservative all-false; binding sites opt in via
KernelBindingTable::register_with_caps. Forward-extensible by
adding fields (no enum/bitflags churn).
Fields§
§strided_input: boolKernel handles non-contiguous input layouts directly (consumes
the strides side-channel from KernelRef::layouts). When true,
the executor passes non-contiguous inputs through unchanged
instead of running auto-Contiguize first. Inputs with non-zero
start_offset still go through auto-Contiguize today (slicing
the device buffer to honor offset is a separate concern).
requires_broadcast: boolThis kernel BAKES a specific broadcast pattern into its body — a
broadcast_stride0: required operand it reads as stride-0 (hoisting
in[0] / dropping the bcast-axis stride terms). It is therefore NOT
a generic dense-safe kernel: a dense operand routed here would be
read WRONG (element 0 repeatedly). The realize pick
(KernelBindingTable::lookup_with_caps) SKIPS such a sibling so a dense operand
is never routed into a broadcast-baked kernel — the exclusion is
order-independent (it does not rest on the generic contract being
registered first). Selecting it CORRECTLY, for an operand genuinely
stride-0 on exactly the required axes, is the layout-aware follow-on
(path 1b) that also teaches the contiguize gate; today the safe
behavior is to exclude it, so a required-broadcast contract is a
present-but-never-mis-selected sibling. Defaults false — every
existing binding is unaffected (the pick stays first-registered).
Implementations§
Source§impl KernelCaps
impl KernelCaps
Sourcepub const fn empty() -> Self
pub const fn empty() -> Self
All flags off. Equivalent to Default::default(); provided as a
const for use in const-context registration tables.
Sourcepub const fn strided_input() -> Self
pub const fn strided_input() -> Self
Just strided_input on. Ergonomic for binary/unary registrations
that opt in to the wrapper-side broadcast path.
Trait Implementations§
Source§impl Clone for KernelCaps
impl Clone for KernelCaps
impl Copy for KernelCaps
Source§impl Debug for KernelCaps
impl Debug for KernelCaps
Source§impl Default for KernelCaps
impl Default for KernelCaps
impl Eq for KernelCaps
Source§impl PartialEq for KernelCaps
impl PartialEq for KernelCaps
impl StructuralPartialEq for KernelCaps
Auto Trait Implementations§
impl Freeze for KernelCaps
impl RefUnwindSafe for KernelCaps
impl Send for KernelCaps
impl Sync for KernelCaps
impl Unpin for KernelCaps
impl UnsafeUnpin for KernelCaps
impl UnwindSafe for KernelCaps
Blanket Implementations§
impl<T> Boilerplate 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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