Skip to main content

Module arena

Module arena 

Source
Expand description

The step-local memory of a lane’s forms. Every array a step computes and reads within the step — a tensor’s f32 (or i32) buffer, or its quantized form — lives in one arena the program allocates once, placed by its lifetime: from the launch that first writes it whole to the last launch that touches it, through any view of it. A launch’s scratch lives there while the launch runs. The forms share the arena, one form running at a time.

Structs§

Arena
A form’s arena: its placed arrays, its launches’ placed scratch, and the bytes they span.
Placed
An array placed in the arena: bytes from offset, live from launch first to launch last of its form.
PlacedScratch
A launch’s scratch placed in the arena: bytes from offset, live while launch launch of its form runs.
Scratch
A launch’s scratch: tag names it beside the launch’s result, ty is its element type and bytes its size. A counter — an arrival count the launch’s last block resets — is zero before the launch and left zero by it, so it keeps a zeroed buffer of its own; the rest live in the arena while the launch runs.

Constants§

ALIGN
Every array’s alignment in the arena: cudaMalloc’s, past every vector load the kernels make.

Functions§

array_bytes
The bytes of a tensor of len elements’ array: its f32 buffer, or its quantized form — the int8 words, then the low words under two words, then a scale a block — each part aligned.
home
The tensor whose array a touch of tensor name lands in: an alias’s — a view’s — is the tensor it is a part of, through every alias, but the quantized form of an alias whose rows start inside a block is its own.
place
Place the arrays of s that live within its step: a computed tensor’s that is not one of the step’s inputs or outputs, all of it written before any launch reads it — whole, or part by part over every unit (join_in_place) — so nothing the step reads of it was left by another array, or by an earlier step. Each lives from its first touch to its last, through any view of it. The largest first, each at the lowest aligned offset clear of every array placed live beside it.
quant_parts
Where the parts of a quantized array placed at offset start: its words, its low words under two words, its scales.
scratch
The scratch launch l takes under numerics: the delta rule’s unnormed outputs; an expert mixture’s router logits, choices and weights, and over a block’s rows its choices grouped by expert, each choice’s gathered activation row, hidden row (gate and up rows apart on the tensor cores, the hidden row quantized alone when they are paired) and weighed result; a tensor-core projection’s parts of the tiles its last wave cuts along k, and their counts; an f32 GEMM’s parts of the tiles it cuts along k; the arg-max’s block maxima; a split attention’s chunk partials (none in tiles); an attention in two words’ keys and values in two words and their scales — and the arrival counts.