Skip to content

Commit 10a5152

Browse files
authored
Merge pull request #2733 from oneapi-src/restore-perf-workflow
restore performance workflow
2 parents 62fb470 + 340a5bb commit 10a5152

File tree

4 files changed

+97
-107
lines changed

4 files changed

+97
-107
lines changed

.github/workflows/benchmarks-nightly.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
- cron: '0 0 * * *' # Runs at midnight UTC every day
66

77
permissions:
8-
contents: read
8+
contents: write
99
pull-requests: write
1010

1111
jobs:
@@ -14,9 +14,9 @@ jobs:
1414
uses: ./.github/workflows/benchmarks-reusable.yml
1515
with:
1616
str_name: 'level_zero'
17-
unit: 'gpu'
17+
preset: 'Full'
1818
pr_no: 0
19-
bench_script_params: '--save baseline'
19+
bench_script_params: '--save Baseline_PVC_L0'
2020
sycl_config_params: ''
2121
sycl_repo: 'intel/llvm'
2222
sycl_commit: ''
@@ -29,10 +29,9 @@ jobs:
2929
uses: ./.github/workflows/benchmarks-reusable.yml
3030
with:
3131
str_name: 'level_zero_v2'
32-
unit: 'gpu'
32+
preset: 'Full'
3333
pr_no: 0
34-
bench_script_params: '--save baseline-v2'
34+
bench_script_params: '--save Baseline_PVC_L0v2'
3535
sycl_config_params: ''
3636
sycl_repo: 'intel/llvm'
3737
sycl_commit: ''
38-
upload_report: true

.github/workflows/benchmarks-reusable.yml

Lines changed: 67 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
str_name:
77
required: true
88
type: string
9-
unit:
9+
preset:
1010
required: true
1111
type: string
1212
pr_no:
@@ -30,17 +30,13 @@ on:
3030
required: false
3131
type: string
3232
default: ''
33-
upload_report:
34-
required: false
35-
type: boolean
36-
default: false
3733
compute_runtime_commit:
3834
required: false
3935
type: string
4036
default: ''
4137

4238
permissions:
43-
contents: read
39+
contents: write
4440
pull-requests: write
4541

4642
jobs:
@@ -51,7 +47,6 @@ jobs:
5147
adapter: [
5248
{str_name: "${{ inputs.str_name }}",
5349
sycl_config: "${{ inputs.sycl_config_params }}",
54-
unit: "${{ inputs.unit }}"
5550
}
5651
]
5752
build_type: [Release]
@@ -60,12 +55,6 @@ jobs:
6055
runs-on: "${{ inputs.str_name }}_PERF"
6156

