#[non_exhaustive]pub enum AttentionKernel {
Vector {
passes: u8,
blocks: i32,
dispatches: i32,
},
Tiled,
Composed,
ComposedBlocks {
rows: i32,
},
}Expand description
The kernel family an attention call runs (see plan_attention).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Vector
At most 8 queries: MLX’s vector kernels. passes is 1 or 2; blocks the key
partitions of the first of two passes (1 for one pass; the largest over
dispatches); dispatches is more than 1 when query rows need different one-query
configurations (the serial rule).
Fields
Tiled
MLX’s tiled (steel) attention kernel: no scores are materialised.
Composed
The composition: softmax(scale · q kᵀ + mask) v from matrix products.
ComposedBlocks
The composition per block of rows queries, one block after another.
Trait Implementations§
Source§impl Clone for AttentionKernel
impl Clone for AttentionKernel
impl Copy for AttentionKernel
Source§impl Debug for AttentionKernel
impl Debug for AttentionKernel
impl Eq for AttentionKernel
Source§impl PartialEq for AttentionKernel
impl PartialEq for AttentionKernel
impl StructuralPartialEq for AttentionKernel
Auto Trait Implementations§
impl Freeze for AttentionKernel
impl RefUnwindSafe for AttentionKernel
impl Send for AttentionKernel
impl Sync for AttentionKernel
impl Unpin for AttentionKernel
impl UnsafeUnpin for AttentionKernel
impl UnwindSafe for AttentionKernel
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
Mutably borrows from an owned value. Read more
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<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> ⓘ
Converts
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> ⓘ
Converts
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