Expand description
Register-blocked, cache-aware tiling for dot products, GEMV, and GEMM.
§Motivation
A standard dot/GEMV/GEMM loop has a loop-carried FMA dependency chain that
limits throughput to one FMA per FMA-latency window. Unrolling into TILE_M
independent accumulator registers breaks this chain, saturating the FMA issue
ports on modern CPUs:
- AVX-512 (32 ZMM regs): larger tiles (e.g.
TILE_M = 8) fit the register file; the GEMM dispatcher selects<3,4>for f64. - AVX2 (16 YMM regs): the GEMM dispatcher selects the register-resident
<3,3>f64 tile (seegemmTheorem 3). - Scalar:
TILE_M = TILE_N = 1is the standard loop; const monomorphization eliminates all tiling overhead at zero cost.
§Structure (separation of concerns)
This module owns the TilingStrategy trait surface and the zero-sized
TilingPolicy tile-shape marker; the per-operation kernels live in vertical
leaf modules, each carrying its own correctness/throughput theorems:
dot— register-blocked dot product (dependency-chain throughput theorem).gemv— matrix–vector product (operand-reuse theorem).gemm— matrix multiplication (correctness, packing-invariance, register-residency, and cache cost-model theorems).
The TilingPolicy trait methods are thin monomorphizing delegators to those
leaf kernels — one authoritative implementation per operation (SSOT/DRY).
Modules§
- dot
- Register-blocked dot product micro-kernel.
- gemm
- Register-blocked, cache-aware matrix multiplication (
C += A · B). - gemv
- Register-blocked matrix–vector product micro-kernel (
y += A · x). - gemv_
transpose - Register-blocked transposed matrix–vector product (
y += Aᵀ · x).
Structs§
- Tiling
Policy - Zero-sized strategy marker for tiled execution policy.
- _Tile
Marker - Zero-sized type used to force
TilingPolicyinto a generic bound without runtime cost.
Traits§
- Tiling
Strategy - Trait representing a monomorphized register-blocking/tiling strategy.
Functions§
- tiled_
dot - Compute the dot product of two slices using
TILE_Mindependent vector accumulators. - tiled_
gemm - Compute a register-blocked tiled GEMM:
c += A * B. - tiled_
gemv - Compute a register-blocked tiled GEMV:
y += A * x.