pub enum Op {
Show 17 variants
Dot {
a: VReg,
b: VReg,
d: SReg,
},
Sum {
a: VReg,
d: SReg,
},
Max {
a: VReg,
d: SReg,
},
Vec {
op: Bin,
a: VReg,
b: VReg,
d: VReg,
},
VecScalar {
op: Bin,
a: VReg,
s: SReg,
d: VReg,
},
Map {
f: Func,
a: VReg,
d: VReg,
},
Scalar {
op: Bin,
a: SReg,
b: SReg,
d: SReg,
},
ScalarMap {
f: Func,
a: SReg,
d: SReg,
},
Const {
value: f32,
d: SReg,
},
Hadamard {
a: VReg,
d: VReg,
},
Rotate {
a: VReg,
cos: VReg,
sin: VReg,
d: VReg,
neox: bool,
},
ArgMax {
a: VReg,
d: SReg,
},
AbsMax {
a: VReg,
d: SReg,
},
Codes {
a: VReg,
s: SReg,
d: VReg,
},
Scale {
a: VReg,
n: i8,
d: VReg,
},
MulAdd {
a: VReg,
b: VReg,
c: VReg,
d: VReg,
},
MulAddScalar {
a: VReg,
b: VReg,
s: SReg,
d: VReg,
},
}Expand description
One instruction.
Variants§
Dot
s[d] = Σ v[a]_i·v[b]_i, lanes then the tree.
Sum
s[d] = Σ v[a]_i, lanes then the tree.
Max
s[d] = max_i v[a]_i (super::numerics::fmax).
Vec
v[d]_i = v[a]_i ∘ v[b]_i.
VecScalar
v[d]_i = v[a]_i ∘ s[s].
Map
v[d]_i = f(v[a]_i).
Scalar
s[d] = s[a] ∘ s[b].
ScalarMap
s[d] = f(s[a]).
Const
s[d] = value.
Hadamard
v[d] = v[a] rotated by the Walsh–Hadamard transform, unnormalized.
Rotate
v[d] = v[a] with its first 2·len(v[cos]) elements turned in pairs by the rotary table v[cos], v[sin]
(super::numerics::rope): pair i is (i, i + len) under NEOX, (2i, 2i + 1) otherwise.
ArgMax
s[d] = the index of v[a]’s largest element, the first of equals, as an f32 (super::numerics::argmax).
AbsMax
s[d] = the largest magnitude in v[a] (super::numerics::absmax).
Codes
v[d]_i = the int8 code of v[a]_i under the inverse scale s[s], as an f32
(super::numerics::int8_codes).
Scale
v[d]_i = v[a]_i·2^n (super::numerics::ldexp): exact while normal, infinite past the top, a zero of its sign
below the normals — not a product, which rounds a value just below the normals up into them.
MulAdd
v[d]_i = v[c]_i + v[a]_i·v[b]_i: the product rounded, then the sum — a Mul then an Add, in one pass.
MulAddScalar
v[d]_i = v[a]_i·v[b]_i + s[s]: the product rounded, then the sum.
Implementations§
Trait Implementations§
impl Copy for Op
impl StructuralPartialEq for Op
Auto Trait Implementations§
impl Freeze for Op
impl RefUnwindSafe for Op
impl Send for Op
impl Sync for Op
impl Unpin for Op
impl UnsafeUnpin for Op
impl UnwindSafe for Op
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.