mtl5.mixed.matmul#
- mtl5.mixed.matmul(...)#
Overloaded function.
matmul(A: mtl5._core.DenseMatrix_i8, B: mtl5._core.DenseMatrix_i8, accumulator: str | None = None) -> mtl5._core.DenseMatrix_i32
Integer matrix product, accumulated in int32. Returns a DenseMatrix_i32.
accumulator=’i32’ is required, as for mixed.dot on these dtypes: the default would be element precision, and an 8-bit result wraps almost at once. The result type is the ACCUMULATOR’s, which is the one way an integer matmul differs from the float ones.
Every product is exact and the sum wraps mod 2^32 (two’s complement), so the result equals the naive triple loop bit for bit at any size, thread count or blocking. Headroom is as for mixed.dot: about 131000 full-range i8 x i8 terms per entry, but only one full-range i16 x i16 term.
This is the widen-on-load kernel (mtl::mult<int32_t>). The hardware quad multiply-accumulate is mixed.matmul_quad, a separate function on purpose: the two agree bit for bit, so which one ran cannot be read off a result.
matmul(A: ndarray[dtype=int8, shape=(*, *), order='C', device='cpu', writable=False], B: ndarray[dtype=int8, shape=(*, *), order='C', device='cpu', writable=False], accumulator: str | None = None) -> mtl5._core.DenseMatrix_i32
Integer matrix product, accumulated in int32. Returns a DenseMatrix_i32.
accumulator=’i32’ is required, as for mixed.dot on these dtypes: the default would be element precision, and an 8-bit result wraps almost at once. The result type is the ACCUMULATOR’s, which is the one way an integer matmul differs from the float ones.
Every product is exact and the sum wraps mod 2^32 (two’s complement), so the result equals the naive triple loop bit for bit at any size, thread count or blocking. Headroom is as for mixed.dot: about 131000 full-range i8 x i8 terms per entry, but only one full-range i16 x i16 term.
This is the widen-on-load kernel (mtl::mult<int32_t>). The hardware quad multiply-accumulate is mixed.matmul_quad, a separate function on purpose: the two agree bit for bit, so which one ran cannot be read off a result.
matmul(A: mtl5._core.DenseMatrix_i16, B: mtl5._core.DenseMatrix_i16, accumulator: str | None = None) -> mtl5._core.DenseMatrix_i32
Integer matrix product, accumulated in int32. Returns a DenseMatrix_i32.
accumulator=’i32’ is required, as for mixed.dot on these dtypes: the default would be element precision, and an 8-bit result wraps almost at once. The result type is the ACCUMULATOR’s, which is the one way an integer matmul differs from the float ones.
Every product is exact and the sum wraps mod 2^32 (two’s complement), so the result equals the naive triple loop bit for bit at any size, thread count or blocking. Headroom is as for mixed.dot: about 131000 full-range i8 x i8 terms per entry, but only one full-range i16 x i16 term.
This is the widen-on-load kernel (mtl::mult<int32_t>). The hardware quad multiply-accumulate is mixed.matmul_quad, a separate function on purpose: the two agree bit for bit, so which one ran cannot be read off a result.
matmul(A: ndarray[dtype=int16, shape=(*, *), order='C', device='cpu', writable=False], B: ndarray[dtype=int16, shape=(*, *), order='C', device='cpu', writable=False], accumulator: str | None = None) -> mtl5._core.DenseMatrix_i32
Integer matrix product, accumulated in int32. Returns a DenseMatrix_i32.
accumulator=’i32’ is required, as for mixed.dot on these dtypes: the default would be element precision, and an 8-bit result wraps almost at once. The result type is the ACCUMULATOR’s, which is the one way an integer matmul differs from the float ones.
Every product is exact and the sum wraps mod 2^32 (two’s complement), so the result equals the naive triple loop bit for bit at any size, thread count or blocking. Headroom is as for mixed.dot: about 131000 full-range i8 x i8 terms per entry, but only one full-range i16 x i16 term.
This is the widen-on-load kernel (mtl::mult<int32_t>). The hardware quad multiply-accumulate is mixed.matmul_quad, a separate function on purpose: the two agree bit for bit, so which one ran cannot be read off a result.
matmul(A: mtl5._core.DenseMatrix_u8, B: mtl5._core.DenseMatrix_u8, accumulator: str | None = None) -> mtl5._core.DenseMatrix_i32
Integer matrix product, accumulated in int32. Returns a DenseMatrix_i32.
accumulator=’i32’ is required, as for mixed.dot on these dtypes: the default would be element precision, and an 8-bit result wraps almost at once. The result type is the ACCUMULATOR’s, which is the one way an integer matmul differs from the float ones.
Every product is exact and the sum wraps mod 2^32 (two’s complement), so the result equals the naive triple loop bit for bit at any size, thread count or blocking. Headroom is as for mixed.dot: about 131000 full-range i8 x i8 terms per entry, but only one full-range i16 x i16 term.
This is the widen-on-load kernel (mtl::mult<int32_t>). The hardware quad multiply-accumulate is mixed.matmul_quad, a separate function on purpose: the two agree bit for bit, so which one ran cannot be read off a result.
matmul(A: ndarray[dtype=uint8, shape=(*, *), order='C', device='cpu', writable=False], B: ndarray[dtype=uint8, shape=(*, *), order='C', device='cpu', writable=False], accumulator: str | None = None) -> mtl5._core.DenseMatrix_i32
Integer matrix product, accumulated in int32. Returns a DenseMatrix_i32.
accumulator=’i32’ is required, as for mixed.dot on these dtypes: the default would be element precision, and an 8-bit result wraps almost at once. The result type is the ACCUMULATOR’s, which is the one way an integer matmul differs from the float ones.
Every product is exact and the sum wraps mod 2^32 (two’s complement), so the result equals the naive triple loop bit for bit at any size, thread count or blocking. Headroom is as for mixed.dot: about 131000 full-range i8 x i8 terms per entry, but only one full-range i16 x i16 term.
This is the widen-on-load kernel (mtl::mult<int32_t>). The hardware quad multiply-accumulate is mixed.matmul_quad, a separate function on purpose: the two agree bit for bit, so which one ran cannot be read off a result.
matmul(A: mtl5._core.DenseMatrix_u8, B: mtl5._core.DenseMatrix_i8, accumulator: str | None = None) -> mtl5._core.DenseMatrix_i32
Integer matrix product, accumulated in int32. Returns a DenseMatrix_i32.
accumulator=’i32’ is required, as for mixed.dot on these dtypes: the default would be element precision, and an 8-bit result wraps almost at once. The result type is the ACCUMULATOR’s, which is the one way an integer matmul differs from the float ones.
Every product is exact and the sum wraps mod 2^32 (two’s complement), so the result equals the naive triple loop bit for bit at any size, thread count or blocking. Headroom is as for mixed.dot: about 131000 full-range i8 x i8 terms per entry, but only one full-range i16 x i16 term.
This is the widen-on-load kernel (mtl::mult<int32_t>). The hardware quad multiply-accumulate is mixed.matmul_quad, a separate function on purpose: the two agree bit for bit, so which one ran cannot be read off a result.
matmul(A: ndarray[dtype=uint8, shape=(*, *), order='C', device='cpu', writable=False], B: ndarray[dtype=int8, shape=(*, *), order='C', device='cpu', writable=False], accumulator: str | None = None) -> mtl5._core.DenseMatrix_i32
Integer matrix product, accumulated in int32. Returns a DenseMatrix_i32.
accumulator=’i32’ is required, as for mixed.dot on these dtypes: the default would be element precision, and an 8-bit result wraps almost at once. The result type is the ACCUMULATOR’s, which is the one way an integer matmul differs from the float ones.
Every product is exact and the sum wraps mod 2^32 (two’s complement), so the result equals the naive triple loop bit for bit at any size, thread count or blocking. Headroom is as for mixed.dot: about 131000 full-range i8 x i8 terms per entry, but only one full-range i16 x i16 term.
This is the widen-on-load kernel (mtl::mult<int32_t>). The hardware quad multiply-accumulate is mixed.matmul_quad, a separate function on purpose: the two agree bit for bit, so which one ran cannot be read off a result.
matmul(A: mtl5._core.DenseMatrix_i8, B: mtl5._core.DenseMatrix_u8, accumulator: str | None = None) -> mtl5._core.DenseMatrix_i32
Integer matrix product, accumulated in int32. Returns a DenseMatrix_i32.
accumulator=’i32’ is required, as for mixed.dot on these dtypes: the default would be element precision, and an 8-bit result wraps almost at once. The result type is the ACCUMULATOR’s, which is the one way an integer matmul differs from the float ones.
Every product is exact and the sum wraps mod 2^32 (two’s complement), so the result equals the naive triple loop bit for bit at any size, thread count or blocking. Headroom is as for mixed.dot: about 131000 full-range i8 x i8 terms per entry, but only one full-range i16 x i16 term.
This is the widen-on-load kernel (mtl::mult<int32_t>). The hardware quad multiply-accumulate is mixed.matmul_quad, a separate function on purpose: the two agree bit for bit, so which one ran cannot be read off a result.
matmul(A: ndarray[dtype=int8, shape=(*, *), order='C', device='cpu', writable=False], B: ndarray[dtype=uint8, shape=(*, *), order='C', device='cpu', writable=False], accumulator: str | None = None) -> mtl5._core.DenseMatrix_i32
Integer matrix product, accumulated in int32. Returns a DenseMatrix_i32.
accumulator=’i32’ is required, as for mixed.dot on these dtypes: the default would be element precision, and an 8-bit result wraps almost at once. The result type is the ACCUMULATOR’s, which is the one way an integer matmul differs from the float ones.
Every product is exact and the sum wraps mod 2^32 (two’s complement), so the result equals the naive triple loop bit for bit at any size, thread count or blocking. Headroom is as for mixed.dot: about 131000 full-range i8 x i8 terms per entry, but only one full-range i16 x i16 term.
This is the widen-on-load kernel (mtl::mult<int32_t>). The hardware quad multiply-accumulate is mixed.matmul_quad, a separate function on purpose: the two agree bit for bit, so which one ran cannot be read off a result.
matmul(A: mtl5._core.DenseMatrix_fp8, B: mtl5._core.DenseMatrix_fp8, accumulator: str | None = None) -> mtl5._core.DenseMatrix_fp8matmul(A: mtl5._core.DenseMatrix_fp16, B: mtl5._core.DenseMatrix_fp16, accumulator: str | None = None) -> mtl5._core.DenseMatrix_fp16matmul(A: mtl5._core.DenseMatrix_posit8, B: mtl5._core.DenseMatrix_posit8, accumulator: str | None = None) -> mtl5._core.DenseMatrix_posit8matmul(A: mtl5._core.DenseMatrix_posit16, B: mtl5._core.DenseMatrix_posit16, accumulator: str | None = None) -> mtl5._core.DenseMatrix_posit16matmul(A: mtl5._core.DenseMatrix_posit32, B: mtl5._core.DenseMatrix_posit32, accumulator: str | None = None) -> mtl5._core.DenseMatrix_posit32matmul(A: mtl5._core.DenseMatrix_posit64, B: mtl5._core.DenseMatrix_posit64, accumulator: str | None = None) -> mtl5._core.DenseMatrix_posit64matmul(A: mtl5._core.DenseMatrix_fixpnt8, B: mtl5._core.DenseMatrix_fixpnt8, accumulator: str | None = None) -> mtl5._core.DenseMatrix_fixpnt8matmul(A: mtl5._core.DenseMatrix_fixpnt16, B: mtl5._core.DenseMatrix_fixpnt16, accumulator: str | None = None) -> mtl5._core.DenseMatrix_fixpnt16matmul(A: mtl5._core.DenseMatrix_lns16, B: mtl5._core.DenseMatrix_lns16, accumulator: str | None = None) -> mtl5._core.DenseMatrix_lns16matmul(A: mtl5._core.DenseMatrix_lns32, B: mtl5._core.DenseMatrix_lns32, accumulator: str | None = None) -> mtl5._core.DenseMatrix_lns32matmul(A: mtl5._core.DenseMatrix_cfloat32, B: mtl5._core.DenseMatrix_cfloat32, accumulator: str | None = None) -> mtl5._core.DenseMatrix_cfloat32matmul(A: mtl5._core.DenseMatrix_takum32, B: mtl5._core.DenseMatrix_takum32, accumulator: str | None = None) -> mtl5._core.DenseMatrix_takum32matmul(A: mtl5._core.DenseMatrix_dd_cascade, B: mtl5._core.DenseMatrix_dd_cascade, accumulator: str | None = None) -> mtl5._core.DenseMatrix_dd_cascadematmul(A: mtl5._core.DenseMatrix_td_cascade, B: mtl5._core.DenseMatrix_td_cascade, accumulator: str | None = None) -> mtl5._core.DenseMatrix_td_cascadematmul(A: mtl5._core.DenseMatrix_qd_cascade, B: mtl5._core.DenseMatrix_qd_cascade, accumulator: str | None = None) -> mtl5._core.DenseMatrix_qd_cascade