Skip to content

Commit 901e54a

Browse files
authored
Merge branch 'main' into cuda-malloc-managed-optimize
2 parents e18cf57 + 12d3748 commit 901e54a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+2359
-326
lines changed

.github/workflows/benchmarks_core.yml renamed to .github/workflows/benchmarks_compute.yml

Lines changed: 45 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,60 @@
11
name: Compute Benchmarks
22

33
on:
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

3838
permissions:
3939
contents: read
4040
pull-requests: write
4141

4242
jobs:
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

.github/workflows/benchmarks_level_zero.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/cmake.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ concurrency:
88

99
permissions:
1010
contents: read
11+
pull-requests: write
1112

1213
jobs:
1314
ubuntu-build:
@@ -230,6 +231,9 @@ jobs:
230231
adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'}
231232
- adapter: {name: L0, var: '-DUR_BUILD_ADAPTER_L0=ON'}
232233
compiler: {c: clang-cl, cxx: clang-cl}
234+
# TODO: testing is flaky on windows-2022 in Release mode
235+
- os: 'windows-2022'
236+
build_type: Release
233237

234238
build_type: [Debug, Release]
235239
compiler: [{c: cl, cxx: cl}, {c: clang-cl, cxx: clang-cl}]

.github/workflows/e2e_core.yml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ on:
4949

5050
permissions:
5151
contents: read
52+
pull-requests: write
5253

5354
jobs:
5455
changed-files:
@@ -177,20 +178,23 @@ jobs:
177178
id: tests
178179
run: ninja -C build-e2e check-sycl-e2e
179180

180-
- name: Add comment to PR
181-
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
182-
if: ${{ always() }}
183-
with:
184-
script: |
185-
const adapter = '${{ matrix.adapter.name }}';
186-
const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
187-
const test_status = '${{ steps.tests.outcome }}';
188-
const job_status = '${{ job.status }}';
189-
const body = `E2E ${adapter} build:\n${url}\nJob status: ${job_status}. Test status: ${test_status}`;
190-
191-
github.rest.issues.createComment({
192-
issue_number: context.issue.number,
193-
owner: context.repo.owner,
194-
repo: context.repo.repo,
195-
body: body
196-
})
181+
# FIXME: Requires pull-request: write permissions but this is only granted
182+
# on pull requests from forks if using pull_request_target workflow
183+
# trigger but not the pull_request trigger..
184+
# - name: Add comment to PR
185+
# uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
186+
# if: ${{ always() }}
187+
# with:
188+
# script: |
189+
# const adapter = '${{ matrix.adapter.name }}';
190+
# const url = '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}';
191+
# const test_status = '${{ steps.tests.outcome }}';
192+
# const job_status = '${{ job.status }}';
193+
# const body = `E2E ${adapter} build:\n${url}\nJob status: ${job_status}. Test status: ${test_status}`;
194+
195+
# github.rest.issues.createComment({
196+
# issue_number: context.issue.number,
197+
# owner: context.repo.owner,
198+
# repo: context.repo.repo,
199+
# body: body
200+
# })

cmake/FindCUDACupti.cmake

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright (C) 2024 Intel Corporation
2+
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
3+
# See LICENSE.TXT
4+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5+
6+
# This is lifted from intel-llvm's FindCUDACupti implementation
7+
# https://github.com/intel/llvm/blob/0cd04144d9ca83371c212e8e4709a59c968291b9/sycl/cmake/modules/FindCUDACupti.cmake
8+
9+
macro(find_cuda_cupti_library)
10+
find_library(CUDA_cupti_LIBRARY
11+
NAMES cupti
12+
HINTS ${CUDA_TOOLKIT_ROOT_DIR}
13+
ENV CUDA_PATH
14+
PATH_SUFFIXES nvidia/current lib64 lib/x64 lib
15+
../extras/CUPTI/lib64/
16+
../extras/CUPTI/lib/
17+
)
18+
endmacro()
19+
20+
macro(find_cuda_cupti_include_dir)
21+
find_path(CUDA_CUPTI_INCLUDE_DIR cupti.h PATHS
22+
"${CUDA_TOOLKIT_ROOT_DIR}/extras/CUPTI/include"
23+
"${CUDA_INCLUDE_DIRS}/../extras/CUPTI/include"
24+
"${CUDA_INCLUDE_DIRS}"
25+
NO_DEFAULT_PATH)
26+
endmacro()

0 commit comments

Comments
 (0)