junrushao1994 commented on a change in pull request #7847:
URL: https://github.com/apache/tvm/pull/7847#discussion_r613571323



##########
File path: tests/python/unittest/test_tir_schedule_utilities.py
##########
@@ -0,0 +1,115 @@
+# 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-function-docstring,missing-module-docstring
+import pytest
+import tvm
+from tvm import tir
+from tvm.ir import IRModule
+from tvm.script import ty
+
+
+# pylint: disable=no-member,invalid-name,unused-variable
+
+
[email protected]
+def matmul(a: ty.handle, b: ty.handle, c: ty.handle) -> None:
+    A = tir.match_buffer(a, [128, 128])
+    B = tir.match_buffer(b, [128, 128])
+    C = tir.match_buffer(c, [128, 128])
+    for i, j in tir.grid(128, 128):
+        with tir.block([128, 128], "init") as [vi, vj]:
+            C[vi, vj] = tir.float32(0)
+        for k in range(0, 128):
+            with tir.block([128, 128, tir.reduce_axis(0, 128)], "update") as 
[vi, vj, vk]:
+                C[vi, vj] = C[vi, vj] + A[vi, vk] * B[vj, vk]
+
+
+# pylint: enable=no-member,invalid-name,unused-variable
+
+
+def test_tir_schedule_creation():
+    # Tests:
+    # - Schedule.__init__ for PrimFunc and IRModule
+    # - Schedule.mod
+    # - Schedule.state
+    sch_1 = tir.Schedule(matmul, debug_mode=True)
+    sch_2 = tir.Schedule(IRModule({"main": matmul}), debug_mode=True)
+    assert sch_1.mod["main"].same_as(sch_2.mod["main"])
+    assert sch_1.state.mod["main"].same_as(sch_2.state.mod["main"])

Review comment:
       Yes. We will add schedule methods into this class, and the users only 
need to deal with this Schedule class




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to