IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).

Mojo function

aligned_load

def aligned_load[V: Loadable, //, width: Int](view: V, idx: Coord[*idx.element_types], inner: Int, inner_dim: Int) -> SIMD[V.dtype, width]

Loads width elements of view at idx, as one aligned vector when it can on GPU.

The read is aligned when inner, the innermost coordinate of idx, and inner_dim, the length of the innermost dimension, are both multiples of width: the row-major flat index is then a multiple of width. The view's own alignment still caps that, so a misaligned view reads correctly.

Parameters:

  • ​V (Loadable): The view type.
  • ​width (Int): Number of elements to load.

Args:

  • ​view (V): The operand's device view.
  • ​idx (Coord[*idx.element_types]): The coordinate of the first element.
  • ​inner (Int): The innermost coordinate of idx.
  • ​inner_dim (Int): The length of the view's innermost dimension.

Returns:

SIMD[V.dtype, width]: The loaded elements.

Was this page helpful?