pub struct FusedPlan {
pub input_count: usize,
pub outputs: TinyVec<[usize; 5]>,
pub ops: TinyVec<[FusedInst; 8]>,
}Expand description
Topologically ordered fused elementwise SSA DAG.
Values are numbered in evaluation order. Input values occupy
0..input_count; each instruction appends one value after the previous
inputs/instructions. For example, with input_count == 2, the first
instruction writes value 2, the second writes value 3, and so on.
outputs contains the value ids to write to dests in order.
The program is stored inline: at most eight instructions, five outputs and
OPERAND_CAP inputs per instruction, spilling
to the heap only above those bounds. Build one with FusedPlan::new to
keep vec!-based construction ergonomic; the pub fields accept the inline
collection directly. (Changing the field type from Vec is a 0.6.0 breaking
change.)
All inputs and destinations passed to fused_elementwise_into must have
the same shape and scalar type. Broadcast inputs should be represented with
StridedView::broadcast before building the plan; the fused API does not
perform implicit broadcasting.
Fields§
§input_count: usize§outputs: TinyVec<[usize; 5]>§ops: TinyVec<[FusedInst; 8]>Implementations§
Source§impl FusedPlan
impl FusedPlan
Sourcepub fn new(
input_count: usize,
outputs: impl IntoIterator<Item = usize>,
ops: impl IntoIterator<Item = FusedInst>,
) -> FusedPlan
pub fn new( input_count: usize, outputs: impl IntoIterator<Item = usize>, ops: impl IntoIterator<Item = FusedInst>, ) -> FusedPlan
Build a plan from an input count, output value ids, and instructions.
use strided_fused::{FusedInst, FusedOp, FusedPlan};
let plan = FusedPlan::new(
2,
vec![3],
vec![
FusedInst::new(FusedOp::Add, vec![0, 1]),
FusedInst::new(FusedOp::Negate, vec![2]),
],
);
assert_eq!(plan.ops.len(), 2);Trait Implementations§
impl Eq for FusedPlan
impl StructuralPartialEq for FusedPlan
Auto Trait Implementations§
impl Freeze for FusedPlan
impl RefUnwindSafe for FusedPlan
impl Send for FusedPlan
impl Sync for FusedPlan
impl Unpin for FusedPlan
impl UnsafeUnpin for FusedPlan
impl UnwindSafe for FusedPlan
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> 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