|
tvm
|
Defines a mapping between two representations of indices into a buffer. More...
#include <index_map.h>
Public Member Functions | |
| IndexMapNode () | |
| Default constructor. | |
| ffi::Array< PrimExpr > | MapIndices (const ffi::Array< PrimExpr > &indices) const |
| Map indices to the output space using a fresh analyzer. | |
| ffi::Array< PrimExpr > | MapIndices (const ffi::Array< PrimExpr > &indices, const arith::Analyzer &analyzer) const |
| Map indices to the output space using an existing analyzer. | |
| ffi::Array< Range > | MapRanges (const ffi::Array< Range > &ranges) const |
| Map a memory range to the output space using a fresh analyzer. | |
| ffi::Array< Range > | MapRanges (const ffi::Array< Range > &ranges, const arith::Analyzer &analyzer) const |
| Map a memory range to the output space using an existing analyzer. | |
| ffi::Array< PrimExpr > | MapShape (const ffi::Array< PrimExpr > &shape) const |
| Map a buffer shape to the output space using a fresh analyzer. | |
| ffi::Array< PrimExpr > | MapShape (const ffi::Array< PrimExpr > &shape, const arith::Analyzer &analyzer) const |
| Map a buffer shape to the output space using an existing analyzer. | |
| runtime::Tensor | MapTensor (runtime::Tensor arr_src) const |
| ffi::String | ToPythonString (const std::function< ffi::Optional< ffi::String >(const Var &var)> &f_name_map=nullptr) const |
| Convert to string representation in Python. | |
| TVM_FFI_DECLARE_OBJECT_INFO_FINAL ("tirx.IndexMap", IndexMapNode, ffi::Object) | |
Static Public Member Functions | |
| static void | RegisterReflection () |
Public Attributes | |
| ffi::Array< PrimVar > | initial_indices |
| Variables representing the indices prior to remapping. | |
| ffi::Array< PrimExpr > | final_indices |
| Expressions defining the indices after remapping. | |
| ffi::Optional< ffi::ObjectRef > | inverse_index_map |
| The inverse index map. | |
Static Public Attributes | |
| static constexpr TVMFFISEqHashKind | _type_s_eq_hash_kind = kTVMFFISEqHashKindTreeNode |
Defines a mapping between two representations of indices into a buffer.
This is primarily used for layout transformations of buffers objects.
|
inline |
Default constructor.
Defines the mapping as an identity function, with initial_indices equal to the final indices.
| ffi::Array< PrimExpr > tvm::tirx::IndexMapNode::MapIndices | ( | const ffi::Array< PrimExpr > & | indices | ) | const |
Map indices to the output space using a fresh analyzer.
| indices | The indices in the input space. Should contain one value for each variable in initial_indices. |
final_indices. | ffi::Array< PrimExpr > tvm::tirx::IndexMapNode::MapIndices | ( | const ffi::Array< PrimExpr > & | indices, |
| const arith::Analyzer & | analyzer | ||
| ) | const |
Map indices to the output space using an existing analyzer.
| indices | The indices in the input space. Should contain one value for each variable in initial_indices. |
| analyzer | An analyzer to be used to simplify the resulting expressions. |
final_indices. Map a memory range to the output space using a fresh analyzer.
If contiguous memory locations in the input space are not necessarily contiguous in the output space (e.g. lambda i: [8*(i%8) + (i//8)]), then this will return the smallest range such that all valid indices are contained within the given range.
| ranges | The ranges in the input space. Should contain one value for each variable in initial_indices. |
final_indices. | ffi::Array< Range > tvm::tirx::IndexMapNode::MapRanges | ( | const ffi::Array< Range > & | ranges, |
| const arith::Analyzer & | analyzer | ||
| ) | const |
Map a memory range to the output space using an existing analyzer.
If contiguous memory locations in the input space are not necessarily contiguous in the output space (e.g. lambda i: [8*(i%8) + (i//8)]), then this will return the smallest range such that all valid indices are contained within the given range.
| ranges | The ranges in the input space. Should contain one value for each variable in initial_indices. |
| analyzer | An analyzer to be used to simplify the resulting expressions. |
final_indices. | ffi::Array< PrimExpr > tvm::tirx::IndexMapNode::MapShape | ( | const ffi::Array< PrimExpr > & | shape | ) | const |
Map a buffer shape to the output space using a fresh analyzer.
| shape | The buffer shape in the input space. Should contain one value for each variable in initial_indices. |
final_indices. | ffi::Array< PrimExpr > tvm::tirx::IndexMapNode::MapShape | ( | const ffi::Array< PrimExpr > & | shape, |
| const arith::Analyzer & | analyzer | ||
| ) | const |
Map a buffer shape to the output space using an existing analyzer.
| shape | The buffer shape in the input space. Should contain one value for each variable in initial_indices. |
| analyzer | An analyzer to be used to simplify the resulting expressions. |
final_indices. | runtime::Tensor tvm::tirx::IndexMapNode::MapTensor | ( | runtime::Tensor | arr_src | ) | const |
| ffi::String tvm::tirx::IndexMapNode::ToPythonString | ( | const std::function< ffi::Optional< ffi::String >(const Var &var)> & | f_name_map = nullptr | ) | const |
Convert to string representation in Python.
| f_name_map | Optional function to specify the stringified name of the variables. |
| tvm::tirx::IndexMapNode::TVM_FFI_DECLARE_OBJECT_INFO_FINAL | ( | "tirx.IndexMap" | , |
| IndexMapNode | , | ||
| ffi::Object | |||
| ) |
|
staticconstexpr |
| ffi::Array<PrimExpr> tvm::tirx::IndexMapNode::final_indices |
Expressions defining the indices after remapping.
These expressions should only be in terms of the initial_indices, and must be expressible as an IterSumExpr. The mapping from initial_indices to final_indices must be injective.
If final_indices is empty, then initial_indices should also be empty, and the map is an identity function.
| ffi::Array<PrimVar> tvm::tirx::IndexMapNode::initial_indices |
Variables representing the indices prior to remapping.
If initial_indices is empty, then final_indices should also be empty, and no mapping is applied.
| ffi::Optional<ffi::ObjectRef> tvm::tirx::IndexMapNode::inverse_index_map |
The inverse index map.
When this is defined, IndexMap::Inverse will return the pre-defined inverse index map. Otherwise, the inverse index map will be computed on the fly. It is the user's responsibility to ensure the correctness of the pre-defined inverse index map.