Skip to main content

Module stream

Module stream 

Source
Expand description

The image stream engine: one memory channel’s tiles of the weight image in, the tiles’ rows out as 64-byte beats.

A tile descriptor names a tile of super::super::image::Image: its first line on the channel, its lines, the bytes of rows it holds, its tensor and its first row. The engine sits in the compute clock on the shell’s channel interface: it asks the shell for the tile’s lines with one read descriptor, takes the lines as they cross back, and sends the tile’s row bytes on as beats of 64 bytes, each tagged with the tile’s tensor, its first row and the beat’s byte offset in the tile, the last beat carrying how many of its bytes are rows (the rest zero). At 72-byte lines the bytes are regathered: eight lines make nine beats, so the engine’s output runs at the line rate when its clock is 9/8 of the channel’s. With check words every line passes through a CRC-32C as it is taken, and the tile’s last beat says whether the word in its last line’s last four bytes was the CRC of the lines before it.

The beats wait in a 128-byte gather register: a beat leaves once 64 bytes are gathered, a line comes in when its bytes fit or the register already holds every row byte the tile has left (then the line only feeds the CRC), and the tile’s last beat waits for the tile’s last line, so the verdict is known when it leaves. Up to four tiles’ reads are outstanding at once, so a tile’s lines follow the last tile’s without a gap.

beats is the unit’s software twin: from a channel’s bytes and a descriptor, the beats the RTL sends.

Structs§

Beat
One beat as the engine sends it: keep of its bytes are the tile’s rows (the rest zero), offset is its first byte’s place in the tile, crc_error is set on a tile’s last beat when its check word was wrong.
TileDescriptor
One tile as the engine takes it.

Constants§

AW
Bits of the descriptor fields and tags: the line address, the line count (the shell’s descriptor widths), the byte count, the tensor and the row.
BEAT_BYTES
Bytes a beat carries.
BYW
LW
ROWW
TW

Functions§

beats
The beats the engine sends for tile d read from channel (the channel’s bytes) under layout.
crc32c_update
The CRC-32C register after bytes from state, with no initial or final inversion: the map the hardware applies to its register a line at a time, linear in the state and the bytes.
crc_masks
For each bit of the register after len bytes, the register bits and the data bits (byte k’s bit j at bit 8k + j) whose exclusive-or it is.
descriptors
The descriptors of every tile image holds on channel, in the channel’s order.
verilog
The engine for lines of layout.line_bytes bytes, checking every tile’s CRC-32C when layout.check.