tvm
Public Member Functions | Static Public Member Functions | List of all members
tvm::tir::IndexMap Class Reference

#include <index_map.h>

Inheritance diagram for tvm::tir::IndexMap:
Collaboration diagram for tvm::tir::IndexMap:

Public Member Functions

 IndexMap (Array< Var > initial_indices, Array< PrimExpr > final_indices, Optional< IndexMap > inverse_index_map=std::nullopt)
 The constructor. More...
 
IndexMap Inverse (Array< Range > initial_ranges, arith::Analyzer *analyzer) const
 Generate the inverse mapping. More...
 
IndexMap RenameVariables (const std::function< Optional< String >(const Var &var)> &f_name_map=nullptr) const
 Rename the variables in the index map and ensure the names are unique. More...
 
std::pair< IndexMap, PrimExprNonSurjectiveInverse (Array< Range > initial_ranges, arith::Analyzer *analyzer) const
 Generate the inverse mapping. More...
 
 TVM_DEFINE_OBJECT_REF_METHODS (IndexMap, ObjectRef, IndexMapNode)
 

Static Public Member Functions

static IndexMap FromFunc (int ndim, ffi::TypedFunction< Array< PrimExpr >(Array< Var >)> func, Optional< IndexMap > inverse_index_map=std::nullopt)
 Create an index map from a packed function. More...
 

Constructor & Destructor Documentation

◆ IndexMap()

tvm::tir::IndexMap::IndexMap ( Array< Var initial_indices,
Array< PrimExpr final_indices,
Optional< IndexMap inverse_index_map = std::nullopt 
)

The constructor.

Parameters
initial_indicesVariables representing the indices prior to remapping
final_indicesExpressions defining the indices after remapping.
inverse_index_mapThe optional pre-defined inverse index map

Member Function Documentation

◆ FromFunc()

static IndexMap tvm::tir::IndexMap::FromFunc ( int  ndim,
ffi::TypedFunction< Array< PrimExpr >(Array< Var >)>  func,
Optional< IndexMap inverse_index_map = std::nullopt 
)
static

Create an index map from a packed function.

Parameters
ndimThe number of dimensions
funcThe function to be applied
inverse_index_mapThe optional pre-defined inverse index map
Returns
The created index map

◆ Inverse()

IndexMap tvm::tir::IndexMap::Inverse ( Array< Range initial_ranges,
arith::Analyzer analyzer 
) const

Generate the inverse mapping.

The range of the input indices is required in order to ensure that the transformation is bijective over the input domain.

If the user has supplied an inverse_index_map, that map is assumed to be correct and bijective, and is returned.

◆ NonSurjectiveInverse()

std::pair<IndexMap, PrimExpr> tvm::tir::IndexMap::NonSurjectiveInverse ( Array< Range initial_ranges,
arith::Analyzer analyzer 
) const

Generate the inverse mapping.

Determine the inverse, where the output range may contain addresses that do not correspond to an address in the input range.

Returns
The inverted index map, along with the predicate for which the inverse maps to a valid range.

◆ RenameVariables()

IndexMap tvm::tir::IndexMap::RenameVariables ( const std::function< Optional< String >(const Var &var)> &  f_name_map = nullptr) const

Rename the variables in the index map and ensure the names are unique.

Construct a new index map with the same transformation, but with name_hint of variables to be guaranteed unique. The optional f_name_map can be provided to rename the variables.

Parameters
f_name_mapThe optional name map to rename the variables.
Returns
The renamed index map.

◆ TVM_DEFINE_OBJECT_REF_METHODS()

tvm::tir::IndexMap::TVM_DEFINE_OBJECT_REF_METHODS ( IndexMap  ,
ObjectRef  ,
IndexMapNode   
)

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