Skip to main content

tensor_load

Function tensor_load 

Source
pub unsafe fn tensor_load(
    addr: usize,
    start: u8,
    rows: u8,
    id: bool,
    stride: u64,
)
Expand description

Initiate an asynchronous TensorLoad from memory into the L1 scratchpad.

Loads rows + 1 consecutive rows of 64 bytes each from memory into L1 scratchpad lines start through start + rows. Row i is read from address addr + i * stride. The operation is asynchronous: call tensor_wait(TensorEvent::Load0) (or Load1 if id = true) before reading the scratchpad in a subsequent tensor_fma32.

§Parameters

  • addr: 64-byte aligned virtual address of the first row in memory.
  • start: L1 scratchpad starting line index (0..=47).
  • rows: number of rows to load minus one (ROWS field, 0..=15). Loads rows + 1 cache lines.
  • id: selects the TensorWait event (false = Load0, true = Load1).
  • stride: row stride in bytes (64-byte aligned); placed in x31 by this function immediately before the CSRRW instruction.

§Safety

  • addr must be 64-byte aligned and point to (rows + 1) * stride valid, readable bytes of device memory.
  • Must be called from the primary hart of the Minion (mhartid & 1 == 0).