From 3889f3f3b97b817741e308c173409927b7c4536f Mon Sep 17 00:00:00 2001 From: Xuehai Pan Date: Mon, 28 Oct 2024 10:50:12 +0800 Subject: [PATCH] [CI] bump yapf version from be72557 to 7e21823 (#4997) This PR bumps `yapf` version from `be72557` to `7e21823` in pre-commit hook. Commit `7e21823` fixes race condition when `pre-commit` running `yapf` in parallel. Use a sha1 revision rather than a semver on PyPI because the change is not released yet. See also: - google/yapf#1243 ------ The core Triton is a small number of people, and we receive many PRs (thank you!). To help us review your code more quickly, **if you are a new contributor (less than 3 PRs merged) we ask that you complete the following tasks and include the filled-out checklist in your PR description.** Complete the following tasks before sending your PR, and replace `[ ]` with `[x]` to indicate you have done them. - [X] I am not making a trivial change, such as fixing a typo in a comment. - [X] I have written a PR description following these [rules](https://cbea.ms/git-commit/#why-not-how). - [X] I have run `pre-commit run --from-ref origin/main --to-ref HEAD`. - Select one of the following. - [ ] I have added tests. - `/test` for `lit` tests - `/unittest` for C++ tests - `/python/test` for end-to-end tests - [X] This PR does not need a test because `FILL THIS IN`. - Select one of the following. - [x] I have not added any `lit` tests. - [ ] The `lit` tests I have added follow these [best practices](https://mlir.llvm.org/getting_started/TestingGuide/#filecheck-best-practices), including the "tests should be minimal" section. (Usually running Python code and using the instructions it generates is not minimal.) --- .pre-commit-config.yaml | 14 ++++++-------- python/src/passes.h | 6 ++---- python/triton/compiler/code_generator.py | 2 +- third_party/proton/csrc/include/Utility/Errors.h | 2 +- third_party/proton/test/example_cuda.json | 2 +- third_party/proton/test/example_hip.json | 2 +- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f2aab636bbde..a85e54d05d18 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,7 @@ +default_stages: [pre-commit, pre-push, manual] repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v5.0.0 hooks: - id: check-symlinks - id: destroyed-symlinks @@ -17,12 +18,11 @@ repos: - id: debug-statements - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.3 + rev: v0.7.1 hooks: - id: ruff files: '^python/.*' - args: ["--fix", "--line-length", "120"] - stages: [pre-commit, pre-push, manual] + args: ["--fix", "--exit-non-zero-on-fix"] exclude: | (?x)( ^python/triton/runtime/.*| @@ -31,18 +31,16 @@ repos: ) - repo: https://github.com/google/yapf - rev: be72557 + rev: "7e21823" hooks: - id: yapf args: ["-p", "-i"] - stages: [pre-commit, pre-push, manual] exclude: "python/test/unit/language/test_line_info.py" - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v16.0.6 + rev: v19.1.2 hooks: - id: clang-format - stages: [pre-commit, pre-push, manual] # Expand YAML anchors in files used by github workflows, because github can't # do this itself. This lets us use anchors, which avoids code duplication. diff --git a/python/src/passes.h b/python/src/passes.h index 46801d802c75..629fe362d8b2 100644 --- a/python/src/passes.h +++ b/python/src/passes.h @@ -34,7 +34,5 @@ }) #define ADD_PASS_OPTION_WRAPPER_4(name, builder, ty0, ty1, ty2, ty3) \ - m.def(name, \ - [](mlir::PassManager &pm, ty0 val0, ty1 val1, ty2 val2, ty3 val3) { \ - pm.addPass(builder({val0, val1, val2, val3})); \ - }) + m.def(name, [](mlir::PassManager &pm, ty0 val0, ty1 val1, ty2 val2, \ + ty3 val3) { pm.addPass(builder({val0, val1, val2, val3})); }) diff --git a/python/triton/compiler/code_generator.py b/python/triton/compiler/code_generator.py index 9ab3f4bc0c79..ec0ef227fa01 100644 --- a/python/triton/compiler/code_generator.py +++ b/python/triton/compiler/code_generator.py @@ -804,7 +804,7 @@ def visit_UnaryOp(self, node): def _verify_loop_carried_variable(self, name, loop_val, live_val): assert _is_triton_value(loop_val), f'cannot reassign constxpr {name} in the loop' assert _is_triton_value(live_val), f'cannot reasign constexpr {name} in the loop' - assert type(loop_val) == type(live_val), f'Loop carried variable {name} changed type' + assert type(loop_val) is type(live_val), f'Loop carried variable {name} changed type' assert not _is_triton_tensor(loop_val) or loop_val.type == live_val.type, \ f'Loop-carried variable {name} has initial type {live_val.type} '\ f'but is re-assigned to {loop_val.type} in loop! '\ diff --git a/third_party/proton/csrc/include/Utility/Errors.h b/third_party/proton/csrc/include/Utility/Errors.h index 094723d6f7e8..09c44025dc45 100644 --- a/third_party/proton/csrc/include/Utility/Errors.h +++ b/third_party/proton/csrc/include/Utility/Errors.h @@ -7,7 +7,7 @@ namespace proton { class NotImplemented : public std::logic_error { public: - NotImplemented() : std::logic_error("Not yet implemented"){}; + NotImplemented() : std::logic_error("Not yet implemented") {}; }; } // namespace proton diff --git a/third_party/proton/test/example_cuda.json b/third_party/proton/test/example_cuda.json index 445f0e224c65..5c742267acab 100644 --- a/third_party/proton/test/example_cuda.json +++ b/third_party/proton/test/example_cuda.json @@ -1,4 +1,4 @@ - [ +[ { "children": [ { diff --git a/third_party/proton/test/example_hip.json b/third_party/proton/test/example_hip.json index 68538706cfe9..70eaf325d35b 100644 --- a/third_party/proton/test/example_hip.json +++ b/third_party/proton/test/example_hip.json @@ -1,4 +1,4 @@ - [ +[ { "children": [ {