|
| 1 | +name: Build and test reusable workflow |
| 2 | +run-name: ${{ inputs.run_name }} - ${{ inputs.python_version }} - ${{ inputs.runner_label || 'default'}} |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_call: |
| 6 | + inputs: |
| 7 | + device: |
| 8 | + description: Device |
| 9 | + type: string |
| 10 | + default: max1100 |
| 11 | + driver_version: |
| 12 | + description: Driver version |
| 13 | + type: string |
| 14 | + default: rolling |
| 15 | + runner_label: |
| 16 | + description: Runner label, keep empty for default |
| 17 | + type: string |
| 18 | + default: "" |
| 19 | + pytorch_ref: |
| 20 | + description: PyTorch ref, keep empty for default |
| 21 | + type: string |
| 22 | + default: "" |
| 23 | + pytorch_mode: |
| 24 | + description: PyTorch mode, source or wheels |
| 25 | + type: string |
| 26 | + default: "source" |
| 27 | + python_version: |
| 28 | + description: Python version |
| 29 | + type: string |
| 30 | + required: true |
| 31 | + upload_test_reports: |
| 32 | + description: Upload test reports |
| 33 | + type: boolean |
| 34 | + default: false |
| 35 | + ignore_errors: |
| 36 | + description: Ignore test errors |
| 37 | + type: boolean |
| 38 | + default: false |
| 39 | + skip_list: |
| 40 | + description: Skip list |
| 41 | + type: string |
| 42 | + default: "" |
| 43 | + run_name: |
| 44 | + description: Custom run name |
| 45 | + type: string |
| 46 | + default: Build and test |
| 47 | + build_llvm: |
| 48 | + description: Build LLVM |
| 49 | + type: boolean |
| 50 | + default: false |
| 51 | + enable_unskip: |
| 52 | + description: Ignore pytest.skip |
| 53 | + type: boolean |
| 54 | + default: false |
| 55 | + runner_version: |
| 56 | + description: Runner label for version |
| 57 | + type: string |
| 58 | + default: runner-0.0.19 |
| 59 | + env_manager: |
| 60 | + description: Environment manager |
| 61 | + default: conda |
| 62 | + type: string |
| 63 | + |
| 64 | +permissions: read-all |
| 65 | + |
| 66 | +env: |
| 67 | + TRITON_DISABLE_LINE_INFO: 1 |
| 68 | + TEST_UNSKIP: ${{ inputs.enable_unskip }} |
| 69 | + |
| 70 | +jobs: |
| 71 | + integration-tests: |
| 72 | + name: Integration tests |
| 73 | + runs-on: ${{ fromJson(inputs.runner_label && format('["{0}"]', inputs.runner_label) || format('["{0}", "{1}", "{2}"]', inputs.device, inputs.driver_version, inputs.runner_version)) }} |
| 74 | + defaults: |
| 75 | + run: |
| 76 | + shell: bash -noprofile --norc -eo pipefail scripts/run-${{ inputs.env_manager }}.sh {0} |
| 77 | + steps: |
| 78 | + - name: Checkout repository |
| 79 | + uses: actions/checkout@v4 |
| 80 | + |
| 81 | + - name: Load conda cache |
| 82 | + id: conda-cache |
| 83 | + uses: ./.github/actions/load |
| 84 | + env: |
| 85 | + CACHE_NUMBER: 6 |
| 86 | + with: |
| 87 | + path: $HOME/miniforge3/envs/triton |
| 88 | + key: conda-${{ inputs.env_manager }}-py${{ matrix.python }}-${{ hashFiles('scripts/triton.yml', 'python/pyproject.toml', 'python/setup.py') }}-${{ env.CACHE_NUMBER }} |
| 89 | + |
| 90 | + - name: Install Manager Environment |
| 91 | + shell: bash --noprofile --norc -eo pipefail {0} |
| 92 | + run: | |
| 93 | + scripts/install-${{ inputs.env_manager }}.sh --python-version ${{ inputs.python_version }} |
| 94 | + echo $HOME/miniforge3/bin >>$GITHUB_PATH |
| 95 | +
|
| 96 | + - name: Print inputs |
| 97 | + run: | |
| 98 | + cat <<EOF |
| 99 | + ${{ toJSON(inputs) }} |
| 100 | + EOF |
| 101 | +
|
| 102 | + - name: Setup Triton, Torch and Transformers |
| 103 | + uses: ./.github/actions/install-wheels |
| 104 | + with: |
| 105 | + gh_token: ${{ secrets.GITHUB_TOKEN }} |
| 106 | + install_cmd: conda run --no-capture-output -n triton pip install |
| 107 | + python_version: ${{ inputs.python_version }} |
| 108 | + |
| 109 | + - name: Create test-triton command line |
| 110 | + run: | |
| 111 | + if [[ -n "${{ inputs.skip_list }}" ]]; then |
| 112 | + skiplist="$GITHUB_WORKSPACE/scripts/skiplist/${{ inputs.skip_list }}" |
| 113 | + elif [[ -n "${{ inputs.driver_version }}" ]]; then |
| 114 | + skiplist="$GITHUB_WORKSPACE/scripts/skiplist/${{ inputs.driver_version }}" |
| 115 | + else |
| 116 | + skiplist="$GITHUB_WORKSPACE/scripts/skiplist/default" |
| 117 | + fi |
| 118 | +
|
| 119 | + if [ -d "$skiplist" ]; then |
| 120 | + skiplist="--skip-list $skiplist" |
| 121 | + else |
| 122 | + skiplist= |
| 123 | + fi |
| 124 | +
|
| 125 | + { |
| 126 | + echo SKIPLIST="$skiplist" |
| 127 | + echo TRITON_TEST_CMD="bash -v -x scripts/test-triton.sh --warning-reports --skip-pytorch-install --reports-dir $GITHUB_WORKSPACE/reports ${{ inputs.ignore_errors && '--ignore-errors' || '' }} $skiplist" |
| 128 | + } | tee -a $GITHUB_ENV |
| 129 | +
|
| 130 | + - name: Run core tests |
| 131 | + run: | |
| 132 | + ${{ env.TRITON_TEST_CMD }} --core |
| 133 | +
|
| 134 | + - name: Run interpreter tests |
| 135 | + run: | |
| 136 | + ${{ env.TRITON_TEST_CMD }} --interpreter --skip-pip-install |
| 137 | +
|
| 138 | + - name: Run Tutorials |
| 139 | + run: | |
| 140 | + ${{ env.TRITON_TEST_CMD }} --tutorial --skip-pip-install |
| 141 | +
|
| 142 | + - name: Run inductor test |
| 143 | + run: | |
| 144 | + ${{ env.TRITON_TEST_CMD }} --inductor --skip-pip-install |
| 145 | +
|
| 146 | + - name: Save conda cache |
| 147 | + if: steps.conda-cache.outputs.status == 'miss' |
| 148 | + uses: ./.github/actions/save |
| 149 | + with: |
| 150 | + path: ${{ steps.conda-cache.outputs.path }} |
| 151 | + dest: ${{ steps.conda-cache.outputs.dest }} |
| 152 | + |
| 153 | + - name: Pass rate |
| 154 | + run: | |
| 155 | + pip install defusedxml |
| 156 | + source ./scripts/capture-hw-details.sh |
| 157 | + python3 scripts/pass_rate.py --reports reports ${{ env.SKIPLIST }} |
| 158 | + python3 scripts/pass_rate.py --reports reports --json ${{ env.SKIPLIST }} > pass_rate.json |
| 159 | + python3 scripts/pass_rate.py --reports reports --suite tutorials --json ${{ env.SKIPLIST }} > pass_rate_tutorials.json |
| 160 | +
|
| 161 | + - name: Report environment details |
| 162 | + run: | |
| 163 | + source ./scripts/capture-hw-details.sh --quiet |
| 164 | + cat <<EOF | tee .env |
| 165 | + TIMESTAMP=$(date '+%Y%m%d%H%M%S') |
| 166 | + GITHUB_RUN_ID=$GITHUB_RUN_ID |
| 167 | + GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER |
| 168 | + GITHUB_RUN_ATTEMPT=$GITHUB_RUN_ATTEMPT |
| 169 | + PYTHON_VERSION=${{ inputs.python_version }} |
| 170 | + PYTORCH_REPO=$PYTORCH_REPO |
| 171 | + PYTORCH_COMMIT_ID=$PYTORCH_COMMIT_ID |
| 172 | + PYTORCH_VERSION=$PYTORCH_VERSION |
| 173 | + TRITON_REPO=$GITHUB_REPOSITORY |
| 174 | + LIBIGC1_VERSION=$LIBIGC1_VERSION |
| 175 | + LEVEL_ZERO_VERSION=$LEVEL_ZERO_VERSION |
| 176 | + GPU_DEVICE=$GPU_DEVICE |
| 177 | + AGAMA_VERSION=$AGAMA_VERSION |
| 178 | + EOF |
| 179 | +
|
| 180 | + - name: Upload pass rate report |
| 181 | + # upload reports only for the default branch |
| 182 | + if: github.ref_name == 'main' |
| 183 | + uses: actions/upload-artifact@v4 |
| 184 | + with: |
| 185 | + name: pass_rate-${{ inputs.python_version }}-${{ inputs.runner_label || inputs.driver_version }} |
| 186 | + path: pass_rate*.json |
| 187 | + |
| 188 | + - name: Upload tutorials performance report |
| 189 | + uses: actions/upload-artifact@v4 |
| 190 | + with: |
| 191 | + name: tutorials-${{ inputs.python_version }}-${{ inputs.runner_label || inputs.driver_version }} |
| 192 | + if-no-files-found: warn |
| 193 | + include-hidden-files: true |
| 194 | + path: | |
| 195 | + reports/*/*.csv |
| 196 | + .env |
| 197 | +
|
| 198 | + - name: Upload test reports |
| 199 | + if: inputs.upload_test_reports |
| 200 | + uses: actions/upload-artifact@v4 |
| 201 | + with: |
| 202 | + name: test-reports-${{ inputs.python_version }}-${{ inputs.runner_label || inputs.driver_version }} |
| 203 | + path: reports |
0 commit comments