6257
steps:
63-
- name: Cleanup self-hosted workspace
64-
if: always()
65-
run: |
66-
ls -la ./
67-
rm -rf ./* || true
68-
6958
- name: Add comment to PR
7059
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
7160
if: ${{ always() && inputs.pr_no != 0 }}
@@ -84,25 +73,28 @@ jobs:
8473
body: body
8574
})
8675
87-
- name: Checkout UR
76+
- name: Checkout benchmark scripts
8877
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
8978
with:
90-
path: ur-repo
79+
repository: intel/llvm
80+
ref: unify-benchmark-ci
81+
path: sc
82+
sparse-checkout: |
83+
devops/scripts/benchmarks
9184
92-
- name: Install pip packages
93-
run: |
94-
pip install --force-reinstall -r ${{github.workspace}}/ur-repo/third_party/benchmark_requirements.txt
95-
96-
# We need to fetch special ref for proper PR's merge commit. Note, this ref may be absent if the PR is already merged.
97-
- name: Fetch PR's merge commit
98-
if: ${{ inputs.pr_no != 0 }}
99-
working-directory: ${{github.workspace}}/ur-repo
100-
env:
101-
PR_NO: ${{ inputs.pr_no }}
85+
- name: Checkout results branch
86+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
87+
with:
88+
ref: benchmark-results
89+
path: results-repo
90+
91+
- name: Create virtual environment
92+
run: python -m venv .venv
93+
94+
- name: Activate virtual environment and install pip packages
10295
run: |
103-
git fetch -- https://github.com/${{github.repository}} +refs/pull/${PR_NO}/*:refs/remotes/origin/pr/${PR_NO}/*
104-
git checkout origin/pr/${PR_NO}/merge
105-
git rev-parse origin/pr/${PR_NO}/merge
96+
source .venv/bin/activate
97+
pip install -r sc/devops/scripts/benchmarks/requirements.txt
10698
10799
- name: Checkout SYCL
108100
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
@@ -135,8 +127,6 @@ jobs:
135127
--ci-defaults ${{matrix.adapter.sycl_config}}
136128
--cmake-opt="-DLLVM_INSTALL_UTILS=ON"
137129
--cmake-opt="-DSYCL_PI_TESTS=OFF"
138-
--cmake-opt="-DSYCL_UR_USE_FETCH_CONTENT=OFF"
139-
--cmake-opt="-DSYCL_UR_SOURCE_DIR=${{github.workspace}}/ur-repo/"
140130
--cmake-opt=-DCMAKE_C_COMPILER_LAUNCHER=ccache
141131
--cmake-opt=-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
142132
@@ -146,7 +136,7 @@ jobs:
146136
- name: Configure UR
147137
run: >
148138
cmake -DCMAKE_BUILD_TYPE=Release
149-
-S${{github.workspace}}/ur-repo
139+
-S${{github.workspace}}/sycl-repo/unified-runtime
150140
-B${{github.workspace}}/ur_build
151141
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/ur_install
152142
-DUR_BUILD_TESTS=OFF
@@ -160,35 +150,6 @@ jobs:
160150
- name: Install UR
161151
run: cmake --install ${{github.workspace}}/ur_build
162152

163-
- name: Checkout UMF
164-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
165-
with:
166-
repository: oneapi-src/unified-memory-framework
167-
ref: main
168-
path: umf-repo
169-
fetch-depth: 1
170-
fetch-tags: false
171-
172-
- name: Configure UMF
173-
run: >
174-
cmake -DCMAKE_BUILD_TYPE=Release
175-
-S${{github.workspace}}/umf-repo
176-
-B${{github.workspace}}/umf_build
177-
-DUMF_BUILD_BENCHMARKS=ON
178-
-DUMF_BUILD_SHARED_LIBRARY=ON
179-
-DUMF_BUILD_BENCHMARKS_MT=ON
180-
-DUMF_BUILD_TESTS=OFF
181-
-DUMF_FORMAT_CODE_STYLE=OFF
182-
-DUMF_DEVELOPER_MODE=OFF
183-
-DUMF_BUILD_LEVEL_ZERO_PROVIDER=ON
184-
-DUMF_BUILD_CUDA_PROVIDER=ON
185-
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
186-
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
187-
-DUMF_BUILD_EXAMPLES=OFF
188-
189-
- name: Build UMF
190-
run: cmake --build ${{github.workspace}}/umf_build -j $(nproc)
191-
192153
- name: Compute core range
193154
run: |
194155
# Compute the core range for the first NUMA node; second node is for UMF jobs.
@@ -208,25 +169,25 @@ jobs:
208169
echo "ZE_AFFINITY_MASK=$ZE_AFFINITY_MASK" >> $GITHUB_ENV
209170
210171
- name: Run benchmarks
211-
working-directory: ${{ github.workspace }}/ur-repo/
212172
id: benchmarks
213173
run: >
214-
taskset -c ${{ env.CORES }} ${{ github.workspace }}/ur-repo/scripts/benchmarks/main.py
215-
~/bench_workdir
174+
source .venv/bin/activate &&
175+
taskset -c ${{ env.CORES }} ./sc/devops/scripts/benchmarks/main.py
176+
~/ur_bench_workdir
216177
--sycl ${{ github.workspace }}/sycl_build
217178
--ur ${{ github.workspace }}/ur_install
218-
--umf ${{ github.workspace }}/umf_build
219179
--adapter ${{ matrix.adapter.str_name }}
220180
--compute-runtime ${{ inputs.compute_runtime_commit }}
221181
--build-igc
222-
--compare baseline
223-
${{ inputs.upload_report && '--output-html' || '' }}
224-
${{ inputs.pr_no != 0 && '--output-markdown' || '' }}
182+
--output-html remote
183+
--results-dir ${{ github.workspace }}/results-repo
184+
--output-markdown
185+
--preset ${{ inputs.preset }}
225186
${{ inputs.bench_script_params }}
226187
227188
- name: Print benchmark results
228189
run: |
229-
cat ${{ github.workspace }}/ur-repo/benchmark_results.md || true
190+
cat ${{ github.workspace }}/sc/devops/scripts/benchmarks/benchmark_results.md || true
230191
231192
- name: Add comment to PR
232193
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
@@ -236,7 +197,7 @@ jobs:
236197
let markdown = ""
237198
try {
238199
const fs = require('fs');
239-
markdown = fs.readFileSync('ur-repo/benchmark_results.md', 'utf8');
200+
markdown = fs.readFileSync('sc/devops/scripts/benchmarks/benchmark_results.md', 'utf8');
240201
} catch(err) {
241202
}
242203
@@ -255,14 +216,41 @@ jobs:
255216
body: body
256217
})
257218
258-
- name: Upload HTML report
259-
if: ${{ always() && inputs.upload_report }}
260-
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
261-
with:
262-
path: ur-repo/benchmark_results.html
263-
key: benchmark-results-${{ matrix.adapter.str_name }}-${{ github.run_id }}
219+
- name: Commit data.json and results directory
220+
working-directory: results-repo
221+
run: |
222+
git config --global user.name "GitHub Actions Bot"
223+
git config --global user.email "[email protected]"
224+
225+
for attempt in {1..5}; do
226+
echo "Attempt $attempt to push changes"
227+
228+
rm -f data.json
229+
cp ${{ github.workspace }}/sc/devops/scripts/benchmarks/html/data.json .
230+
231+
git add data.json results/
232+
git commit -m "Add benchmark results and data.json"
233+
234+
results_file=$(git diff HEAD~1 --name-only -- results/ | head -n 1)
235+
236+
if git push origin benchmark-results; then
237+
echo "Push succeeded"
238+
break
239+
fi
240+
241+
echo "Push failed, retrying..."
242+
243+
if [ -n "$results_file" ]; then
244+
mv $results_file ${{ github.workspace }}/temp_$(basename $results_file)
245+
246+
git reset --hard origin/benchmark-results
247+
git pull origin benchmark-results
248+
249+
new_file="results/$(basename "$results_file")"
250+
mv ${{ github.workspace }}/temp_$(basename $results_file) $new_file
251+
fi
252+
253+
echo "Regenerating data.json"
254+
(cd ${{ github.workspace }} && ${{ github.workspace }}/sc/devops/scripts/benchmarks/main.py ~/ur_bench_workdir --dry-run --results-dir ${{ github.workspace }}/results-repo --output-html remote)
264255
265-
- name: Get information about platform
266-
if: ${{ always() }}
267-
working-directory: ${{ github.workspace }}/ur-repo/
268-
run: .github/scripts/get_system_info.sh
256+
done

.github/workflows/benchmarks.yml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ on:
1111
options:
1212
- level_zero
1313
- level_zero_v2
14-
unit:
15-
description: Test unit (cpu/gpu)
14+
preset:
15+
description: Preset
1616
type: choice
1717
required: true
18-
default: 'gpu'
18+
default: 'Minimal'
1919
options:
20-
- cpu
21-
- gpu
20+
- Minimal
21+
- Normal
22+
- Full
2223
pr_no:
2324
description: PR number (if 0, it'll run on the main)
2425
type: number
@@ -48,14 +49,9 @@ on:
4849
type: string
4950
required: false
5051
default: ''
51-
upload_report:
52-
description: 'Upload HTML report'
53-
type: boolean
54-
required: false
55-
default: false
5652

5753
permissions:
58-
contents: read
54+
contents: write
5955
pull-requests: write
6056

6157
jobs:
@@ -64,11 +60,10 @@ jobs:
6460
uses: ./.github/workflows/benchmarks-reusable.yml
6561
with:
6662
str_name: ${{ inputs.str_name }}
67-
unit: ${{ inputs.unit }}
6863
pr_no: ${{ inputs.pr_no }}
6964
bench_script_params: ${{ inputs.bench_script_params }}
7065
sycl_config_params: ${{ inputs.sycl_config_params }}
7166
sycl_repo: ${{ inputs.sycl_repo }}
7267
sycl_commit: ${{ inputs.sycl_commit }}
7368
compute_runtime_commit: ${{ inputs.compute_runtime_commit }}
74-
upload_report: ${{ inputs.upload_report }}
69+
preset: ${{ inputs.preset }}

.github/workflows/docs.yml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,26 @@ jobs:
5050
mkdir -p ${{ github.workspace }}/ur-repo/
5151
mkdir -p ${{github.workspace}}/docs/html
5252
53-
- name: Download benchmark HTML
54-
id: download-bench-html
55-
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
53+
- name: Checkout benchmark scripts
54+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
5655
with:
57-
path: ur-repo/benchmark_results.html
58-
key: benchmark-results-
56+
repository: intel/llvm
57+
ref: unify-benchmark-ci
58+
path: sc
59+
sparse-checkout: |
60+
devops/scripts/benchmarks
61+
62+
- name: Move benchmark HTML files
63+
run: |
64+
mkdir -p ${{ github.workspace }}/docs/html/performance
65+
mv ${{ github.workspace }}/sc/devops/scripts/benchmarks/html/* ${{ github.workspace }}/docs/html/performance/
5966
60-
- name: Move benchmark HTML
61-
# exact or partial cache hit
62-
if: steps.download-bench-html.outputs.cache-hit != ''
67+
- name: Replace config.js
6368
run: |
64-
mv ${{ github.workspace }}/ur-repo/benchmark_results.html ${{ github.workspace }}/docs/html/
69+
cat << 'EOF' > ${{ github.workspace }}/docs/html/performance/config.js
70+
remoteDataUrl = 'https://raw.githubusercontent.com/oneapi-src/unified-runtime/refs/heads/benchmark-results/data.json';
71+
defaultCompareNames = ["Baseline_PVC_L0", "Baseline_PVC_L0v2"];
72+
EOF
6573
6674
- name: Upload artifact
6775
uses: actions/upload-pages-artifact@0252fc4ba7626f0298f0cf00902a25c6afc77fa8 # v3.0.0

0 commit comments

Comments
 (0)