Lunderberg commented on a change in pull request #10538:
URL: https://github.com/apache/tvm/pull/10538#discussion_r826995368
##########
File path: python/tvm/tir/function.py
##########
@@ -239,3 +240,40 @@ def get(name: str):
The TensorIntrin with the specified name.
"""
return _ffi_api.TensorIntrinGet(name) # pylint: type: ignore
+
+
+@tvm._ffi.register_object("tir.IndexMap")
+class IndexMap(Object):
+ """A mapping from multi-dimensional indices to another set of
multi-dimensional indices
+
+ Parameters
+ ----------
+ initial_indices : List[Var]
+ Variables representing the indices prior to remapping.
+ final_indices : List[PrimExpr]
+ Expressions defining the indices after remapping.
+ """
+
+ initial_indices: List[Var]
+ final_indices: List[PrimExpr]
+
+ @staticmethod
+ def from_func(func: Callable) -> "IndexMap":
Review comment:
Looks good! I like having the `mapping_function` be handled primarily
on the Python side, because it avoids the need for a round-trip Python -> C++
-> Python call in order to generate the mapping, and feels more idiomatic to
have it explicitly specified on the C++ side.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]