jax.pallas.tpu.matmul_lhs_fifo

jax.pallas.tpu.matmul_lhs_fifo#

jax.pallas.tpu.matmul_lhs_fifo(lhs, mxu_index, *, load_staged_rhs=None)[source]#

Performs a matrix multiplication in the chosen MXU on platforms with a result FIFO.

If load_staged_rhs is not None, the previously pushed RHS will be loaded from the given staging register _before_ the matrix multiplication begins. The results of the multiplication are enqueued to the result FIFO.

`.. warning:: This operation can result in a hardware error if the result FIFO is full. In such a case, the `matmul_pop_fifo` op should be used to dequeue results before additional `matmul_lhs_fifo` ops are issued. Additionally, the kernel must not leave any data in the result FIFO upon exit. `

Parameters:
  • lhs (jax.Array) – The left-hand side operand. Must be M x K for M divisible by the number of sublanes multiplied by datatype packing and K equal to jax.experimental.pallas.tpu.TPUInfo.mxu_column_size for the target TPU (obtained from get_tpu_info). If the matmul datatype is sub-byte, then the shape must be M x 2K.

  • mxu_index (int) – The MXU to use.

  • load_staged_rhs (int | None) – The index of the staging register to load the RHS from. If None, the RHS is not loaded from staging and the matmul will reuse the existing one.

Return type:

None