Skip to main content

Module tiling

Module tiling 

Source
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 (see gemm Theorem 3).
  • Scalar: TILE_M = TILE_N = 1 is 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§

TilingPolicy
Zero-sized strategy marker for tiled execution policy.
_TileMarker
Zero-sized type used to force TilingPolicy into a generic bound without runtime cost.

Traits§

TilingStrategy
Trait representing a monomorphized register-blocking/tiling strategy.

Functions§

tiled_dot
Compute the dot product of two slices using TILE_M independent vector accumulators.
tiled_gemm
Compute a register-blocked tiled GEMM: c += A * B.
tiled_gemv
Compute a register-blocked tiled GEMV: y += A * x.