Class IndexMap#
Defined in File index_map.h
Inheritance Relationships#
Base Type#
public ffi::ObjectRef
Class Documentation#
-
class IndexMap : public ffi::ObjectRef#
Public Types
-
using ContainerType = IndexMapObj#
Public Functions
-
IndexMap(ffi::Array<PrimVar> initial_indices, ffi::Array<PrimExpr> final_indices, ffi::Optional<IndexMap> inverse_index_map = std::nullopt)#
The constructor.
- Parameters:
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
-
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_ranges – The ranges of the input indices.
-
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_ranges – The ranges of the input indices.
analyzer – An analyzer to be used while deriving and validating the inverse.
-
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_map – The optional name map to rename the variables.
- Returns:
The renamed index map.
-
ffi::Tuple<IndexMap, PrimExpr> 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_ranges – The ranges of the input indices.
- Returns:
The inverted index map, along with the predicate for which the inverse maps to a valid range.
-
ffi::Tuple<IndexMap, PrimExpr> 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_ranges – The ranges of the input indices.
analyzer – An 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.
-
inline explicit IndexMap(::tvm::ffi::UnsafeInit tag)#
-
inline __PtrType operator->() const#
-
inline __PtrType get() const#
Public Static Functions
-
static 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.
- Parameters:
ndim – The number of dimensions
func – The function to be applied
inverse_index_map – The optional pre-defined inverse index map
- Returns:
The created index map
-
using ContainerType = IndexMapObj#