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 function
stsm_helper
def stsm_helper[swizzle: Swizzle, vec_dtype: DType, vec_size: Int, transpose_c: Bool = False](vec: Array[Scalar[vec_dtype], vec_size], dst: LayoutTensor[address_space=AddressSpace.SHARED, element_layout=dst.element_layout, layout_int_type=dst.layout_int_type, linear_idx_type=dst.linear_idx_type, masked=dst.masked, alignment=dst.alignment])
Stores a register fragment to shared memory using the stmatrix instruction.
Casts the loaded fragment to the destination dtype, applies the shared
memory swizzle, and emits st_matrix stores so the epilogue can drain
tensor memory through shared memory before the TMA store.
Parameters:
- βswizzle (
Swizzle): Shared-memory swizzle applied to compute the store offset from the lane offset. - βvec_dtype (
DType): Element type of the input register fragmentvec. - βvec_size (
Int): Number of scalar elements in the input register fragmentvec. - βtranspose_c (
Bool): Whether to transpose the fragment layout when computing the store offset (defaults to False).
Args:
- βvec (
Array[Scalar[vec_dtype], vec_size]): Register fragment loaded from tensor memory to store to shared memory. - βdst (
LayoutTensor[address_space=AddressSpace.SHARED, element_layout=dst.element_layout, layout_int_type=dst.layout_int_type, linear_idx_type=dst.linear_idx_type, masked=dst.masked, alignment=dst.alignment]): Destination shared-memoryLayoutTensorwhere the fragment is written viast_matrix.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!