MLIR 22.0.0git
mlir::StaticTileOffsetRange Class Reference

A range-style iterator that allows for iterating over the offsets of all potential tiles of size tileShape within the larger shape shape, using an ordering specified by loopOrder. More...

#include "mlir/Dialect/Utils/IndexingUtils.h"

Public Types

using IteratorTy = detail::TileOffsetRangeIterator<int64_t>
using ParamsTy = detail::TileOffsetRangeImpl

Public Member Functions

 StaticTileOffsetRange (ArrayRef< int64_t > shape, ArrayRef< int64_t > tileShape, ArrayRef< int64_t > loopOrder)
 StaticTileOffsetRange (ArrayRef< int64_t > shape, ArrayRef< int64_t > tileShape)
 Create the range with identity loop order.
IteratorTy begin () const
IteratorTy end () const
size_t size () const
 Returns the total number of tiles that fit in the larger shape.
size_t getRank () const
 Returns rank of the iterator's shape.

Detailed Description

A range-style iterator that allows for iterating over the offsets of all potential tiles of size tileShape within the larger shape shape, using an ordering specified by loopOrder.

The loopOrder specifies the order of unrolling by numbering the dimensions in order from "outer most for loop" (slowest changing) to "inner most for loop" (fastest changing).

For example, for shape = {10, 20, 30}, tileShape = {5, 10, 15}, and loopOrder={2, 0, 1}, the iterating over this range will yield offsets:

{0, 0, 0}, {0, 10, 0}, {5, 0, 0}, {5, 10, 0}, {0, 0, 15},
{0, 10, 15}, {5, 0, 15}, {0, 10, 15}, {5, 10, 15}

This is useful in contexts where a vector computation over a larger shape needs to be unrolled to a set of operations on subsets of the original operands, such as during the "vector unrolling" transformations.

The size of tileShape must be less-than-or-equal-to the size of shape.a If the rank of tileShape is smaller than shape, then tileShape elements correspond to the trailing dimensions of shape, and the leading dimensions are considered untiled and tileShape is effectively prepended with the leading dims of shape.

Definition at line 376 of file IndexingUtils.h.

Member Typedef Documentation

◆ IteratorTy

◆ ParamsTy

Constructor & Destructor Documentation

◆ StaticTileOffsetRange() [1/2]

mlir::StaticTileOffsetRange::StaticTileOffsetRange ( ArrayRef< int64_t > shape,
ArrayRef< int64_t > tileShape,
ArrayRef< int64_t > loopOrder )
inline

Definition at line 381 of file IndexingUtils.h.

◆ StaticTileOffsetRange() [2/2]

mlir::StaticTileOffsetRange::StaticTileOffsetRange ( ArrayRef< int64_t > shape,
ArrayRef< int64_t > tileShape )
inline

Create the range with identity loop order.

Definition at line 390 of file IndexingUtils.h.

References size().

Member Function Documentation

◆ begin()

IteratorTy mlir::StaticTileOffsetRange::begin ( ) const
inline

Definition at line 398 of file IndexingUtils.h.

◆ end()

IteratorTy mlir::StaticTileOffsetRange::end ( ) const
inline

Definition at line 399 of file IndexingUtils.h.

◆ getRank()

size_t mlir::StaticTileOffsetRange::getRank ( ) const
inline

Returns rank of the iterator's shape.

Definition at line 405 of file IndexingUtils.h.

◆ size()

size_t mlir::StaticTileOffsetRange::size ( ) const
inline

Returns the total number of tiles that fit in the larger shape.

Definition at line 402 of file IndexingUtils.h.

Referenced by StaticTileOffsetRange().


The documentation for this class was generated from the following file: