get_mxfp8_scale_offset#

nvmath.linalg.advanced.helpers.matmul.get_mxfp8_scale_offset(x, index)[source]#

Computes the offset of MXFP8 scale used for element x[index].

Parameters:
  • x – The tensor to which index referes.

  • index – A tuple of tensor indices. This function supports broadcasting, so the index can be a tuple of integers or a tuple of tensors.

Returns:

A single integer indicating an offset to the MXFP8 block scale factor which is applied to x[index] during scaling.

Note

In typical use-cases, there should be no need to manually modify MXFP8 scales. The scales returned as "d_out_scale" by one multiplication can be directly reused as input scales for another multiplication.