-
Notifications
You must be signed in to change notification settings - Fork 27
199 lines (179 loc) · 6.24 KB
/
Copy pathtritonbench-bisect.yml
File metadata and controls
199 lines (179 loc) · 6.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: TritonBench Bisect
on:
workflow_dispatch:
inputs:
tritonbench_branch:
description: TritonBench branch (main)
required: true
type: string
default: main
runners:
description: |
Hardware
required: true
type: choice
options:
- 'b200'
bisect_type:
type: choice
default: 'performance'
options:
- 'performance'
- 'functional'
triton_channel:
type: choice
default: 'triton-main'
options:
- 'triton-main'
- 'meta-triton'
description: 'Triton channel to bisect'
repro_cmdline:
required: True
type: string
description: |
The command line to reproduce the regression
good_commit:
required: True
type: string
description: |
Last good commit (no regression)
bad_commit:
required: True
type: string
description: |
First bad commit (has regression)
regression_threshold:
type: number
default: 10
description: |
Performance regression threshold in %
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name == 'workflow_dispatch' }}-${{ github.event_name == 'schedule' }}
cancel-in-progress: true
jobs:
set-parameters:
runs-on: ubuntu-latest
outputs:
benchmark_matrix: ${{ steps.set-parameters.outputs.benchmark_matrix }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Set parameters
id: set-parameters
shell: bash
env:
RUNNERS: ${{ inputs.runners || '' }}
run: |
set -eux
# The generated matrix is grouped by benchmark and runner
python .github/scripts/generate_tritonbench_matrix.py \
--runners "${RUNNERS}" --benchmark bisect --triton ${{ inputs.triton_channel }}
bisect:
name: Run TritonBench Bisect
needs: set-parameters
if: ${{ !github.event.pull_request.head.repo.fork && github.repository_owner == 'pytorch' }}
strategy:
matrix: ${{ fromJson(needs.set-parameters.outputs.benchmark_matrix) }}
fail-fast: false
runs-on: ${{ matrix.runner }}
env:
WORKSPACE_DIR: "/workspace"
SETUP_SCRIPT: "/workspace/setup-instance.sh"
UV_VENV_DIR: "/workspace/uv_venvs"
CONDA_ENV: ${{ matrix.triton_channel }}
TRITONBENCH_SCRIBE_GRAPHQL_ACCESS_TOKEN: ${{ secrets.TRITONBENCH_SCRIBE_GRAPHQL_ACCESS_TOKEN }}
JOB_NAME: tritonbench-${{ matrix.runner }}-bisect-${{ matrix.triton_channel }}
RUNNER_TYPE: ${{ matrix.runner }}
GOOD_COMMIT: ${{ inputs.good_commit }}
BAD_COMMIT: ${{ inputs.bad_commit }}
REGRESSION_THRESHOLD: ${{ inputs.regression_threshold }}
REPRO_CMDLINE: ${{ inputs.repro_cmdline }}
FUNCTIONAL: ${{ inputs.bisect_type == 'functional' && '1' || '0' }}
environment: pytorch-x-vllm
permissions:
id-token: write
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install system dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y libnuma-dev numactl
- name: Checkout TritonBench repository
uses: actions/checkout@v4
with:
repository: meta-pytorch/tritonbench
path: triton-benchmarks/tritonbench
ref: main
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@v5
# Amazon Linux fails on this step
continue-on-error: true
with:
python-version: '3.12'
cache: 'pip'
- name: Check if the device is supported
shell: bash
run: |
set -eux
if command -v nvidia-smi; then
DEVICE_NAME=cuda
nvidia-smi
elif command -v rocm-smi; then
DEVICE_NAME=rocm
rocm-smi
else
DEVICE_NAME=cpu
lscpu
fi
echo "DEVICE_NAME=$DEVICE_NAME" >> $GITHUB_ENV
- name: Set GPU name and type
shell: bash
run: |
set -eux
if [[ "${DEVICE_NAME}" == "cuda" ]]; then
DEVICE_TYPE=$(nvidia-smi -i 0 --query-gpu=name --format=csv,noheader | awk '{print $2}')
CUDA_HOME="/usr/local/cuda"
echo "CUDA_HOME=$CUDA_HOME" >> $GITHUB_ENV
elif [[ "${DEVICE_NAME}" == "rocm" ]]; then
DEVICE_TYPE=$(rocminfo | grep "Marketing Name" | tail -n1 | awk -F':' '{print $2}' | xargs)
elif [[ "${DEVICE_NAME}" == "cpu" ]]; then
DEVICE_TYPE=$(lscpu | grep 'Model name' | cut -f 2 -d ":" | awk '{$1=$1}1' | cut -f 2 -d " ")
fi
echo "DEVICE_TYPE=$DEVICE_TYPE" >> $GITHUB_ENV
- name: Install TritonBench
working-directory: triton-benchmarks/tritonbench
run: |
set -eux
# Use MAX_JOBS=16 to avoid OOM compiling Triton
if [ "${CONDA_ENV}" == "triton-main" ]; then
CMD_SUFFIX="--triton-main"
elif [ "${CONDA_ENV}" == "meta-triton" ]; then
CMD_SUFFIX="--meta-triton"
else
echo "unknown conda env: ${CONDA_ENV}"
exit 1
fi
MAX_JOBS=16 bash ./.ci/tritonbench/setup-env.sh --cuda ${CMD_SUFFIX}
- name: Run TritonBench Bisect
working-directory: triton-benchmarks/tritonbench
run: |
set -eux
# Run TritonBench on the first available CPU core
# Single CPU core is needed to stabilize the benchmark results
first_available_core=$(taskset -pc $$| sed -n 's/.*: \([0-9][0-9]*\).*/\1/p')
taskset -c ${first_available_core} bash .ci/bisect/run.sh
mv bisect_logs bisect-results-${{ env.CONDA_ENV }}
# Keep a copy of the benchmark results on GitHub for reference
- uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ env.JOB_NAME }}
path: triton-benchmarks/tritonbench/bisect-results-${{ env.CONDA_ENV }}
retention-days: 30