IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
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

Struct_matmul_int8_w8a8_apple

struct Struct_matmul_int8_w8a8_apple

Apple M5 int8 W8A8 matmul (no bias): out = dequant(quant(a) @ b^T).

A single FUSED graph op wrapping int8_matmul.mojo (online activation quant

  • int8 widening-MMA GEMM + dequant, all internal). Inputs (matching nn/kernels.py::_apple_int8_w8a8_matmul with bias=None): a bf16 [M, K]; b int8 [N, K] (transpose_b); b_scale fp32 per-channel [N] (the Python squeezes the rowwise [N, 1]). Output c_type [M, N]. The bias variant is the sibling mo.matmul.int8.w8a8.apple.bias op (custom-op input arity is fixed per registration, so the optional bias is a separate op name -- the same idiom as mo.fused_qkv_matmul.ragged.paged{,.bias}).

Implemented traitsโ€‹

AnyType, ImplicitlyDeletable

Methodsโ€‹

executeโ€‹

static def execute[c_type: DType, //, target: StringSlice[ImmStaticOrigin]](c: ManagedTensorSlice[IOSpec[_, _].Output, static_spec=c.static_spec], a: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=a.static_spec], b: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=b.static_spec], b_scale: ManagedTensorSlice[IOSpec[_, _].Input, static_spec=b_scale.static_spec], context: DeviceContext)