This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 7ac12ebdd8 [CI] Add GitHub Actions lint workflow (#18809)
7ac12ebdd8 is described below
commit 7ac12ebdd818114bf8e1a610a6a4f6d937e6d511
Author: Tianqi Chen <[email protected]>
AuthorDate: Sun Feb 22 13:31:19 2026 -0500
[CI] Add GitHub Actions lint workflow (#18809)
---
.asf.yaml | 1 -
.../ir/__init__.py => .github/workflows/lint.yml | 39 +++---
pyproject.toml | 3 +
python/tvm/script/ir_builder/relax/ir.py | 62 ++++-----
python/tvm/script/parser/core/doc_core.py | 154 ++++++++++-----------
python/tvm/script/parser/ir/__init__.py | 6 +-
6 files changed, 137 insertions(+), 128 deletions(-)
diff --git a/.asf.yaml b/.asf.yaml
index f949c65a46..c629d77756 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -62,7 +62,6 @@ github:
- cpu/pr-head
- docker/pr-head
- gpu/pr-head
- - lint/pr-head
- wasm/pr-head
required_pull_request_reviews:
diff --git a/python/tvm/script/parser/ir/__init__.py
b/.github/workflows/lint.yml
similarity index 53%
copy from python/tvm/script/parser/ir/__init__.py
copy to .github/workflows/lint.yml
index fd4de5b3ad..17fa38339f 100644
--- a/python/tvm/script/parser/ir/__init__.py
+++ b/.github/workflows/lint.yml
@@ -1,4 +1,3 @@
-# isort: skip_file
# 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
@@ -15,21 +14,29 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
-"""The ir module parser"""
-from tvm.ir import Range
-from ...ir_builder.ir import * # pylint: disable=redefined-builtin
-from . import parser as _parser
-from .entry import ir_module, pyfunc
+name: Lint
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
-__all__ = [
- "ir_module",
- "module_attrs",
- "module_global_infos",
- "dummy_global_info",
- "Range",
- "lookup_vdevice",
- "pyfunc",
- "vdevice",
-]
+concurrency:
+ group: Lint-${{ github.event.pull_request.number || github.sha }}
+ cancel-in-progress: true
+
+jobs:
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #
v6.0.2
+ with:
+ fetch-depth: 0
+ fetch-tags: true
+ - name: Set up uv
+ uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 #
v6.7.0
+ - name: Set up Python environment
+ run: uv sync --group lint --no-install-project
+ - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd #
v3.0.1
diff --git a/pyproject.toml b/pyproject.toml
index 38eb7475fb..a3b4c6d618 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -287,3 +287,6 @@ ignore_errors = true
[[tool.mypy.overrides]]
module = ["python.tvm.runtime.*"]
ignore_errors = true
+
+[dependency-groups]
+lint = ["pre-commit"]
diff --git a/python/tvm/script/ir_builder/relax/ir.py
b/python/tvm/script/ir_builder/relax/ir.py
index 0be2d38909..6bff4ef76a 100644
--- a/python/tvm/script/ir_builder/relax/ir.py
+++ b/python/tvm/script/ir_builder/relax/ir.py
@@ -792,26 +792,27 @@ def dtype(value: Union[py_str, DataType]) -> Expr:
__all__ = [
"Else",
+ "ExternFunc",
"If",
"SeqExpr",
+ "ShapeExpr",
"Then",
"TupleGetItem",
- "ExternFunc",
"abs",
"acos",
"acosh",
- "asin",
- "asinh",
- "atan",
- "atanh",
"add",
"arange",
"arg",
"argmax",
"argmin",
"argsort",
+ "asin",
+ "asinh",
"assert_op",
"astype",
+ "atan",
+ "atanh",
"bitwise_and",
"bitwise_not",
"bitwise_or",
@@ -819,40 +820,42 @@ __all__ = [
"broadcast_to",
"bucketize",
"builtin",
+ "call_builtin_with_ctx",
+ "call_dps_packed",
"call_inplace_packed",
"call_packed",
"call_pure_packed",
+ "call_py_func",
"call_tir",
"call_tir_inplace",
"call_tir_with_grad",
- "call_dps_packed",
- "call_py_func",
- "call_builtin_with_ctx",
+ "ccl",
"ceil",
"clip",
"collapse_sum_like",
"collapse_sum_to",
"concat",
+ "const",
"cos",
"cosh",
- "const",
"cpu",
"cuda",
"cumprod",
"cumsum",
- "einsum",
- "scatter_elements",
- "scatter_nd",
"dataflow",
+ "dequantize",
"device",
"divide",
"dtype",
+ "dynamic_strided_slice",
+ "einsum",
"emit",
+ "emit_match_cast",
"emit_te",
"emit_var_binding",
- "emit_match_cast",
"emit_with_sinfo",
"equal",
+ "erf",
"ewise_fma",
"exp",
"expand_dims",
@@ -879,8 +882,8 @@ __all__ = [
"hamming_window",
"hexagon",
"hint_on_device",
- "index_put",
"image",
+ "index_put",
"index_tensor",
"invoke_closure",
"invoke_pure_closure",
@@ -913,66 +916,67 @@ __all__ = [
"multinomial_from_uniform",
"multiply",
"negative",
+ "nn",
"nonzero",
"not_equal",
"null_value",
+ "one_hot",
"ones",
"ones_like",
- "one_hot",
"opencl",
- "output",
"outer",
+ "output",
"permute_dims",
"power",
"prim_value",
"print",
"prod",
"quantize",
- "dequantize",
"repeat",
"reshape",
"rewriter",
"right_shift",
- "tensor_to_shape",
- "shape_to_tensor",
"rocm",
"round",
"rsqrt",
+ "scatter_elements",
+ "scatter_nd",
"shape",
"shape_of",
- "ShapeExpr",
- "size",
- "std",
- "str",
- "sum",
+ "shape_to_tensor",
"sigmoid",
"sign",
"sin",
"sinh",
+ "size",
"slice_scatter",
"sort",
"split",
+ "sqrt",
"square",
"squeeze",
- "sqrt",
"stack",
+ "std",
"stop_lift_params",
"str",
+ "str",
"strided_slice",
- "dynamic_strided_slice",
"subtract",
+ "sum",
"take",
"tan",
"tanh",
+ "tensor_to_shape",
"tile",
- "topk",
"to_vdevice",
+ "topk",
"tril",
"triu",
"trunc",
"tuple",
"unique",
"variance",
+ "vision",
"vm",
"vpi",
"vulkan",
@@ -981,8 +985,4 @@ __all__ = [
"wrap_param",
"zeros",
"zeros_like",
- "nn",
- "ccl",
- "erf",
- "vision",
]
diff --git a/python/tvm/script/parser/core/doc_core.py
b/python/tvm/script/parser/core/doc_core.py
index 344ac8cf87..a4966d4dc4 100644
--- a/python/tvm/script/parser/core/doc_core.py
+++ b/python/tvm/script/parser/core/doc_core.py
@@ -952,103 +952,103 @@ class withitem(AST):
__all__ = [
"AST",
- "mod",
- "Module",
- "Interactive",
- "Expression",
- "stmt",
- "FunctionDef",
- "ClassDef",
- "Return",
- "Delete",
- "Assign",
- "AugAssign",
+ "Add",
+ "And",
"AnnAssign",
- "For",
- "While",
- "If",
- "With",
- "Raise",
- "Try",
"Assert",
- "Import",
- "ImportFrom",
- "Global",
- "Nonlocal",
- "Expr",
- "Pass",
+ "Assign",
+ "Attribute",
+ "AugAssign",
+ "BinOp",
+ "BitAnd",
+ "BitOr",
+ "BitXor",
+ "BoolOp",
"Break",
+ "Call",
+ "ClassDef",
+ "Compare",
+ "Constant",
"Continue",
- "expr",
- "BoolOp",
- "BinOp",
- "UnaryOp",
- "Lambda",
- "IfExp",
+ "Del",
+ "Delete",
"Dict",
- "Set",
- "ListComp",
- "SetComp",
"DictComp",
- "GeneratorExp",
- "Yield",
- "YieldFrom",
- "Compare",
- "Call",
+ "Div",
+ "Eq",
+ "ExceptHandler",
+ "Expr",
+ "Expression",
+ "FloorDiv",
+ "For",
"FormattedValue",
+ "FunctionDef",
+ "GeneratorExp",
+ "Global",
+ "Gt",
+ "GtE",
+ "If",
+ "IfExp",
+ "Import",
+ "ImportFrom",
+ "In",
+ "Interactive",
+ "Invert",
+ "Is",
+ "IsNot",
"JoinedStr",
- "Constant",
- "NamedExpr",
- "Attribute",
- "Slice",
- "Subscript",
- "Starred",
- "Name",
+ "LShift",
+ "Lambda",
"List",
- "Tuple",
- "expr_context",
- "Del",
+ "ListComp",
"Load",
- "Store",
- "boolop",
- "And",
- "Or",
- "operator",
- "Add",
- "BitAnd",
- "BitOr",
- "BitXor",
- "Div",
- "FloorDiv",
- "LShift",
+ "Lt",
+ "LtE",
+ "MatMult",
"Mod",
+ "Module",
"Mult",
- "MatMult",
+ "Name",
+ "NamedExpr",
+ "Nonlocal",
+ "Not",
+ "NotEq",
+ "NotIn",
+ "Or",
+ "Pass",
"Pow",
"RShift",
+ "Raise",
+ "Return",
+ "Set",
+ "SetComp",
+ "Slice",
+ "Starred",
+ "Store",
"Sub",
- "unaryop",
- "Invert",
- "Not",
+ "Subscript",
+ "Try",
+ "Tuple",
"UAdd",
"USub",
+ "UnaryOp",
+ "While",
+ "With",
+ "Yield",
+ "YieldFrom",
+ "alias",
+ "arg",
+ "arguments",
+ "boolop",
"cmpop",
- "Eq",
- "Gt",
- "GtE",
- "In",
- "Is",
- "IsNot",
- "Lt",
- "LtE",
- "NotEq",
- "NotIn",
"comprehension",
"excepthandler",
- "ExceptHandler",
- "arguments",
- "arg",
+ "expr",
+ "expr_context",
"keyword",
- "alias",
+ "mod",
+ "operator",
+ "stmt",
+ "unaryop",
"withitem",
]
diff --git a/python/tvm/script/parser/ir/__init__.py
b/python/tvm/script/parser/ir/__init__.py
index fd4de5b3ad..0d81bd75e2 100644
--- a/python/tvm/script/parser/ir/__init__.py
+++ b/python/tvm/script/parser/ir/__init__.py
@@ -24,12 +24,12 @@ from .entry import ir_module, pyfunc
__all__ = [
+ "Range",
+ "dummy_global_info",
"ir_module",
+ "lookup_vdevice",
"module_attrs",
"module_global_infos",
- "dummy_global_info",
- "Range",
- "lookup_vdevice",
"pyfunc",
"vdevice",
]