matmul_tiles

void ckernel::matmul_init(uint32_t in0_cb_id, uint32_t in1_cb_id, const uint32_t transpose = 0, uint32_t call_line = __builtin_LINE())

Short init for matmul_tiles. Configures the unpacker and math engine to matmul mode.

Must be called before matmul_tiles. The one-time HW configuration must already have been performed via compute_kernel_hw_startup<SrcOrder::Reverse>(in0, in1, out) at the start of MAIN. Matmul maps in0 -> SrcB and in1 -> SrcA (the reverse of other ops), which is why compute_kernel_hw_startup must use SrcOrder::Reverse.

NOTE (known gap, #46769): if a preceding op left SrcA/SrcB with asymmetric tile sizes (i.e. different data formats per source) and the following matmul uses the same formats, matmul_init cannot fix the per-source tile sizes on its own. It does not re-program the tile descriptor, and a reconfig_data_format is inappropriate when the data formats did not change. No current kernel hits this; tracked in #46769.

Return value: None

Argument

Description

Type

Valid Range

Required

in0_cb_id

The identifier of the first input circular buffer (CB)

uint32_t

0 to 31

True

in1_cb_id

The identifier of the second input circular buffer (CB)

uint32_t

0 to 31

True

transpose

The transpose flag for performing transpose operation on B

uint32_t

Any positive value will indicate transpose is set

False

void ckernel::matmul_tiles(uint32_t in0_cb_id, uint32_t in1_cb_id, uint32_t in0_tile_index, uint32_t in1_tile_index, uint32_t idst)

Performs tile-sized matrix multiplication C=A*B between the tiles in two specified input CBs and accumulates the result to DST (DST += C). The DST register buffer must be in acquired state via acquire_dst call. This call is blocking and is only available on the compute engine.

Return value: None

Argument

Description

Type

Valid Range

Required

in0_cb_id

The identifier of the first input circular buffer (CB)

uint32_t

0 to 31

True

in1_cb_id

The identifier of the second input circular buffer (CB)

uint32_t

0 to 31

True

in0_tile_index

The index of the tile A from the first input CB

uint32_t

Must be less than the size of the CB

True

in1_tile_index

The index of the tile B from the second input CB

uint32_t

Must be less than the size of the CB

True

idst

The index of the tile in DST REG to which the result C will be written.

uint32_t

Must be less than the acquired size of DST REG

True

See also compute_kernel_hw_startup, which must be called once with SrcOrder::Reverse before matmul_init.