Skip to content

Commit

Permalink
[CI] Factor out igc dev related code
Browse files Browse the repository at this point in the history
To avoid uncessary inteaction with other docker images
  • Loading branch information
jsji committed Apr 16, 2024
1 parent 06bd6bc commit 7cabfb0
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 36 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/sycl-containers-igc-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: IGC DEV CI Containers
on:
workflow_dispatch:
push:
branches:
- sycl
paths:
- 'devops/dependencies-igc-dev.json'
- '.github/workflows/sycl-containers-igc-dev.yaml'
pull_request:
paths:
- 'devops/dependencies-igc-dev.json'
- '.github/workflows/sycl-containers-igc-dev.yaml'

permissions: read-all

jobs:
build_and_push_images:
if: github.repository == 'intel/llvm'
name: Build and Push IGC Dev Docker Images
runs-on: ubuntu-22.04
permissions:
packages: write
strategy:
matrix:
include:
- name: Intel Drivers Ubuntu 22.04 Docker image with dev IGC
dockerfile: ubuntu2204_intel_drivers_igc_dev
imagefile: ubuntu2204_intel_drivers
tag: devigc
build_args: |
"use_latest=false"
"use_igc_dev=true"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Build and Push Container
uses: ./devops/actions/build_container
with:
push: ${{ github.event_name != 'pull_request' }}
file: ${{ matrix.dockerfile }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.imagefile }}:${{ matrix.tag }}-${{ github.sha }}
ghcr.io/${{ github.repository }}/${{ matrix.imagefile }}:${{ matrix.tag }}
build-args: ${{ matrix.build_args }}

6 changes: 0 additions & 6 deletions .github/workflows/sycl-containers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ jobs:
file: ubuntu2204_intel_drivers
tag: latest
build_args: "use_latest=false"
- name: Intel Drivers Ubuntu 22.04 Docker image with dev IGC
file: ubuntu2204_intel_drivers
tag: devigc
build_args: |
"use_latest=false"
"use_igc_dev=true"
- name: Intel Drivers (unstable) Ubuntu 22.04 Docker image
file: ubuntu2204_intel_drivers
tag: unstable
Expand Down
7 changes: 1 addition & 6 deletions devops/containers/ubuntu2204_intel_drivers.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ FROM $base_image:$base_tag
ENV DEBIAN_FRONTEND=noninteractive

ARG use_latest=true
ARG use_igc_dev=false

RUN apt update && apt install -yqq wget \
&& if [ "$use_igc_dev" = "true" ]; then apt-get install -yqq libllvm14; fi
RUN apt update && apt install -yqq wget

COPY scripts/get_release.py /
COPY scripts/install_drivers.sh /
Expand All @@ -22,9 +20,6 @@ RUN --mount=type=secret,id=github_token \
install_driver_opt=" --use-latest"; \
else \
install_driver_opt=" dependencies.json"; \
if [ "$use_igc_dev" = "true" ]; then \
install_driver_opt="$install_driver_opt --use-dev-igc"; \
fi; \
fi && \
GITHUB_TOKEN=$(cat /run/secrets/github_token) /install_drivers.sh $install_driver_opt --all

Expand Down
24 changes: 24 additions & 0 deletions devops/containers/ubuntu2204_intel_drivers_igc_dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
ARG base_tag=latest
ARG base_image=ghcr.io/intel/llvm/ubuntu2204_base

FROM $base_image:$base_tag

ENV DEBIAN_FRONTEND=noninteractive

RUN apt update && apt install -yqq libllvm14

COPY scripts/get_release.py /
COPY scripts/install_drivers.sh /
COPY dependencies.json /
COPY dependencies-igc-dev.json /

RUN mkdir /runtimes
ENV INSTALL_LOCATION=/runtimes
RUN --mount=type=secret,id=github_token \
install_driver_opt="dependencies.json dependencies-igc-dev.json --use-dev-igc"; \
GITHUB_TOKEN=$(cat /run/secrets/github_token) /install_drivers.sh $install_driver_opt --all

COPY scripts/drivers_entrypoint.sh /drivers_entrypoint.sh

ENTRYPOINT ["/bin/bash", "/drivers_entrypoint.sh"]

