Hzfengsy commented on code in PR #17663:
URL: https://github.com/apache/tvm/pull/17663#discussion_r1966435651


##########
python/tvm/dlight/cpu/utils.py:
##########
@@ -0,0 +1,41 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+# pylint: disable=missing-docstring
+"""Utility methods for generic CPU."""
+from typing import Union
+
+from tvm import DataType, tir
+
+
+def get_bytes(dtype: Union[DataType, str]) -> int:
+    if isinstance(dtype, str):
+        dtype = DataType(dtype)
+    return dtype.itemsize()
+
+
+def get_extent(sch: tir.Schedule, loop_rv: tir.schedule.LoopRV):
+    loop: tir.For = sch.get(loop_rv)
+    return loop.extent.value if isinstance(loop.extent, tir.IntImm) else 
loop.extent
+
+
+def auto_vectorize(sch: tir.Schedule, loop: tir.schedule.LoopRV, max_vec: int):

Review Comment:
   Is there any reason to keep another CPU copy? as there is a same file at 
python/tvm/dlight/gpu/utils.py



##########
python/tvm/dlight/cpu/gemv.py:
##########
@@ -0,0 +1,137 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+"""A rule for GEMV and DecodeGEMV."""
+from typing import List, Optional, Union
+
+from tvm import tir
+from tvm.target import Target
+
+from ..analysis import (
+    BlockInfo,
+    normalize_prim_func,
+)
+from ..analysis.gemv import is_gemv, normalize
+from ..base import try_inline_contiguous_spatial
+from .base import CPUScheduleRule
+from .utils import get_extent
+
+
+class GEMV(CPUScheduleRule):
+    """A rule for GEMV and DecodeGEMV."""
+
+    def apply(  # pylint: 
disable=too-many-locals,too-many-branches,too-many-return-statements, 
no-else-return
+        self,
+        func: tir.PrimFunc,
+        target: Target,
+        _: bool,
+    ) -> Union[None, tir.Schedule, List[tir.Schedule]]:
+        if not isinstance(func, tir.PrimFunc) or not 
self.is_target_available(target):
+            return None
+        sch = tir.Schedule(func)
+        sch = tir.Schedule(func)

Review Comment:
   duplicated



-- 
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]

Reply via email to