Skip to content

Commit 7722ff9

Browse files
authored
[CI] Add automation for GPU driver version update (#5965)
Added a workflow that updates the GPU driver version in the `dependecies.json`. It creates the PR with the new version for Linux once per week. The workflow updates Linux staging version by committing `dependecies.json` file changes directly to the `sycl` branch.
1 parent a525995 commit 7722ff9

File tree

2 files changed

+111
-0
lines changed

2 files changed

+111
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Update GPU driver
2+
3+
on:
4+
schedule:
5+
- cron: '0 3 * * 2'
6+
workflow_dispatch:
7+
8+
jobs:
9+
update_driver_linux:
10+
runs-on: ubuntu-latest
11+
if: github.repository == 'intel/llvm'
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Update dependencies file
15+
run: |
16+
version="$(python3 devops/scripts/update_drivers.py linux)"
17+
echo 'NEW_DRIVER_VERSION='$version >> $GITHUB_ENV
18+
- name: Create Pull Request
19+
env:
20+
BRANCH: ci/update_gpu_driver-linux-${{ env.NEW_DRIVER_VERSION }}
21+
LLVMBOT_TOKEN: ${{ secrets.LLVM_MAIN_SYNC_BBSYCL_TOKEN }}
22+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: |
24+
cd $GITHUB_WORKSPACE
25+
# Set fake identity to fulfil git requirements
26+
git config --global user.name "GitHub Actions"
27+
git config --global user.email "actions@github.com"
28+
git checkout -B $BRANCH
29+
git add -u
30+
git commit -m "[GHA] Uplift GPU RT version for Linux CI" || exit 0 # exit if commit is empty
31+
git push https://$LLVMBOT_TOKEN@github.com/${{ github.repository }} ${BRANCH}
32+
gh pr create --title "[GHA] Uplift GPU RT version for Linux CI" --body "Uplift GPU RT version for Linux to $NEW_DRIVER_VERSION" --assignee @intel/dpcpp-devops-reviewers
33+
34+
update_driver_linux_staging:
35+
runs-on: ubuntu-latest
36+
if: github.repository == 'intel/llvm'
37+
steps:
38+
- uses: actions/checkout@v2
39+
- name: Update dependencies file
40+
run: |
41+
version="$(python3 devops/scripts/update_drivers.py linux_staging)"
42+
echo 'NEW_DRIVER_VERSION='$version >> $GITHUB_ENV
43+
- name: Update sycl Branch
44+
env:
45+
LLVMBOT_TOKEN: ${{ secrets.LLVM_MAIN_SYNC_BBSYCL_TOKEN }}
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
run: |
48+
cd $GITHUB_WORKSPACE
49+
# Set fake identity to fulfil git requirements
50+
git config --global user.name "GitHub Actions"
51+
git config --global user.email "actions@github.com"
52+
git checkout sycl
53+
git add -u
54+
git commit -m "[GHA] Uplift GPU RT version for Nightly runs" || exit 0
55+
git push origin sycl

devops/scripts/update_drivers.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
from urllib.request import urlopen
2+
import json
3+
import sys
4+
import os
5+
import re
6+
7+
8+
def get_latest_release(repo):
9+
releases = urlopen("https://api.github.com/repos/" + repo + "/releases").read()
10+
return json.loads(releases)[0]
11+
12+
13+
def uplift_linux_igfx_driver(config, platform_tag):
14+
compute_runtime = get_latest_release('intel/compute-runtime')
15+
16+
config[platform_tag]['compute_runtime']['github_tag'] = compute_runtime['tag_name']
17+
config[platform_tag]['compute_runtime']['version'] = compute_runtime['tag_name']
18+
config[platform_tag]['compute_runtime']['url'] = 'https://github.com/intel/compute-runtime/releases/tag/' + compute_runtime['tag_name']
19+
20+
for a in compute_runtime['assets']:
21+
if a['name'].endswith('.sum'):
22+
deps = str(urlopen(a['browser_download_url']).read())
23+
m = re.search(r"intel-igc-core_([0-9\.]*)_amd64", deps)
24+
if m is not None:
25+
ver = m.group(1)
26+
config[platform_tag]['igc']['github_tag'] = 'igc-' + ver
27+
config[platform_tag]['igc']['version'] = ver
28+
config[platform_tag]['igc']['url'] = 'https://github.com/intel/intel-graphics-compiler/releases/tag/igc-' + ver
29+
break
30+
31+
cm = get_latest_release('intel/cm-compiler')
32+
config[platform_tag]['cm']['github_tag'] = cm['tag_name']
33+
config[platform_tag]['cm']['version'] = cm['tag_name'].replace('cmclang-', '')
34+
config[platform_tag]['cm']['url'] = 'https://github.com/intel/cm-compiler/releases/tag/' + cm['tag_name']
35+
36+
return config
37+
38+
39+
def main(platform_tag):
40+
script = os.path.dirname(os.path.realpath(__file__))
41+
config_name = os.path.join(script, '..', 'dependencies.json')
42+
config = {}
43+
44+
with open(config_name, "r") as f:
45+
config = json.loads(f.read())
46+
config = uplift_linux_igfx_driver(config, platform_tag)
47+
48+
with open(config_name, "w") as f:
49+
json.dump(config, f, indent=2)
50+
51+
return config[platform_tag]['compute_runtime']['version']
52+
53+
54+
if __name__ == '__main__':
55+
platform_tag = sys.argv[1] if len(sys.argv) > 1 else 'linux_staging'
56+
sys.stdout.write(main(platform_tag) + '\n')

0 commit comments

Comments
 (0)