11name : Compute Benchmarks
22
33on :
4- # this workflow can by only triggered by other workflows
5- # for example by: e2e_cuda.yml or e2e_opencl.yml
6- workflow_call :
7- # acceptable input from adapter-specific workflows
4+ # Can be triggered via manual "dispatch" (from workflow view in GitHub Actions tab)
5+ workflow_dispatch :
6+ # acceptable input for adapter-specific runs
87 inputs :
9- name :
10- description : Adapter name
11- type : string
12- required : true
138 str_name :
149 description : Formatted adapter name
15- type : string
16- required : true
17- config :
18- description : Params for sycl configuration
19- type : string
10+ type : choice
2011 required : true
12+ default : ' level_zero'
13+ options :
14+ - level_zero
2115 unit :
2216 description : Test unit (cpu/gpu)
23- type : string
17+ type : choice
2418 required : true
25- runner_tag :
26- description : Tag defined for the runner
27- type : string
19+ default : ' gpu'
20+ options :
21+ - cpu
22+ - gpu
23+ pr_no :
24+ description : PR number (if 0, it'll run on the main)
25+ type : number
2826 required : true
29- trigger :
30- description : Type of workflow trigger
27+ bench_script_params :
28+ description : Parameters passed to script executing benchmark
3129 type : string
32- required : true
33- comment :
34- description : Text if triggered by a comment
30+ required : false
31+ default : ' '
32+ sycl_config_params :
33+ description : Extra params for SYCL configuration
3534 type : string
3635 required : false
36+ default : ' '
3737
3838permissions :
3939 contents : read
4040 pull-requests : write
4141
4242jobs :
4343 e2e-build-hw :
44- if : github.repository == 'oneapi-src/unified-runtime' # run only on upstream; forks will not have the HW
44+ # Run only on upstream; forks will not have the HW
45+ if : github.repository == 'oneapi-src/unified-runtime'
4546 name : Build SYCL, UR, run Compute Benchmarks
4647 strategy :
4748 matrix :
4849 adapter : [
49- {name: "${{inputs.name}}",
50- str_name : " ${{inputs.str_name}}" ,
51- config : " ${{inputs.config}}" ,
50+ {str_name: "${{inputs.str_name}}",
51+ sycl_config : " ${{inputs.sycl_config_params}}" ,
5252 unit : " ${{inputs.unit}}" }
5353 ]
5454 build_type : [Release]
5555 compiler : [{c: clang, cxx: clang++}]
5656
57- runs-on : ${{inputs.runner_tag}}
57+ runs-on : " ${{inputs.str_name}}_PERF "
5858
5959 steps :
6060 # Workspace on self-hosted runners is not cleaned automatically.
@@ -67,15 +67,17 @@ jobs:
6767
6868 - name : Add comment to PR
6969 uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
70- if : ${{ always() && inputs.trigger != 'schedule' }}
70+ if : ${{ always() && inputs.pr_no != 0 }}
7171 with :
7272 script : |
73- const adapter = '${{ matrix.adapter.name }}';
73+ const pr_no = '${{ inputs.pr_no }}';
74+ const adapter = '${{ matrix.adapter.str_name }}';
7475 const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
75- const body = `Compute Benchmarks ${adapter} run: \n${url}`;
76+ const params = '${{ inputs.bench_script_params }}';
77+ const body = `Compute Benchmarks ${adapter} run (with params: ${params}):\n${url}`;
7678
7779 github.rest.issues.createComment({
78- issue_number: context.issue.number ,
80+ issue_number: pr_no ,
7981 owner: context.repo.owner,
8082 repo: context.repo.repo,
8183 body: body
@@ -86,13 +88,12 @@ jobs:
8688 with :
8789 path : ur-repo
8890
89- # On issue_comment trigger (for PRs) we need to fetch special ref for
90- # proper PR's merge commit. Note, this ref may be absent if the PR is already merged.
91+ # We need to fetch special ref for proper PR's merge commit. Note, this ref may be absent if the PR is already merged.
9192 - name : Fetch PR's merge commit
92- if : ${{ inputs.trigger != 'schedule' }}
93+ if : ${{ inputs.pr_no != 0 }}
9394 working-directory : ${{github.workspace}}/ur-repo
9495 env :
95- PR_NO : ${{github.event.issue.number }}
96+ PR_NO : ${{ inputs.pr_no }}
9697 run : |
9798 git fetch -- https://github.com/${{github.repository}} +refs/pull/${PR_NO}/*:refs/remotes/origin/pr/${PR_NO}/*
9899 git checkout origin/pr/${PR_NO}/merge
@@ -108,7 +109,7 @@ jobs:
108109 fetch-tags : false
109110
110111 - name : Set CUDA env vars
111- if : matrix.adapter.name == 'CUDA '
112+ if : matrix.adapter.str_name == 'cuda '
112113 run : |
113114 echo "CUDA_LIB_PATH=/usr/local/cuda/lib64/stubs" >> $GITHUB_ENV
114115 echo "LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH" >> $GITHUB_ENV
@@ -119,7 +120,7 @@ jobs:
119120 -t ${{matrix.build_type}}
120121 -o ${{github.workspace}}/sycl_build
121122 --cmake-gen "Ninja"
122- --ci-defaults ${{matrix.adapter.config }}
123+ --ci-defaults ${{matrix.adapter.sycl_config }}
123124 --cmake-opt="-DLLVM_INSTALL_UTILS=ON"
124125 --cmake-opt="-DSYCL_PI_TESTS=OFF"
125126 --cmake-opt="-DSYCL_PI_UR_USE_FETCH_CONTENT=OFF"
@@ -165,17 +166,13 @@ jobs:
165166 run : |
166167 echo "ONEAPI_DEVICE_SELECTOR=${{ matrix.adapter.str_name }}:${{ matrix.adapter.unit }}" >> $GITHUB_ENV
167168
168- - name : Extract arguments from comment
169- id : args
170- run : echo "ARGS=$(echo '${{ inputs.comment }}' | sed -n 's/.*\/benchmarks-[^ ]* \(.*\)/\1/p')" >> $GITHUB_ENV
171-
172169 - name : Run SYCL API Overhead benchmark
173170 id : benchmarks
174- run : ${{github.workspace}}/ur-repo/.github/scripts/compute_benchmarks.py ${{github.workspace}}/compute-benchmarks-build/bin/ $ARGS
171+ run : ${{ github.workspace }}/ur-repo/.github/scripts/compute_benchmarks.py ${{ github.workspace }}/compute-benchmarks-build/bin/ ${{ inputs.bench_script_params }}
175172
176173 - name : Add comment to PR
177174 uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
178- if : ${{ always() && inputs.trigger != 'schedule' }}
175+ if : ${{ always() && inputs.pr_no != 0 }}
179176 with :
180177 script : |
181178 let markdown = ""
@@ -185,14 +182,16 @@ jobs:
185182 } catch(err) {
186183 }
187184
188- const adapter = '${{ matrix.adapter.name }}';
185+ const pr_no = '${{ inputs.pr_no }}';
186+ const adapter = '${{ matrix.adapter.str_name }}';
189187 const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
190188 const test_status = '${{ steps.benchmarks.outcome }}';
191189 const job_status = '${{ job.status }}';
192- const body = `Compute Benchmarks ${adapter} run:\n${url}\nJob status: ${job_status}. Test status: ${test_status}.\n ${markdown}`;
190+ const params = '${{ inputs.bench_script_params }}';
191+ const body = `Compute Benchmarks ${adapter} run (with params: ${params}):\n${url}\nJob status: ${job_status}. Test status: ${test_status}.\n ${markdown}`;
193192
194193 github.rest.issues.createComment({
195- issue_number: context.issue.number ,
194+ issue_number: pr_no ,
196195 owner: context.repo.owner,
197196 repo: context.repo.repo,
198197 body: body
0 commit comments