pub struct BinaryPlan<T: Element, const N: usize> { /* private fields */ }Expand description
Binary elementwise plan.
T: Element is the kernel’s element type (today: must be f32).
const N: usize is the tensor rank — fixed at compile time to keep
the descriptor heap-free and the rank invariants type-checked.
Implementations§
Source§impl<T: Element, const N: usize> BinaryPlan<T, N>
impl<T: Element, const N: usize> BinaryPlan<T, N>
Sourcepub fn select(
_stream: &Stream,
desc: &BinaryDescriptor<N>,
_pref: PlanPreference,
) -> Result<Self>
pub fn select( _stream: &Stream, desc: &BinaryDescriptor<N>, _pref: PlanPreference, ) -> Result<Self>
Pick a kernel for desc. Returns Error::Unsupported if the
(kind, T::KIND) pair isn’t wired today.
Sourcepub fn can_implement(&self, args: &BinaryArgs<'_, T, N>) -> Result<()>
pub fn can_implement(&self, args: &BinaryArgs<'_, T, N>) -> Result<()>
Validate that this plan can launch with args.
Accepts both fully-contiguous operands (which take the contig
fast path) and broadcast / strided operands (which take the
strided path). For each axis d, each input operand must
satisfy shape[d] == y.shape[d] (no broadcast on that axis) or
shape[d] == 1 && stride[d] == 0 (broadcast on that axis). The
output must be exactly desc.shape and is conventionally
contiguous, though the strided kernel accepts arbitrary y
strides too.
Sourcepub fn workspace_size(&self) -> usize
pub fn workspace_size(&self) -> usize
Workspace size in bytes. Always 0 for the trailblazer SKU.
Sourcepub fn precision_guarantee(&self) -> PrecisionGuarantee
pub fn precision_guarantee(&self) -> PrecisionGuarantee
Numerical guarantees for this plan’s kernel.