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).

Introduction to TileTensor

Mojo's layout package provides a number of APIs for working with dense multidimensional arrays, which simplify writing algorithms for handling linear algebra.

This section discusses the TileTensor abstraction and its related types:

  • TileTensor is a flexible tensor type that combines a layout.Layout and a pointer to data.
  • The layout.Layout struct describes an arrangement of data in memory. A layout is a function that maps a set of logical coordinates (like (x, y) in a two-dimensional array) to a linear index value (such as an offset into a memory buffer). Layouts can describe simple row-major or column-major matrices, but also more complex organizations, like a matrix subdivided into tiles.
  • Coord is a tuple-like container for storing integer coordinates that supports both compile-time and run-time values. It's used for defining logical coordinates and layout shapes, among other things.

TileTensor supports layouts with run-time dimensions and nested layouts. The Coord-based layout keeps the layout struct small, which helps reduce register pressure on GPUs.

Was this page helpful?