masahi commented on code in PR #14345:
URL: https://github.com/apache/tvm/pull/14345#discussion_r1143913949
##########
python/tvm/topi/hexagon/tensor_intrin.py:
##########
@@ -22,44 +22,164 @@
from tvm import te
+def get_lanes(dtype: str):
+ if "x" not in dtype:
+ return 1
+
+ _, lanes = dtype.split("x")
+ return int(lanes)
+
+
+def is_vector_type(dtype: str):
+ return get_lanes(dtype) != 1
+
+
+def is_power_of_2(n: int):
+ return (n & (n - 1) == 0) and n != 0
+
+
+def _adopt_to_highest_lanes(*args, intrinsic=None, intrinsic_lanes: int = 0):
+ """Enhance original lowering intrinsic to high vector lanes.
+ Will accept vector lanes equal orig_vec_lanes * 2**n for n in [0,1,2...]
+
+ Ada is equivalent of splitting input args to chunk with lanes equal
orig_vec_lanes,
+ execution provided low_intrinsic for each of them and concatenate back.
+
+ Parameters
+ ----------
+ args: List[PrimExpr]
+ Args to adapt to
+
+ intrinsic: callable
+ Intrinsic implementation to adapt
+
+ intrinsic_lanes: int
+ Args lanes supported by provided intrinsic
Review Comment:
Arg lanes?
##########
python/tvm/topi/hexagon/tensor_intrin.py:
##########
@@ -22,44 +22,164 @@
from tvm import te
+def get_lanes(dtype: str):
+ if "x" not in dtype:
+ return 1
+
+ _, lanes = dtype.split("x")
+ return int(lanes)
+
+
+def is_vector_type(dtype: str):
+ return get_lanes(dtype) != 1
+
+
+def is_power_of_2(n: int):
+ return (n & (n - 1) == 0) and n != 0
+
+
+def _adopt_to_highest_lanes(*args, intrinsic=None, intrinsic_lanes: int = 0):
+ """Enhance original lowering intrinsic to high vector lanes.
+ Will accept vector lanes equal orig_vec_lanes * 2**n for n in [0,1,2...]
+
+ Ada is equivalent of splitting input args to chunk with lanes equal
orig_vec_lanes,
+ execution provided low_intrinsic for each of them and concatenate back.
Review Comment:
Ada?
##########
python/tvm/topi/hexagon/tensor_intrin.py:
##########
@@ -22,44 +22,164 @@
from tvm import te
+def get_lanes(dtype: str):
+ if "x" not in dtype:
+ return 1
+
+ _, lanes = dtype.split("x")
+ return int(lanes)
+
+
+def is_vector_type(dtype: str):
+ return get_lanes(dtype) != 1
+
+
+def is_power_of_2(n: int):
+ return (n & (n - 1) == 0) and n != 0
+
+
+def _adopt_to_highest_lanes(*args, intrinsic=None, intrinsic_lanes: int = 0):
+ """Enhance original lowering intrinsic to high vector lanes.
+ Will accept vector lanes equal orig_vec_lanes * 2**n for n in [0,1,2...]
+
+ Ada is equivalent of splitting input args to chunk with lanes equal
orig_vec_lanes,
+ execution provided low_intrinsic for each of them and concatenate back.
Review Comment:
Also please polish this sentence, it is broken.
--
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]