pub struct FuseSwiGLU;Expand description
Detects the post-FuseSharedInputMatMul SwiGLU pattern and replaces it
with a single Op::FusedSwiGLU node consuming the concatenated matmul.
Pattern (after FuseSharedInputMatMul has fused fc11+fc12 into one mm):
%cat = matmul(%x, concat(%fc11_w, %fc12_w)) ; shape […, 2N]
%up = narrow(%cat, axis=-1, 0, N) ; shape […, N]
%gate = narrow(%cat, axis=-1, N, N) ; shape […, N]
%silu = silu(%gate)
%out = mul(%up, %silu)
Becomes: %out = fused_swiglu(%cat)
Saves three kernel launches (two narrows + silu + mul → one kernel) and keeps up/gate resident in registers.
Single-use guard: only fuses when each intermediate (narrow, narrow, silu) has exactly one consumer. The mul may have any number of consumers.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FuseSwiGLU
impl RefUnwindSafe for FuseSwiGLU
impl Send for FuseSwiGLU
impl Sync for FuseSwiGLU
impl Unpin for FuseSwiGLU
impl UnsafeUnpin for FuseSwiGLU
impl UnwindSafe for FuseSwiGLU
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
Mutably borrows from an owned value. Read more