# Kernele mnożenia macierzy (GEMM)

EN: **Matrix multiplication kernels (GEMM)** · id `gemm`

Path: [AI Atlas](https://aiatlasgraph.com/llms.txt) › [Inferencja i infrastruktura](https://aiatlasgraph.com/t/systems.md) › [GPU i obliczenia rozproszone](https://aiatlasgraph.com/t/compute.md) › Kernele mnożenia macierzy (GEMM)

## Description

- PL: Serce obliczeń AI: jak z mnożenia macierzy wycisnąć wydajność bliską możliwościom sprzętu.
- EN: The heart of AI compute: squeezing near-peak hardware throughput out of matrix multiplication.

## In one sentence

- PL: To wydajne mnożenie tabel liczb, na którym opiera się wiele obliczeń modeli.
- EN: This efficiently multiplies number arrays, a foundation of many model calculations.

## Problem it solves

- PL: Sieć wielokrotnie mnoży duże zestawy liczb, więc niewydajna implementacja spowalnia cały model.
- EN: A network repeatedly multiplies large number arrays, so inefficient implementation slows the entire model.

## What it does

- PL: Program dzieli tabele na bloki, ponownie wykorzystuje załadowane dane i dopasowuje pracę do jednostek mnożących sprzętu.
- EN: A program splits arrays into blocks, reuses loaded data and matches execution to the hardware's multiplication units.

## Everyday example

- PL: Przyspieszasz warstwę modelu, mierząc różne sposoby mnożenia jej tabel ustawień i danych wejściowych.
- EN: You accelerate a model layer by measuring different ways to multiply its parameter and input arrays.

## This concerns you if you…

- PL: mnożenie macierzy dominuje w pomiarach czasu
- PL: chcesz dopasować obliczenia do sprzętu
- EN: find matrix multiplication dominates runtime
- EN: want to match computation to hardware

## Keywords

tiling · shared-memory staging · register blocking · cuBLAS · CUTLASS · arithmetic intensity · matrix accumulation

## How it works

- PL: Macierze dzieli się na kafelki, których fragmenty ładuje się do szybkiej pamięci i wielokrotnie wykorzystuje. Iloczyny częściowe akumuluje się w rejestrach lub jednostkach macierzowych, a harmonogram ukrywa transfery za obliczeniami.
- EN: Matrices are tiled, loading fragments into fast memory for repeated reuse. Partial products accumulate in registers or matrix units, while scheduling hides transfers behind computation.

## Limits

- PL: Rozmiary, układ danych i precyzja wpływają na dobór kafelków. Małe lub wąskie macierze słabo wykorzystują sprzęt; większe kafelki mogą ograniczać occupancy przez zużycie zasobów.
- EN: Shapes, layouts and precision affect tile choices. Small or narrow matrices underutilise hardware; larger tiles can reduce occupancy through resource consumption.

## Key terms

- PL: **akumulacja**: Sumowanie częściowych iloczynów do elementów macierzy wynikowej.
- PL: **reuse danych**: Ponowne użycie załadowanego fragmentu zamiast kolejnego transferu.
- EN: **accumulation**: Summing partial products into output-matrix elements.
- EN: **data reuse**: Reusing a loaded fragment instead of transferring it again.

## Know first

- [Algebra liniowa: wektory i macierze (Linear algebra: vectors and matrices)](https://aiatlasgraph.com/t/linearalgebra.md)
- [Programowanie GPU (CUDA) (GPU programming (CUDA))](https://aiatlasgraph.com/t/gpuprog.md)

## Examples

- PL: kafelkowanie · pamięć współdzielona · roofline
- EN: tiling · shared memory · roofline

## Related topics

Untyped, symmetric "see also" links.

- [FlashAttention](https://aiatlasgraph.com/t/flashattn.md)
- [Kernele pisane przez LLM (LLM-generated kernels)](https://aiatlasgraph.com/t/llmkernels.md)

## Sources

- [Performance Engineering for AI Infra — learning guide](<https://github.com/wafer-ai/gpu-perf-engineering-resources>) `wafer-gpu` · GitHub repository · tiered curriculum (Tier 1–3) · MIT licence · by Wafer (wafer-ai): Company material with a hiring note, but the evidence is mostly primary sources. Table of contents sieved: only topics became nodes; tiers kept as link labels.

---

AI Atlas revision 122 (2026-10-30) · HTML: https://aiatlasgraph.com/t/gemm · index: https://aiatlasgraph.com/llms.txt · everything: https://aiatlasgraph.com/llms-full.txt · updated 2026-10-30
