﻿# Matrix tiling on GPUs: reuse explains the tile

GPU matrix tiling reuses loaded values across multiple products; tile dimensions must balance reuse with shared storage, registers and edge work.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/learn-gemm-tiling-reuse/
Language: en

Matrix multiplication offers many opportunities to reuse the same input values. GPU tiling organizes that reuse around blocks, shared storage and register accumulators. A tile is therefore a unit of coordinated data movement and arithmetic, rather than simply a convenient rectangle drawn on a matrix diagram.

## A product needs reused input rows and columns

Each output element combines a row from one matrix and a column from another. Neighboring output elements reuse parts of those inputs. A naive implementation can fetch the same values repeatedly through separate threads. A cooperative tile stages a useful region so several products can consume it. The implementation must preserve which staged value belongs to which mathematical coordinate, especially when storage layout differs from the original matrix.

Primary reference: [CUDA Programming Guide: Writing SIMT Kernels](https://docs.nvidia.com/cuda/cuda-programming-guide/02-basics/writing-cuda-kernels.html).

## Move the tile through a hierarchy

Global-memory loads bring data toward cooperative storage, while threads consume fragments and update accumulators. Reuse can occur at several levels, including caches, shared memory and registers. These levels have different ownership and capacity. Saying that an algorithm is tiled does not identify where reuse actually occurs. A useful explanation follows one input value from its load through the products that reuse it and the synchronization that keeps it valid.

Primary reference: [CUDA C++ Best Practices Guide](https://docs.nvidia.com/cuda/cuda-c-best-practices-guide/).

## The inner loop creates a reuse schedule

Consider output tiles that require several successive slices of the reduction dimension. Each slice must arrive before consumption and remain valid until its consumers finish. Double buffering can prepare a later slice while computation uses the current one, but it adds storage and synchronization. The mathematical operation stays the same while its movement schedule changes. This example makes data lifetime as important as the number of arithmetic instructions.

Primary reference: [Nsight Compute Profiling Guide](https://docs.nvidia.com/nsight-compute/ProfilingGuide/index.html).

## Larger reuse can mean fewer alternatives

A larger tile may improve reuse while increasing registers and shared-memory demand. It can reduce resident blocks or add masked work at matrix edges. Different shapes therefore expose different balances, even on the same GPU. Include rectangular and boundary cases rather than evaluating only large square matrices. A tile selected for a broad batch should not be assumed optimal for a narrow decode-like matrix operation.

## Validate the reuse claim

Keep the operation, input layout and numerical tolerance explicit when comparing tile designs. Inspect transferred data, resource use and completion rather than inferring success from the tile size. Compare with an appropriate library implementation as a reference for this shape, without assuming a universal winner. The resulting analysis should explain which values were reused, where they lived and what extra coordination was required to make that reuse correct.

Related reading: [A GPU inference benchmark you can trust](/journal/inference-benchmark-method/); [Reproducible inference stacks: preserving a GPU pilot’s result](/journal/software-stack-reproducibility/).
