jax.pallas.tpu.matmul_push_rhs

jax.pallas.tpu.matmul_push_rhs#

jax.pallas.tpu.matmul_push_rhs(rhs, staging_register, mxu_index, *, transpose=False)[source]#

Prepares the RHS for a matrix multiplication in the chosen MXU.

Each MXU has an independent set of staging registers.

`{warning} It is not allowed to push to the same staging register twice. Once the RHS is prepared, it must be loaded into the MXU using `matmul_acc_lhs` before it can be used again. `

`{warning} The kernel must not leave any data in the staging registers upon exit. `

Parameters:
  • rhs (jax.Array) – The right-hand side operand. Must be K x K where K is 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 2K x K if transpose=False, or K x 2K if transpose=True. Note that the matmul data type is determined by the LHS operand used in matmul_acc_lhs and not the type passed here.

  • staging_register (int) – The staging register to use.

  • mxu_index (int) – The MXU to use.

  • transpose (bool) – Whether to transpose the RHS.

Return type:

None