Skip to main content

Module image

Module image 

Source
Expand description

The weight image: a checkpoint’s tensors laid out over the card’s memory channels in the order a pass reads them, so each channel streams its share of every pass as one run of lines.

A tensor is its rows, a row being its innermost dimension: a matrix’s rows are its output rows, a vector is one row. The image cuts each tensor into tiles of whole rows packed end to end, as many as fill TILE_LINES lines (one row when a row alone is larger), and starts every tile on a line. A kernel stored tap-major has a tap’s every channel for a row; a tap larger than a tile is cut into the fewest equal runs of channels that fit one, each run a row of the image, so the machine’s own layout never makes a tile past the tile’s lines. A tensor’s tiles go to the channels in turn, least loaded first: the channels sorted by the lines they hold before it, ties to the lower channel, and the tiles dealt round that order. Every tile but a tensor’s last holds the same rows, so a row’s place is arithmetic (Image::locate): the tensor’s tile, the channel its turn falls on, and that channel’s first line of the tensor plus the tensor’s earlier tiles there.

The deal keeps the channels within one tile of each other after every tile, so when all four stream at one rate each tile arrives within one tile’s time of its turn, and the order on every channel is the read order. With a check word (ImageLayout::check) every tile ends in the CRC-32C of its lines before it, little-endian, in the last four bytes of its last line, the bytes between its rows and the check word zero: the integrity a memory controller built without ECC leaves to the image when all 72 bits of a beat carry data.

A layout with a stripe (ImageLayout::stripe) of n pairs deals every tensor a matvec job streams through the array in tiles of 2n rows instead, each tile block-major: every row’s block 0, then every row’s block 1, and so on, so a channel’s tile is the row pairs its columns hold, a block of each at a time, in the order the columns take them. The tiles 4s..4s+3 of a striped tensor are the four channels’ shares of its stripe s, which the array runs a block step at a time; the default layout has no stripe.

The order is the caller’s. image_of lays out a machine layout’s tensors (decode_engine::machine::Layout, in the order the program first reads them) as the machine stores them, a convolution kernel tap-major, so the image and the machine hold one tensor list; the card’s images and the ledger are made so (machine_of reads the layout off a header ledger). TensorTable::read_order orders a bare tensor table as the engine’s step reads a qwen35 checkpoint, then every tensor the step does not read, in the table’s order.

Structs§

Image
A checkpoint laid out on the channels: its tensors in the order given, its tiles in that order, and the lines each channel holds.
ImageLayout
How an image lays its tiles: over how many channels, in lines of how many bytes, how many lines a tile fills, how many lines a channel holds, whether every tile carries a check word, the row pairs a channel’s tile of a streamed tensor holds when the image is laid in stripes for the streaming engine’s array, and whether a streamed Q8_0 tensor’s blocks lie eight to one of the array’s blocks (its octets: a row’s eight blocks one after another, 256 elements in 272 bytes), and the bytes a block of a tensor laid in stripes takes rounded up to (its slot: the block’s bytes, then zeros; 1 for blocks packed as the checkpoint packs them).
ImageLedger
ImageRow
One checkpoint’s image at one beat, summed: its tensors and tiles, the bytes of rows, of padding and of check words, each channel’s lines, the most two channels differ by and the largest tile.
Placement
Where one tensor lies: its rows in the image and their size — each stored row cut into pieces equal runs, more than one only for a tap-major kernel’s tap past a tile — the rows every tile but its last holds and the lines such a tile takes, the channels in the order its tiles are dealt, the line each of them holds its first tile of the tensor at, its tiles’ run in Image::tiles, its taps when it is stored tap-major, the bytes of its format’s block, whether its tiles hold their rows block-major (laid in stripes), and the zeros each of a striped tensor’s blocks is padded with to the image’s slot.
TensorEntry
One tensor as the image stores it: its name, format and stored dims (innermost first); for a convolution kernel stored tap-major, its taps: then each stored row is one tap’s every channel, the transpose of the checkpoint’s rows of each channel’s taps; and whether a matvec job streams it through the array, which a layout with a stripe lays in stripes.
TensorTable
A checkpoint’s tensor table and the blocks its step runs (the rest are drafting blocks).
Tile
A run of one tensor’s rows [first_row, end_row) on one channel from line line, over lines lines.

Enums§

ImageError
Why a checkpoint has no image.

Constants§

CHECK_BYTES
Bytes of a tile’s check word.
HEADERS
The Qwen3.8-27B checkpoints whose images the ledger lays out.
TILE_LINES
Lines a tile fills before the next channel’s turn. Modeled: the skew one channel’s tile buffer must cover.

Functions§

crc32c
CRC-32C (Castagnoli: the reflected polynomial 0x82F63B78, initial value and final xor all ones), a byte at a time.
image_ledger
Every HEADERS checkpoint’s machine image (image_of over machine_of) on the D5005 at both beats.
image_of
The weight image the machine runs over: machine’s tensors in its order, each stored as the machine reads it — a convolution kernel tap-major, its taps rows of every channel — laid out under layout.
machine_of
The machine layout of the checkpoint h describes, at the engine’s fastest knob point, one sequence of one position: what its weight image is laid out from.
streamed_image_of
The weight image of the matrices machine’s matvec jobs stream, in its order and no other tensor, laid out under layout (in stripes when it has one), with each image tensor’s index in the machine’s: what the hybrid engine’s streaming matvec reads beside the flat space the reference engine reads the rest of the memory from.
weight_image
Lay table’s tensors out in order (each index once) under layout.