forked from triton-lang/triton
-
Notifications
You must be signed in to change notification settings - Fork 29
160 lines (149 loc) · 5.11 KB
/
amd_perf_kernel_benchmark.yml
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
name: AMD Perf Kernel Benchmark
on:
workflow_dispatch:
push:
branches: [main_perf]
pull_request:
branches: [main_perf]
merge_group:
branches: [main_perf]
types: [checks_requested]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main_perf' }}
permissions: read-all
env:
TRITON_BUILD_WITH_CLANG_LLD: "TRUE"
TRITON_USE_ASSERT_ENABLED_LLVM: "TRUE"
TRITON_DISABLE_LINE_INFO: 1
jobs:
Check-File-Changes:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check file changes
run: |
git fetch origin ${{ github.base_ref }}
changed_files=$(git diff --name-only origin/${{ github.base_ref }} ${{ github.sha }})
echo "Changed files:"
echo "$changed_files"
if echo "$changed_files" | grep -vE "^python/perf-kernels/|^\.github/workflows/amd_"; then
echo "Changes detected outside of the python/perf-kernels directory or .github/workflows/amd_ files. Failing the workflow."
exit 1
fi
Runner-Preparation-AMD:
runs-on: ubuntu-latest
timeout-minutes: 30
outputs:
matrix-HIP: ${{ steps.set-matrix.outputs.matrix-HIP }}
steps:
- name: Prepare runner matrix
id: set-matrix
run: |
if [ x"${{ github.repository }}" == x"ROCm/triton" ]; then
echo '::set-output name=matrix-HIP::[["self-hosted", "rocm.gfx90a"]]'
else
echo '::set-output name=matrix-HIP::[["ubuntu-latest"]]'
fi
Benchmark-AMD:
needs: Runner-Preparation-AMD
if: needs.Runner-Preparation-AMD.outputs.matrix-HIP != ''
runs-on: ${{ matrix.runner }}
timeout-minutes: 90
strategy:
matrix:
runner: ${{fromJson(needs.Runner-Preparation-AMD.outputs.matrix-HIP)}}
container:
image: rocm/pytorch:rocm6.1_ubuntu22.04_py3.10_pytorch_2.4
options: --device=/dev/kfd --device=/dev/dri --security-opt seccomp=unconfined --group-add video --user root
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Clear cache
run: |
rm -rf ~/.triton
mkdir -p ~/.triton
ls -alh ~/.triton
- name: Update PATH
run: |
echo "/opt/rocm/llvm/bin" >> $GITHUB_PATH
- name: Install pip dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install lit matplotlib pandas
- name: Install Triton
run: |
echo "PATH is '$PATH'"
pip uninstall -y triton
cd python
pip install -v -e .
- name: Run Perf Kernels Benchmark
run: |
python ./python/perf-kernels/flash-attention.py
python ./python/perf-kernels/softmax.py
python ./python/perf-kernels/rmsnorm.py
python ./python/perf-kernels/layernorm.py
# python ./python/perf-kernels/multreduce_matmul_kernel.py bench
- name: Upload benchmark results
uses: actions/upload-artifact@v4
with:
name: benchmark-csv-results
path: python/perf-kernels/*.csv
if-no-files-found: error
Analyze-Results:
needs: Benchmark-AMD
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout reporting system
uses: actions/checkout@v4
with:
repository: 'ROCm/triton-reporting-system'
- name: Download CSV results
uses: actions/download-artifact@v4
with:
name: benchmark-csv-results
path: $GITHUB_WORKSPACE/csvs
- name: Find previous successful run
id: find_run
uses: actions/github-script@v6
with:
script: |
const runs = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: context.workflow,
branch: 'main_perf',
status: 'success'
});
if (runs.data.workflow_runs.length > 1) {
core.setOutput('run_id', runs.data.workflow_runs[1].id);
} else {
console.log("No previous successful run found");
}
- name: Download previous data
uses: actions/download-artifact@v4
if: steps.find_run.outputs.run_id != null
with:
name: data.json
github-token: ${{ github.token }}
run-id: ${{ steps.find_run.outputs.run_id }}
- name: Compare results
run: |
if [[ -e data.json ]]; then
master_data_args="--master-history-file data.json"
else
master_data_args=""
echo "[]" > current_data.json
python3 report_builder.py --report-config TRITON_KERNELS \
--output-dir ./output --history-file current_data.json \
--root-dir csvs ${master_data_args} --skip-html-report
- name: Upload results
uses: actions/upload-artifact@v4
with:
name: comparison-results.txt
path: output/results.txt