Skip to content

Commit d52046c

Browse files
authored
Merge pull request #2408 from IntelPython/chron-job-to-update-os-compiler-dependencies
[MAINT] Add chron job for updating OS compiler dependencies
2 parents 7685f44 + a491436 commit d52046c

3 files changed

Lines changed: 179 additions & 18 deletions

File tree

‎.github/sycl-build-deps.env‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Open source SYCL build deps, loaded by os-llvm-sycl-build.yml and bumped by
2+
# bump-sycl-deps.yml from intel/llvm devops/dependencies.json.
3+
# Kept out of .github/workflows/ since GITHUB_TOKEN can't push workflow files.
4+
DRIVER_PATH=2026-WW28
5+
OCLCPUEXP_FN=oclcpuexp-2026.22.6.1.17_160000_rel.tar.gz
6+
TBB_URL=https://github.com/uxlfoundation/oneTBB/releases/download/v2023.1.0/
7+
TBB_INSTALL_DIR=oneapi-tbb-2023.1.0
8+
TBB_FN=oneapi-tbb-2023.1.0-lin.tgz
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
name: Bump open source SYCL build deps
2+
3+
# Syncs the oclcpuexp and oneTBB pins in .github/sycl-build-deps.env, used by
4+
# os-llvm-sycl-build.yml, with intel/llvm devops/dependencies.json.
5+
6+
on:
7+
schedule:
8+
- cron: "0 6 * * 6"
9+
workflow_dispatch:
10+
inputs:
11+
llvm-ref:
12+
description: "intel/llvm branch, tag or commit to read dependencies.json from"
13+
required: false
14+
default: sycl
15+
16+
permissions:
17+
contents: read
18+
19+
concurrency:
20+
group: ${{ github.workflow }}-${{ github.ref }}
21+
cancel-in-progress: true
22+
23+
jobs:
24+
bump:
25+
name: Bump oclcpuexp and oneTBB pins
26+
# disable scheduled workflow to be run in forks
27+
if: github.event_name != 'schedule' || github.repository == 'IntelPython/dpctl'
28+
29+
runs-on: ubuntu-latest
30+
timeout-minutes: 15
31+
32+
permissions:
33+
# push the branch with the updated pins
34+
contents: write
35+
# open a pull request from that branch
36+
pull-requests: write
37+
38+
env:
39+
PINS: .github/sycl-build-deps.env
40+
GH_TOKEN: ${{ github.token }}
41+
42+
steps:
43+
- name: Checkout repo
44+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
45+
with:
46+
persist-credentials: false
47+
48+
- name: Read intel/llvm dependencies.json
49+
id: resolve
50+
env:
51+
LLVM_REF: ${{ inputs.llvm-ref || 'sycl' }}
52+
run: |
53+
set -euo pipefail
54+
fail() { echo "::error::$*"; exit 1; }
55+
56+
[[ "${LLVM_REF}" =~ ^[A-Za-z0-9._/-]+$ && "${LLVM_REF}" != *..* ]] \
57+
|| fail "invalid intel/llvm ref: ${LLVM_REF}"
58+
LLVM_SHA=$(gh api "repos/intel/llvm/commits/${LLVM_REF}" --jq .sha)
59+
[[ "${LLVM_SHA}" =~ ^[0-9a-f]{40}$ ]] || fail "unexpected intel/llvm sha: ${LLVM_SHA}"
60+
DEPS="${RUNNER_TEMP}/dependencies.json"
61+
gh api -H "Accept: application/vnd.github.raw" \
62+
"repos/intel/llvm/contents/devops/dependencies.json?ref=${LLVM_SHA}" > "${DEPS}"
63+
64+
OCL_TAG=$(jq -er '.linux.oclcpu.github_tag' "${DEPS}")
65+
OCL_URL=$(jq -er '.linux.oclcpu.url' "${DEPS}")
66+
TBB_VER=$(jq -er '.linux.tbb.version' "${DEPS}")
67+
TBB_FULL_URL=$(jq -er '.linux.tbb.url' "${DEPS}")
68+
OCLCPUEXP_FN=${OCL_URL##*/}
69+
70+
# os-llvm-sycl-build.yml rebuilds these URLs from the pins
71+
[[ "${OCL_TAG}" =~ ^[0-9]{4}-WW[0-9]+$ ]] || fail "unexpected oclcpu tag: ${OCL_TAG}"
72+
[[ "${OCLCPUEXP_FN}" =~ ^oclcpuexp-[0-9A-Za-z._]+_rel\.tar\.gz$ ]] \
73+
|| fail "unexpected oclcpu asset: ${OCLCPUEXP_FN}"
74+
[[ "${OCL_URL}" == "https://github.com/intel/llvm/releases/download/${OCL_TAG}/${OCLCPUEXP_FN}" ]] \
75+
|| fail "unexpected oclcpu url: ${OCL_URL}"
76+
[[ "${TBB_VER}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || fail "unexpected tbb version: ${TBB_VER}"
77+
[[ "${TBB_FULL_URL}" == "https://github.com/uxlfoundation/oneTBB/releases/download/v${TBB_VER}/oneapi-tbb-${TBB_VER}-lin.tgz" ]] \
78+
|| fail "unexpected tbb url: ${TBB_FULL_URL}"
79+
80+
{
81+
echo "llvm_sha=${LLVM_SHA}"
82+
echo "driver_tag=${OCL_TAG}"
83+
echo "oclcpuexp_fn=${OCLCPUEXP_FN}"
84+
echo "tbb_ver=${TBB_VER}"
85+
echo "tbb_url=${TBB_FULL_URL%/*}/"
86+
echo "tbb_fn=${TBB_FULL_URL##*/}"
87+
echo "tbb_dir=oneapi-tbb-${TBB_VER}"
88+
} | tee -a "${GITHUB_OUTPUT}"
89+
90+
- name: Apply pins
91+
env:
92+
DRIVER_TAG: ${{ steps.resolve.outputs.driver_tag }}
93+
OCLCPUEXP_FN: ${{ steps.resolve.outputs.oclcpuexp_fn }}
94+
TBB_URL: ${{ steps.resolve.outputs.tbb_url }}
95+
TBB_FN: ${{ steps.resolve.outputs.tbb_fn }}
96+
TBB_DIR: ${{ steps.resolve.outputs.tbb_dir }}
97+
run: |
98+
set -euo pipefail
99+
sed -i -E \
100+
-e "s|^(DRIVER_PATH=).*|\1${DRIVER_TAG}|" \
101+
-e "s|^(OCLCPUEXP_FN=).*|\1${OCLCPUEXP_FN}|" \
102+
-e "s|^(TBB_URL=).*|\1${TBB_URL}|" \
103+
-e "s|^(TBB_INSTALL_DIR=).*|\1${TBB_DIR}|" \
104+
-e "s|^(TBB_FN=).*|\1${TBB_FN}|" \
105+
"${PINS}"
106+
git diff -- "${PINS}"
107+
108+
- name: Create pull request
109+
uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1
110+
with:
111+
token: ${{ github.token }}
112+
add-paths: ${{ env.PINS }}
113+
branch: bot/bump-sycl-build-deps
114+
delete-branch: true
115+
labels: autoupdate
116+
commit-message: |
117+
Bump oclcpuexp/oneTBB pins for os-llvm-sycl-build workflow
118+
119+
oclcpuexp: ${{ steps.resolve.outputs.driver_tag }} / ${{ steps.resolve.outputs.oclcpuexp_fn }}
120+
oneTBB: ${{ steps.resolve.outputs.tbb_ver }}
121+
intel/llvm: ${{ steps.resolve.outputs.llvm_sha }}
122+
title: "Bump open source SYCL build dependencies"
123+
body: |
124+
Syncs `.github/sycl-build-deps.env` with intel/llvm
125+
[`devops/dependencies.json`](https://github.com/intel/llvm/blob/${{ steps.resolve.outputs.llvm_sha }}/devops/dependencies.json).
126+
127+
| dependency | version |
128+
| --- | --- |
129+
| intel/llvm driver release | `${{ steps.resolve.outputs.driver_tag }}` |
130+
| oclcpuexp | `${{ steps.resolve.outputs.oclcpuexp_fn }}` |
131+
| oneTBB | `${{ steps.resolve.outputs.tbb_ver }}` |
132+
133+
Pull requests opened by this workflow don't trigger CI: run
134+
**Build with Open Source LLVM SYCL compiler** on this branch before merging.

‎.github/workflows/os-llvm-sycl-build.yml‎

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
pull_request:
44
push:
55
branches: [master]
6+
workflow_dispatch:
67

78
permissions:
89
contents: read
@@ -17,18 +18,33 @@ jobs:
1718

1819
env:
1920
DOWNLOAD_URL_PREFIX: https://github.com/intel/llvm/releases/download
20-
DRIVER_PATH: 2026-WW28
21-
OCLCPUEXP_FN: oclcpuexp-2026.22.6.1.17_160000_rel.tar.gz
22-
TBB_URL: https://github.com/uxlfoundation/oneTBB/releases/download/v2023.1.0/
23-
TBB_INSTALL_DIR: oneapi-tbb-2023.1.0
24-
TBB_FN: oneapi-tbb-2023.1.0-lin.tgz
2521

2622
steps:
2723
- name: Cancel Previous Runs
2824
uses: styfle/cancel-workflow-action@d07a454dad7609a92316b57b23c9ccfd4f59af66 # 0.13.1
2925
with:
3026
access_token: ${{ github.token }}
3127

28+
- name: Checkout repo
29+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
30+
with:
31+
persist-credentials: false
32+
fetch-depth: 0
33+
34+
- name: Load pinned SYCL build deps
35+
shell: bash -l {0}
36+
env:
37+
PINS: .github/sycl-build-deps.env
38+
run: |
39+
set -euo pipefail
40+
VARS=$(grep -E '^(DRIVER_PATH|OCLCPUEXP_FN|TBB_URL|TBB_INSTALL_DIR|TBB_FN)=' "${PINS}" || true)
41+
if [[ $(wc -l <<< "${VARS}") -ne 5 ]]; then
42+
echo "::error::expected 5 pins in ${PINS}, got:"
43+
echo "${VARS}"
44+
exit 1
45+
fi
46+
echo "${VARS}" | tee -a "${GITHUB_ENV}"
47+
3248
- name: Install hwloc
3349
shell: bash -l {0}
3450
run: |
@@ -45,7 +61,7 @@ jobs:
4561
with:
4662
path: |
4763
/home/runner/work/sycl_bundle
48-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/sycl_bundle/bundle_id.txt') }}
64+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('.github/sycl-build-deps.env') }}
4965
restore-keys: |
5066
${{ runner.os }}-build-${{ env.cache-name }}-
5167
${{ runner.os }}-build-
@@ -106,17 +122,26 @@ jobs:
106122
else
107123
rm -rf bundle_id.txt
108124
fi
109-
[ -f "${OCLCPUEXP_FN}" ] || wget "${DOWNLOAD_URL_PREFIX}/${DRIVER_PATH}/${OCLCPUEXP_FN}" || rm -rf bundle_id.txt
110-
[ -f "${TBB_FN}" ] || wget "${TBB_URL}/${TBB_FN}" || rm -rf bundle_id.txt
111125
rm -rf dpcpp_compiler
112126
mkdir -p dpcpp_compiler
113127
tar xf "${ARTIFACT_NAME}.tar.gz" -C dpcpp_compiler
114-
mkdir -p oclcpuexp
115-
[ -d oclcpuexp/x64 ] || tar xf "${OCLCPUEXP_FN}" -C oclcpuexp
116-
[ -d "${TBB_INSTALL_DIR}/lib" ] || tar xf "${TBB_FN}"
117-
cp oclcpuexp/x64/libOpenCL.so* dpcpp_compiler/lib/
118128
fi
119129
130+
# pinned deps are fetched independently of the nightly, so a pin
131+
# change replaces whatever the cache restored
132+
if [ ! -f "${OCLCPUEXP_FN}" ]; then
133+
rm -rf oclcpuexp oclcpuexp-*.tar.gz
134+
wget "${DOWNLOAD_URL_PREFIX}/${DRIVER_PATH}/${OCLCPUEXP_FN}" || exit 1
135+
fi
136+
if [ ! -f "${TBB_FN}" ]; then
137+
rm -rf oneapi-tbb-*
138+
wget "${TBB_URL}/${TBB_FN}" || exit 1
139+
fi
140+
mkdir -p oclcpuexp
141+
[ -d oclcpuexp/x64 ] || tar xf "${OCLCPUEXP_FN}" -C oclcpuexp
142+
[ -d "${TBB_INSTALL_DIR}/lib" ] || tar xf "${TBB_FN}"
143+
cp oclcpuexp/x64/libOpenCL.so* dpcpp_compiler/lib/
144+
120145
- name: Setup Python
121146
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
122147
with:
@@ -128,12 +153,6 @@ jobs:
128153
run: |
129154
pip install numpy cython setuptools"<80" pytest scikit-build cmake ninja versioneer[toml]==0.29
130155
131-
- name: Checkout repo
132-
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
133-
with:
134-
persist-credentials: false
135-
fetch-depth: 0
136-
137156
- name: Create set_allvars.sh
138157
shell: bash -l {0}
139158
run: |

0 commit comments

Comments
 (0)