1- name : Compute Benchmarks
1+ name : Benchmarks Reusable
22
33on :
4- # Can be triggered via manual "dispatch" (from workflow view in GitHub Actions tab)
5- workflow_dispatch :
6- # acceptable input for adapter-specific runs
4+ workflow_call :
75 inputs :
86 str_name :
9- description : Formatted adapter name
10- type : choice
117 required : true
12- default : ' level_zero'
13- options :
14- - level_zero
15- - level_zero_v2
8+ type : string
169 unit :
17- description : Test unit (cpu/gpu)
18- type : choice
1910 required : true
20- default : ' gpu'
21- options :
22- - cpu
23- - gpu
11+ type : string
2412 pr_no :
25- description : PR number (if 0, it'll run on the main)
26- type : number
2713 required : true
28- bench_script_params :
29- description : Parameters passed to script executing benchmark
14+ # even though this is a number, this is a workaround for issues with
15+ # reusable workflow calls that result in "Unexpected value '0'" error.
3016 type : string
17+ bench_script_params :
3118 required : false
19+ type : string
3220 default : ' '
3321 sycl_config_params :
34- description : Extra params for SYCL configuration
35- type : string
3622 required : false
23+ type : string
3724 default : ' '
3825 sycl_repo :
39- description : ' Compiler repo'
40- type : string
4126 required : true
27+ type : string
4228 default : ' intel/llvm'
4329 sycl_commit :
44- description : ' Compiler commit'
45- type : string
4630 required : false
31+ type : string
4732 default : ' '
33+ upload_report :
34+ required : false
35+ type : boolean
36+ default : false
4837
4938permissions :
5039 contents : read
@@ -56,19 +45,17 @@ jobs:
5645 strategy :
5746 matrix :
5847 adapter : [
59- {str_name: "${{inputs.str_name}}",
60- sycl_config : " ${{inputs.sycl_config_params}}" ,
61- unit : " ${{inputs.unit}}"
48+ {str_name: "${{ inputs.str_name }}",
49+ sycl_config : " ${{ inputs.sycl_config_params }}" ,
50+ unit : " ${{ inputs.unit }}"
6251 }
6352 ]
6453 build_type : [Release]
6554 compiler : [{c: clang, cxx: clang++}]
6655
67- runs-on : " ${{inputs.str_name}}_PERF"
56+ runs-on : " ${{ inputs.str_name }}_PERF"
6857
6958 steps :
70- # Workspace on self-hosted runners is not cleaned automatically.
71- # We have to delete the files created outside of using actions.
7259 - name : Cleanup self-hosted workspace
7360 if : always()
7461 run : |
9986 path : ur-repo
10087
10188 - name : Install pip packages
102- run : pip install -r ${{github.workspace}}/ur-repo/third_party/requirements.txt
89+ run : |
90+ pip install --force-reinstall -r ${{github.workspace}}/ur-repo/third_party/benchmark_requirements.txt
10391
10492 # We need to fetch special ref for proper PR's merge commit. Note, this ref may be absent if the PR is already merged.
10593 - name : Fetch PR's merge commit
@@ -169,13 +157,15 @@ jobs:
169157 run : cmake --install ${{github.workspace}}/ur_build
170158
171159 - name : Run benchmarks
160+ working-directory : ${{ github.workspace }}/ur-repo/
172161 id : benchmarks
173162 run : >
174- numactl -N 0 ${{ github.workspace }}/ur-repo/scripts/benchmarks/main.py
175- ~/bench_workdir
176- ${{github.workspace}}/sycl_build
177- ${{github.workspace}}/ur_install
178- ${{ matrix.adapter.str_name }}
163+ numactl -N 0 ${{ github.workspace }}/ur-repo/scripts/benchmarks/main.py
164+ ~/bench_workdir
165+ --sycl ${{ github.workspace }}/sycl_build
166+ --ur ${{ github.workspace }}/ur_install
167+ --adapter ${{ matrix.adapter.str_name }}
168+ ${{ inputs.upload_report && '--output-html' || '' }}
179169 ${{ inputs.bench_script_params }}
180170
181171 - name : Add comment to PR
@@ -186,7 +176,7 @@ jobs:
186176 let markdown = ""
187177 try {
188178 const fs = require('fs');
189- markdown = fs.readFileSync('benchmark_results.md', 'utf8');
179+ markdown = fs.readFileSync('ur-repo/ benchmark_results.md', 'utf8');
190180 } catch(err) {
191181 }
192182
@@ -204,3 +194,10 @@ jobs:
204194 repo: context.repo.repo,
205195 body: body
206196 })
197+
198+ - name : Upload HTML report
199+ if : ${{ always() && inputs.upload_report }}
200+ uses : actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
201+ with :
202+ path : ur-repo/benchmark_results.html
203+ key : benchmark-results-${{ matrix.adapter.str_name }}-${{ github.run_id }}
0 commit comments