tvm
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
tvm::tirx::IndexMap Class Reference

#include <index_map.h>

Inheritance diagram for tvm::tirx::IndexMap:
Collaboration diagram for tvm::tirx::IndexMap:

Public Member Functions

TVM_TIRX_DLL IndexMap (ffi::Array< PrimVar > initial_indices, ffi::Array< PrimExpr > final_indices, ffi::Optional< IndexMap > inverse_index_map=std::nullopt)
 The constructor.
 
TVM_TIRX_DLL IndexMap Inverse (ffi::Array< Range > initial_ranges) const
 Generate the inverse mapping using a fresh analyzer.
 
TVM_TIRX_DLL IndexMap Inverse (ffi::Array< Range > initial_ranges, const sym::Analyzer &analyzer) const
 Generate the inverse mapping using an existing analyzer.
 
TVM_TIRX_DLL IndexMap RenameVariables (const ffi::TypedFunction< ffi::Optional< ffi::String >(const Var &var)> &f_name_map=nullptr) const
 Rename the variables in the index map and ensure the names are unique.
 
TVM_TIRX_DLL ffi::Tuple< IndexMap, PrimExpr > NonSurjectiveInverse (ffi::Array< Range > initial_ranges) const
 Generate the inverse mapping using a fresh analyzer.
 
TVM_TIRX_DLL ffi::Tuple< IndexMap, PrimExpr > NonSurjectiveInverse (ffi::Array< Range > initial_ranges, const sym::Analyzer &analyzer) const
 Generate the inverse mapping using an existing analyzer.
 
 TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE (IndexMap, ffi::ObjectRef, IndexMapObj)
 

Static Public Member Functions

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

Constructor & Destructor Documentation

◆ IndexMap()

TVM_TIRX_DLL tvm::tirx::IndexMap::IndexMap ( ffi::Array< PrimVar >  initial_indices,
ffi::Array< PrimExpr >  final_indices,
ffi::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 TVM_TIRX_DLL IndexMap tvm::tirx::IndexMap::FromFunc ( int  ndim,
ffi::TypedFunction< ffi::Array< PrimExpr >(ffi::Array< Var >)>  func,
ffi::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() [1/2]

TVM_TIRX_DLL IndexMap tvm::tirx::IndexMap::Inverse ( ffi::Array< Range >  initial_ranges) const

Generate the inverse mapping using a fresh analyzer.

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.

Parameters
initial_rangesThe ranges of the input indices.

◆ Inverse() [2/2]

TVM_TIRX_DLL IndexMap tvm::tirx::IndexMap::Inverse ( ffi::Array< Range >  initial_ranges,
const sym::Analyzer &  analyzer 
) const

Generate the inverse mapping using an existing analyzer.

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.

Parameters
initial_rangesThe ranges of the input indices.
analyzerAn analyzer to be used while deriving and validating the inverse.

◆ NonSurjectiveInverse() [1/2]

TVM_TIRX_DLL ffi::Tuple< IndexMap, PrimExpr > tvm::tirx::IndexMap::NonSurjectiveInverse ( ffi::Array< Range >  initial_ranges) const

Generate the inverse mapping using a fresh analyzer.

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

Parameters
initial_rangesThe ranges of the input indices.
Returns
The inverted index map, along with the predicate for which the inverse maps to a valid range.

◆ NonSurjectiveInverse() [2/2]

TVM_TIRX_DLL ffi::Tuple< IndexMap, PrimExpr > tvm::tirx::IndexMap::NonSurjectiveInverse ( ffi::Array< Range >  initial_ranges,
const sym::Analyzer &  analyzer 
) const

Generate the inverse mapping using an existing analyzer.

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

Parameters
initial_rangesThe ranges of the input indices.
analyzerAn analyzer to be used while deriving the inverse and padding predicate.
Returns
The inverted index map, along with the predicate for which the inverse maps to a valid range.

◆ RenameVariables()

TVM_TIRX_DLL IndexMap tvm::tirx::IndexMap::RenameVariables ( const ffi::TypedFunction< ffi::Optional< ffi::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_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE()

tvm::tirx::IndexMap::TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE ( IndexMap  ,
ffi::ObjectRef  ,
IndexMapObj   
)

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