For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo struct
STMatrixOffsets
struct STMatrixOffsets[BM: Int, BN: Int, *, num_threads: Int, accum_dtype_size: Int, curr_repeat: Int, cumulative_repeat: Int, m_mma: Int]
Precomputed TMEM and local-fragment offsets for one st_matrix repeat column.
Parametersβ
- βBM (
Int): Number of rows in theBMxBNoutput tile (forwarded toSTMatrixLayout). - βBN (
Int): Number of columns in theBMxBNoutput tile (forwarded toSTMatrixLayout). - βnum_threads (
Int): Number of threads participating in thest_matrixstore (forwarded toSTMatrixLayout). - βaccum_dtype_size (
Int): Size in bytes of the accumulator element dtype (forwarded toSTMatrixLayout). - βcurr_repeat (
Int): Number of repeat columns in this power-of-two chunk of thest_matrixstore. - βcumulative_repeat (
Int): Number of repeat columns already stored before this chunk, used as the TMEM column and local-fragment base offset. - βm_mma (
Int): M-tile index of thest_matrixstore within theBM-row tile, selecting the 16-row TMEM quadrant.
Implemented traitsβ
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDeletable,
Movable,
RegisterPassable,
TrivialRegisterPassable
comptime membersβ
b32_per_repeatβ
comptime b32_per_repeat = (Int((mul accum_dtype_size, 4)) // Int(4))
local_frag_size_b32β
comptime local_frag_size_b32 = (curr_repeat * (Int((mul accum_dtype_size, 4)) // Int(4)))
ptr_offsetβ
comptime ptr_offset = ((Int((mul accum_dtype_size, 4)) // Int(4)) * Int((add (mul (BN // Int(8)), m_mma), cumulative_repeat)))
STLayoutβ
comptime STLayout = STMatrixLayout[BM, BN, num_threads=num_threads, accum_dtype_size=accum_dtype_size]
tmem_col_offsetβ
comptime tmem_col_offset = (Int((mul cumulative_repeat, 2)) * Int(4))
tmem_offsetβ
comptime tmem_offset = ((STMatrixOffsets[BM, BN, num_threads=num_threads, accum_dtype_size=accum_dtype_size, curr_repeat=curr_repeat, cumulative_repeat=cumulative_repeat, m_mma=m_mma].tmem_row_offset << Int(16)) + Int((mul cumulative_repeat, 8)))
tmem_row_offsetβ
comptime tmem_row_offset = (Int(16) * m_mma)
Methodsβ
__init__β
def __init__() -> Self
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!