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



##########
File path: python/tvm/tir/schedule/instruction.py
##########
@@ -0,0 +1,166 @@
+# 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.
+"""Schedule instructions each corresponds to a schedule primitive"""
+from typing import TYPE_CHECKING, Any, List, Union
+
+from tvm._ffi import register_object as _register_object
+from tvm.runtime import Object
+
+from . import _ffi_api
+
+if TYPE_CHECKING:
+    from .schedule import RAND_VAR_TYPE
+
+    INPUT_RV_TYPE = Union[RAND_VAR_TYPE, float, int, str, None]  # pylint: 
disable=invalid-name
+    OUTPUT_RV_TYPE = Union[RAND_VAR_TYPE]  # pylint: disable=invalid-name
+    ATTR_TYPE = Any
+else:
+    INPUT_RV_TYPE = OUTPUT_RV_TYPE = ATTR_TYPE = Any
+
+
+@_register_object("tir.InstructionKind")
+class InstructionKind(Object):
+    """Kind of an instruction, e.g. Split, Reorder, etc.
+    Besides the name, every kind of instruction has its own properties, 
including:
+    1) A boolean indicating if the instruction is pure, i.e. change nothing in 
the schedule state
+    2) A functor that applies the instruction to a TensorIR schedule
+    3) A functor that converts the instruction to a statement in python syntax
+    4) A functor that serialize its attributes to JSON
+    5) A functor that deserialize its attributes from JSON
+
+    Unlike `tvm.ir.op`, `InstructionKind` doesn't support unstructured 
properties,
+    mainly because there is no such usecase yet to add any other property.
+
+    Attributes
+    ----------
+    name : str
+        The name of a kind of instructions
+
+    Note
+    ----------

Review comment:
       Thanks for the remainder! I was not aware of this required syntax in RST 
:-)




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