tvm
|
#include <index_map.h>
Public Member Functions | |
IndexMap (Array< Var > initial_indices, Array< PrimExpr > final_indices, Optional< IndexMap > inverse_index_map=NullOpt) | |
The constructor. More... | |
IndexMap | Inverse (Array< Range > initial_ranges) const |
Generate the inverse mapping. More... | |
std::pair< IndexMap, PrimExpr > | NonSurjectiveInverse (Array< Range > initial_ranges) const |
Generate the inverse mapping. More... | |
TVM_DEFINE_OBJECT_REF_METHODS (IndexMap, ObjectRef, IndexMapNode) | |
![]() | |
ObjectRef ()=default | |
default constructor More... | |
ObjectRef (ObjectPtr< Object > data) | |
Constructor from existing object ptr. More... | |
bool | same_as (const ObjectRef &other) const |
Comparator. More... | |
bool | operator== (const ObjectRef &other) const |
Comparator. More... | |
bool | operator!= (const ObjectRef &other) const |
Comparator. More... | |
bool | operator< (const ObjectRef &other) const |
Comparator. More... | |
bool | defined () const |
const Object * | get () const |
const Object * | operator-> () const |
bool | unique () const |
int | use_count () const |
template<typename ObjectType > | |
const ObjectType * | as () const |
Try to downcast the internal Object to a raw pointer of a corresponding type. More... | |
Static Public Member Functions | |
static IndexMap | FromFunc (int ndim, runtime::TypedPackedFunc< Array< PrimExpr >(Array< Var >)> func, Optional< IndexMap > inverse_index_map=NullOpt) |
Create an index map from a packed function. More... | |
Additional Inherited Members | |
![]() | |
using | ContainerType = Object |
type indicate the container type. More... | |
![]() | |
static constexpr bool | _type_is_nullable = true |
![]() | |
Object * | get_mutable () const |
![]() | |
template<typename T > | |
static T | DowncastNoCheck (ObjectRef ref) |
Internal helper function downcast a ref without check. More... | |
static void | FFIClearAfterMove (ObjectRef *ref) |
Clear the object ref data field without DecRef after we successfully moved the field. More... | |
template<typename ObjectType > | |
static ObjectPtr< ObjectType > | GetDataPtr (const ObjectRef &ref) |
Internal helper function get data_ as ObjectPtr of ObjectType. More... | |
![]() | |
ObjectPtr< Object > | data_ |
Internal pointer that backs the reference. More... | |
tvm::tir::IndexMap::IndexMap | ( | Array< Var > | initial_indices, |
Array< PrimExpr > | final_indices, | ||
Optional< IndexMap > | inverse_index_map = NullOpt |
||
) |
The constructor.
initial_indices | Variables representing the indices prior to remapping |
final_indices | Expressions defining the indices after remapping. |
inverse_index_map | The optional pre-defined inverse index map |
|
static |
Create an index map from a packed function.
ndim | The number of dimensions |
func | The function to be applied |
inverse_index_map | The optional pre-defined inverse index map |
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.
TODO(Lunderberg): Look into allowing non-bijective transformations. If injective, the inverse mapping could still be generated with some predicate (see NonSurjectiveInverse). If non-injective, could simplify the implementation of other optimizations (e.g. double buffering as a map lambda *indices: [buffer_loop%2, *indices]
).
std::pair<IndexMap, PrimExpr> tvm::tir::IndexMap::NonSurjectiveInverse | ( | Array< Range > | initial_ranges | ) | 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.
tvm::tir::IndexMap::TVM_DEFINE_OBJECT_REF_METHODS | ( | IndexMap | , |
ObjectRef | , | ||
IndexMapNode | |||
) |