For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo struct
MatmulSwiGLU
struct MatmulSwiGLU
Fused GEMM+SwiGLU on SM100 for BF16 inputs.
Computes output[m, h] = silu(x @ W_gate[h, :]) * (x @ W_up[h, :])
in a single SM100 kernel. The weight b must be pre-permuted on its N
axis so that gate/up column pairs are adjacent (sigma permutation:
sigma(2i)=i, sigma(2i+1)=H+i where H=N/2).
Output shape is [M, H] where H = N/2, saving the slice+silu+mul
elementwise kernel entirely.
Implemented traitsโ
Methodsโ
executeโ
static def execute[target: StringSlice[ImmStaticOrigin]](output: ManagedTensorSlice[IOSpec[_, _].Output, static_spec=output.static_spec], a: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=a.static_spec], b: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=b.static_spec], ctx: DeviceContext)
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!