For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
MAX accelerator library
The MAX accelerator library is the Mojo API for hardware-accelerated programming. It covers GPU primitives, the compute kernels that MAX graphs execute, the tensor layouts those kernels are written against, and the extension points for adding your own operations.
API summaryβ
- Program a GPU directly with
max.gpu: thread and block indexing, memory spaces, synchronization, and host-side device management. - Describe how tensors sit in memory with
layout: layouts, tiling, and the tensor types kernels are written against. - Call ready-made compute kernels from
linalgfor linear algebra such as matrix multiplication,nnfor neural-network operators such as attention and convolution,quantizationfor quantized weight encodings, andkv_cachefor transformer key-value caches. - Add your own operation to a MAX graph by writing it against
extensibility. - Spread work across GPUs and nodes with
commfor multi-GPU collectives andshmemfor multi-node communication. - Time and profile a kernel with
max.benchmarkfor timing harnesses andprofiling_rangefor annotating profiler traces.
Package organizationβ
max is a top-level package with subpackages, so its members carry the max
prefix:
from max.gpu.compute import mma
from max.benchmark import BenchThe rest are top-level packages alongside max:
from linalg.matmul import matmul
from layout import TileTensor, row_majorThe split tracks where the code lives today. More of these packages will move
under max in later releases.
Packagesβ
- β
algorithm: Free-form row-wise reduction library: theReduceOpmonoid trait, therowwisescaffolder (Row/reduce/map/emit), and the Row-based pure reductions used by the graph reduction kernels. - β
builtin_kernels: Provides the graph compiler's built-in kernel registrations. - β
comm: Provides communication primitives for multi-GPU workloads. - β
extensibility: Surface needed to write GraphCompiler kernel entry points. - β
kv_cache: Contains implementations for several types of key-value caches. - β
layout: Provides layout and layout tensor types, which abstract memory layout for multidimensional data. - β
linalg: Provides CPU and GPU implementations of linear algebra functions. - β
max: The MAX library for hardware-accelerated programming in Mojo. - β
nn: Provides neural network operators for deep learning models. - β
pipeline: Generic compile-time software pipelining for GPU kernels: schedule generation and verification. - β
profiling_range: Provides Mojo wrappers for MAX's libkineto-backed range profiler. - β
quantization: This package contains a set of APIs for quantizing tensor data. - β
shmem: Implements a subset of OpenSHMEM for multi-node GPU communication. - β
state_space: State space model kernels for Mamba and related architectures. - β
structured_kernels: Shared GPU kernel primitives for structured kernel architectures.