clean 2dInnerReductionHeuristic (#3331) #17833
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
# the most recent commit in the PR would cancel older commit's in-progress workflows | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id}} | |
cancel-in-progress: true | |
env: | |
working_directory: . | |
jobs: | |
check-license: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Look for missing license headers | |
working-directory: ${{ env.working_directory }} | |
run: | | |
find . -regextype posix-extended -regex '.*\.(cpp|h|py|md|svg)' | egrep -v '^./(\.|third_party|bin|build|nvfuser/include|nvfuser/version.py|tools/linter/adapters|csrc/serde/fusion_cache_generated.h)' | xargs grep -L SPDX-FileCopyrightText | tee missing-header-files.txt | |
# test that file is empty | |
test ! -s missing-header-files.txt | |
clang-tidy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Run lintrunner | |
working-directory: ${{ env.working_directory }} | |
run: | | |
tools/apt-install-things.sh & | |
tools/pip-install-things.sh & | |
source tools/setup-env.sh | |
# clang-tidy does not work well with gcc-13 headers, remove them | |
sudo rm -rf /usr/lib/gcc/x86_64-linux-gnu/13 | |
# Install lintrunner | |
pip install lintrunner | |
# Initialize lintrunner | |
lintrunner init 2> /dev/null | |
wait | |
# Run cmake build | |
python setup.py --cmake-only | |
# Generate csrc/serde/fusion_cache_generated.h | |
# NOTE: this might cause a compile of flatbuffers if it is missing | |
ninja -C build build_flatbuffer_config | |
# Run lintrunner on all csrc files exclude benchmark and test folders | |
this_commit=$(git rev-parse HEAD) | |
git fetch origin main | |
git checkout origin/main | |
head_commit=$(git rev-parse HEAD) | |
git checkout $this_commit | |
# diff-filter for lower case letter: | |
# https://github.com/git/git/commit/7f2ea5f0f2fb056314092cce23202096ca70f076 | |
git --no-pager diff --diff-filter=d --name-only $head_commit | grep -e "csrc/.*\.cpp" -e "csrc/.*\.h" | xargs lintrunner --take CLANGTIDY --force-color | |
lintrunner: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Run lintrunner | |
working-directory: ${{ env.working_directory }} | |
run: | | |
# Install lintrunner | |
pip install lintrunner | |
# Initialize lintrunner | |
lintrunner init 2> /dev/null | |
# Install dependencies | |
sudo apt install -y libtinfo5 | |
# Run lintrunner except clang-tidy | |
lintrunner --force-color --take FLAKE8,MYPY,CLANGFORMAT,NOQA,TYPEIGNORE,NEWLINE,MYPYSTRICT,TABS,SPACES,EXEC,BLACK,TORCH_INTERNAL_ASSERT,TORCH_CHECK,C10_ERROR,TORCH_CUDA_CU_API --all-files |