|
| 1 | +name: nvidia-a100-ci |
| 2 | + |
| 3 | +concurrency: |
| 4 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 5 | + cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 6 | + |
| 7 | +on: |
| 8 | + pull_request: |
| 9 | + branches: [ '*' ] |
| 10 | + types: [opened, synchronize, reopened, closed] |
| 11 | + push: |
| 12 | + branches: |
| 13 | + - main |
| 14 | + tags: |
| 15 | + - '*' |
| 16 | + |
| 17 | +jobs: |
| 18 | + test: |
| 19 | + if: github.event_name != 'pull_request' || github.event.action != 'closed' |
| 20 | + runs-on: 'nvidia-a100' |
| 21 | + env: |
| 22 | + FLA_CI_ENV: 1 |
| 23 | + steps: |
| 24 | + - name: Check out repo |
| 25 | + uses: actions/checkout@v4 |
| 26 | + |
| 27 | + - name: Check skip keyword in LATEST commit (Push only) |
| 28 | + id: check_skip |
| 29 | + run: | |
| 30 | + if [ "${{ github.event_name }}" = "push" ] && ! [[ "${{ github.ref }}" =~ ^refs/tags/ ]]; then |
| 31 | + COMMIT_MSG=$(jq -r '.head_commit.message' <<< '${{ toJSON(github.event) }}') |
| 32 | + echo "Latest commit message: $COMMIT_MSG" |
| 33 | + if echo "$COMMIT_MSG" | grep -qF "[skip test]"; then |
| 34 | + echo "::notice::Tests skipped by commit message" |
| 35 | + echo "skip_tests=true" >> $GITHUB_OUTPUT |
| 36 | + else |
| 37 | + echo "skip_tests=false" >> $GITHUB_OUTPUT |
| 38 | + fi |
| 39 | + else |
| 40 | + echo "skip_tests=false" >> $GITHUB_OUTPUT |
| 41 | + fi |
| 42 | +
|
| 43 | + - name: Get changed files |
| 44 | + if: | |
| 45 | + (github.event_name == 'pull_request' || |
| 46 | + (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/'))) && |
| 47 | + (steps.check_skip.outputs.skip_tests != 'true' || github.event_name != 'push') |
| 48 | + id: changed-files |
| 49 | + uses: tj-actions/[email protected] |
| 50 | + |
| 51 | + - name: Find dependent test files |
| 52 | + if: | |
| 53 | + (github.event_name == 'pull_request' || |
| 54 | + (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/'))) && |
| 55 | + (steps.check_skip.outputs.skip_tests != 'true' || github.event_name != 'push') |
| 56 | + id: find-dependent-tests |
| 57 | + run: | |
| 58 | + # Run the Python script to find dependent test files |
| 59 | + TEST_FILES=$(python scripts/find_dependent_tests.py "${{ steps.changed-files.outputs.all_changed_files }}") |
| 60 | + echo "test_files=$TEST_FILES" >> $GITHUB_OUTPUT |
| 61 | +
|
| 62 | + - name: Setup python |
| 63 | + if: steps.find-dependent-tests.outputs.test_files && steps.check_skip.outputs.skip_tests == 'false' |
| 64 | + run: | |
| 65 | + # Installed by hand to avoid issues with pip |
| 66 | + # pip install -U pytest setuptools wheel ninja torch triton |
| 67 | + # MAX_JOBS=4 pip install -U flash-attn --no-build-isolation |
| 68 | + # pip install git+https://github.com/Dao-AILab/causal-conv1d.git --no-build-isolation |
| 69 | + pip install -U uv |
| 70 | + pip uninstall -y flash-linear-attention |
| 71 | + uv pip install git+https://github.com/Dao-AILab/causal-conv1d.git -U --no-cache-dir --no-build-isolation |
| 72 | + uv pip install flash-attn -U --no-cache-dir --no-build-isolation |
| 73 | + uv pip install torch~=2.7.0 triton pytest setuptools wheel ninja -U --index-url https://download.pytorch.org/whl/cu128 |
| 74 | + pip install . |
| 75 | +
|
| 76 | + - name: Check GPU status |
| 77 | + if: steps.find-dependent-tests.outputs.test_files && steps.check_skip.outputs.skip_tests == 'false' |
| 78 | + run: | |
| 79 | + python scripts/check_gpu.py |
| 80 | + if [ $? -ne 0 ]; then |
| 81 | + echo "GPU is occupied. Stopping the workflow." |
| 82 | + exit 1 |
| 83 | + fi |
| 84 | +
|
| 85 | + - name: Test compiling on changed test files |
| 86 | + if: steps.find-dependent-tests.outputs.test_files && steps.check_skip.outputs.skip_tests == 'false' |
| 87 | + run: | |
| 88 | + FLA_COMPILER_MODE=1 TRITON_PRINT_AUTOTUNING=0 SKIP_TEST_CHUNK_VARLEN=1 \ |
| 89 | + pytest ${{ steps.find-dependent-tests.outputs.test_files }} |
| 90 | +
|
| 91 | + - name: Run pytest on test files |
| 92 | + if: steps.find-dependent-tests.outputs.test_files && steps.check_skip.outputs.skip_tests == 'false' |
| 93 | + run: | |
| 94 | + FLA_COMPILER_MODE=0 TRITON_PRINT_AUTOTUNING=0 SKIP_TEST_CHUNK_VARLEN=1 \ |
| 95 | + pytest ${{ steps.find-dependent-tests.outputs.test_files }} |
| 96 | +
|
| 97 | + - name: Run pytest on varlen test files |
| 98 | + if: steps.find-dependent-tests.outputs.test_files && steps.check_skip.outputs.skip_tests == 'false' |
| 99 | + run: | |
| 100 | + FLA_COMPILER_MODE=0 TRITON_PRINT_AUTOTUNING=0 SKIP_TEST_CHUNK_VARLEN=0 \ |
| 101 | + pytest ${{ steps.find-dependent-tests.outputs.test_files }} || \ |
| 102 | + echo "Varlen tests failed (non-critical)" |
| 103 | +
|
| 104 | + - name: Test full compiling on all test files |
| 105 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && steps.check_skip.outputs.skip_tests == 'false' |
| 106 | + run: | |
| 107 | + FLA_COMPILER_MODE=1 TRITON_PRINT_AUTOTUNING=0 SKIP_TEST_CHUNK_VARLEN=1 \ |
| 108 | + pytest tests/ |
| 109 | +
|
| 110 | + - name: Run full pytest on test files |
| 111 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && steps.check_skip.outputs.skip_tests == 'false' |
| 112 | + run: | |
| 113 | + FLA_COMPILER_MODE=0 TRITON_PRINT_AUTOTUNING=0 SKIP_TEST_CHUNK_VARLEN=1 \ |
| 114 | + pytest ${{ steps.find-dependent-tests.outputs.test_files }} |
| 115 | +
|
| 116 | + - name: Run full pytest on varlen test files |
| 117 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && steps.check_skip.outputs.skip_tests == 'false' |
| 118 | + run: | |
| 119 | + FLA_COMPILER_MODE=0 TRITON_PRINT_AUTOTUNING=0 SKIP_TEST_CHUNK_VARLEN=0 \ |
| 120 | + pytest ${{ steps.find-dependent-tests.outputs.test_files }} || \ |
| 121 | + echo "Varlen tests failed (non-critical)" |
0 commit comments