Skip to main content
Log in

Mojo struct

PackMatrixRows

struct PackMatrixRows[original_mut: Bool, //, original_shape: DimList, packed_shape: DimList, type: DType, simd_size: Int, row_inner_size: Int, packed_origin: MutableOrigin, original_origin: Origin[original_mut]]

Pack rows from a matrix into the mlas packed layout and extract inner vectors of rows into the packed inner dimension, e.g. extract tile [X, Y] and pack into [Xo][Y][Xi].

Fields

  • packed_matrix (NDBuffer[type, 3, packed_origin, packed_shape]):
  • original_matrix (NDBuffer[type, 2, original_origin, original_shape]):
  • global_offset (Index[2]):
  • pack_tile_dim (Index[2]):
  • valid_data_dim (Index[2]):
  • valid_simd_dim (Index[2]):

Implemented traits

AnyType, Copyable, ExplicitlyCopyable, Movable, UnknownDestructibility

Methods

run

static run(packed_matrix: NDBuffer[type, 3, packed_origin, packed_shape], original_matrix: NDBuffer[type, 2, original_origin, original_shape], global_offset: Index[2], pack_tile_dim: Index[2], valid_data_dim: Index[2])

Interface function to run the packing routine. Args: packed_matrix(NDBuffer): pre-allocated buffer space for packed data. original_matrix(NDBuffer): data buffer containing the original matrix to pack. global_offset(IndexList): offset to use when indexing the original matrix. pack_tile_dim(IndexList): 2D dimension tuple describing the size of the packed tile. valid_data_dim(IndexList): 2D dimension tuple describing the amount of valid data on the global buffer starting from the offset.