9 changes: 9 additions & 0 deletions devops/dependencies-igc-dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"igc_dev": {
"github_tag": "igc-dev-db4de5f",
"version": "db4de5f",
"updated_at": "2024-04-12T11:06:26Z",
"url": "https://api.github.com/repos/intel/intel-graphics-compiler/actions/artifacts/1409219375/zip",
"root": "{DEPS_ROOT}/opencl/runtime/linux/oclgpu"
}
}
7 changes: 0 additions & 7 deletions devops/dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
"url": "https://github.com/intel/intel-graphics-compiler/releases/tag/igc-1.0.15985.7",
"root": "{DEPS_ROOT}/opencl/runtime/linux/oclgpu"
},
"igc_dev": {
"github_tag": "igc-dev-db4de5f",
"version": "db4de5f",
"updated_at": "2024-04-12T11:06:26Z",
"url": "https://api.github.com/repos/intel/intel-graphics-compiler/actions/artifacts/1409219375/zip",
"root": "{DEPS_ROOT}/opencl/runtime/linux/oclgpu"
},
"cm": {
"github_tag": "cmclang-1.0.144",
"version": "1.0.144",
Expand Down
11 changes: 8 additions & 3 deletions devops/scripts/install_drivers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ if [ -f "$1" ]; then
CONFIG_FILE=$1
CR_TAG=$(jq -r '.linux.compute_runtime.github_tag' $CONFIG_FILE)
IGC_TAG=$(jq -r '.linux.igc.github_tag' $CONFIG_FILE)
IGC_DEV_TAG=$(jq -r '.linux.igc_dev.github_tag' $CONFIG_FILE)
IGC_DEV_VER=$(jq -r '.linux.igc_dev.version' $CONFIG_FILE)
IGC_DEV_URL=$(jq -r '.linux.igc_dev.url' $CONFIG_FILE)
CM_TAG=$(jq -r '.linux.cm.github_tag' $CONFIG_FILE)
L0_TAG=$(jq -r '.linux.level_zero.github_tag' $CONFIG_FILE)
TBB_TAG=$(jq -r '.linux.tbb.github_tag' $CONFIG_FILE)
FPGA_TAG=$(jq -r '.linux.fpgaemu.github_tag' $CONFIG_FILE)
CPU_TAG=$(jq -r '.linux.oclcpu.github_tag' $CONFIG_FILE)
if [[ "$*" == *"--use-dev-igc"* ]]
CONFIG_FILE_IGC_DEV=$2
IGC_DEV_TAG=$(jq -r '.linux.igc_dev.github_tag' $CONFIG_FILE_IGC_DEV)
IGC_DEV_VER=$(jq -r '.linux.igc_dev.version' $CONFIG_FILE_IGC_DEV)
IGC_DEV_URL=$(jq -r '.linux.igc_dev.url' $CONFIG_FILE_IGC_DEV)
fi
elif [[ "$*" == *"--use-latest"* ]]; then
CR_TAG=latest
IGC_TAG=latest
Expand All @@ -35,6 +38,8 @@ else
TBB_TAG=$tbb_tag
FPGA_TAG=$fpgaemu_tag
CPU_TAG=$cpu_tag
if [[ "$*" == *"--use-dev-igc"* ]]
fi
fi

function get_release() {
Expand Down
40 changes: 26 additions & 14 deletions devops/scripts/update_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sys
import os
import re
import argparse


def get_latest_release(repo):
Expand All @@ -28,7 +29,19 @@ def get_artifacts_download_url(repo, name):
return json.loads(artifacts)["artifacts"][0]["archive_download_url"]


def uplift_linux_igfx_driver(config, platform_tag):
def uplift_linux_igfx_driver(config, platform_tag,igc_dev_only):

if igc_dev_only:
igc_dev = get_latest_workflow_runs("intel/intel-graphics-compiler", "build-IGC")
igcdevver = igc_dev["head_sha"][:7]
config[platform_tag]["igc_dev"]["github_tag"] = "igc-dev-" + igcdevver
config[platform_tag]["igc_dev"]["version"] = igcdevver
config[platform_tag]["igc_dev"]["updated_at"] = igc_dev["updated_at"]
config[platform_tag]["igc_dev"]["url"] = get_artifacts_download_url(
"intel/intel-graphics-compiler", "IGC_Ubuntu22.04_llvm14_clang-" + igcdevver
)
return config

compute_runtime = get_latest_release('intel/compute-runtime')

config[platform_tag]['compute_runtime']['github_tag'] = compute_runtime['tag_name']
Expand All @@ -46,15 +59,6 @@ def uplift_linux_igfx_driver(config, platform_tag):
config[platform_tag]['igc']['url'] = 'https://github.com/intel/intel-graphics-compiler/releases/tag/igc-' + ver
break

igc_dev = get_latest_workflow_runs("intel/intel-graphics-compiler", "build-IGC")
igcdevver = igc_dev["head_sha"][:7]
config[platform_tag]["igc_dev"]["github_tag"] = "igc-dev-" + igcdevver
config[platform_tag]["igc_dev"]["version"] = igcdevver
config[platform_tag]["igc_dev"]["updated_at"] = igc_dev["updated_at"]
config[platform_tag]["igc_dev"]["url"] = get_artifacts_download_url(
"intel/intel-graphics-compiler", "IGC_Ubuntu22.04_llvm14_clang-" + igcdevver
)

cm = get_latest_release('intel/cm-compiler')
config[platform_tag]['cm']['github_tag'] = cm['tag_name']
config[platform_tag]['cm']['version'] = cm['tag_name'].replace('cmclang-', '')
Expand All @@ -68,22 +72,30 @@ def uplift_linux_igfx_driver(config, platform_tag):
return config


def main(platform_tag):
def main(platform_tag, igc_dev_only):
script = os.path.dirname(os.path.realpath(__file__))
config_name = os.path.join(script, '..', 'dependencies.json')
if igc_dev_only:
config_name = os.path.join(script, '..', 'dependencies-igc-dev.json')
config = {}

with open(config_name, "r") as f:
config = json.loads(f.read())
config = uplift_linux_igfx_driver(config, platform_tag)
config = uplift_linux_igfx_driver(config, platform_tag, igc_dev_only)

with open(config_name, "w") as f:
json.dump(config, f, indent=2)
f.write('\n')

if(igc_dev_only):
return config[platform_tag]["igc_dev"]["github_tag"]

return config[platform_tag]['compute_runtime']['version']


if __name__ == '__main__':
platform_tag = sys.argv[1] if len(sys.argv) > 1 else "ERROR_PLATFORM"
sys.stdout.write(main(platform_tag) + '\n')
parser = argparse.ArgumentParser()
parser.add_argument('platform_tag')
parser.add_argument('--igc-dev-only', action='store_true')
args = parser.parse_args()
sys.stdout.write(main(args.platform_tag, args.igc_dev_only) + '\n')

0 comments on commit 7cabfb0

Please sign in to comment.