Skip to content

num::kernel::gemm_config

Defined in header <kernel/dense.hpp>

template <std::floating_point T>
struct gemm_config;

The blocking gemm uses on this target, derived at compile time.

The Goto/BLIS structure: an mr x nr register-tiled microkernel over kc inner products, fed from packed panels of A and B. mr and nr come from the vector width and register count, and kc, mc, nc from NUM_K_L1_BYTES, NUM_K_L2_BYTES and NUM_K_GEMM_PANEL_BYTES. See the kernel page for the per-target shapes.

Members

member description
static constexpr idx width = / sizeof(T) Elements per vector register.
static constexpr idx b_vectors = (>= 32 && width <= 2) ? 3 : 2 B vectors held per microkernel: three when the file is wide and the vectors narrow (NEON), else two.
static constexpr idx mr = std::min<idx>(14, ((- b_vectors - 2) / b_vectors) & ~idx{1}) Rows of the register tile: what remains of the file after the B vectors and two broadcast registers, at most 14, rounded to even.
static constexpr idx nr = b_vectors * width Columns of the register tile.
static constexpr idx kc = std::clamp<idx>(detail::round_down((/ 2) / (sizeof(T) * nr), 8), 8, 512) Inner-product length per microkernel call: the kc x nr B sliver takes half of L1. Capped at 512, since a longer kc only shrinks the other blocks.
static constexpr idx mc = std::max<idx>( mr, detail::round_down(std::min<idx>(/ 2, idx{1} << 20) / (sizeof(T) * kc), mr)) Rows of the packed A slab: half of L2, at most 1 MiB.
static constexpr idx nc = std::max<idx>(nr, detail::round_down(/ (sizeof(T) * kc), nr)) Columns of the packed B panel.
static constexpr idx workspace = (mc * kc) + (kc * nc) Elements of workspace the packed panels need at their largest.