Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: Reuse previous workflow's artefacts #629

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 28 additions & 11 deletions .github/actions/do_build_dpcpp/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ description: build dpc++
inputs:
target:
description: 'target architecture'
create_dpcpp_artefact_method:
description: 'build | download_release' # TODO: add support for 'previous workflow' download
download_dpcpp_artefact:
description: 'download ock artefact rather than building, of form <target>=id;<target2=id2>.'
#' Special valuebuild | download_release' # TODO: add support for 'previous workflow' download
type: string
default: "build"

Expand All @@ -27,14 +28,14 @@ runs:
sudo apt-get install spirv-tools

- name: clone dpc++
if: inputs.create_dpcpp_artefact_method == 'build'
if: contains(inputs.download_dpcpp_artefact, inputs.target) != true
uses: actions/checkout@v4
with:
repository: intel/llvm
path: llvm

- name: dpcpp configure
if: inputs.create_dpcpp_artefact_method == 'build'
if: contains(inputs.download_dpcpp_artefact, inputs.target) != true
shell: bash
run:
cd llvm; python buildbot/configure.py
Expand All @@ -47,19 +48,19 @@ runs:
--cmake-opt=-DLLVM_ENABLE_ZSTD=OFF

- name: build sycl-headers
if: inputs.create_dpcpp_artefact_method == 'build'
if: contains(inputs.download_dpcpp_artefact, inputs.target) != true
shell: bash
run:
cmake --build llvm/build -- sycl-headers

- name: build dpc plus plus
if: inputs.create_dpcpp_artefact_method == 'build'
if: contains(inputs.download_dpcpp_artefact, inputs.target) != true
shell: bash
run:
python llvm/buildbot/compile.py -o llvm/build -v -j 8

- name: build extra utilties
if: inputs.create_dpcpp_artefact_method == 'build'
if: contains(inputs.download_dpcpp_artefact, inputs.target) != true
# Build various utilities, since those aren't proper dependencies.
# FileCheck and not are needed for tests. The rest are needed for
# cross builds. They are enabled on all targets for consistency.
Expand All @@ -70,7 +71,7 @@ runs:
opt prepare_builtins -j8

- name: copy utilities
if: inputs.create_dpcpp_artefact_method == 'build'
if: contains(inputs.download_dpcpp_artefact, inputs.target) != true
shell: bash
run:
cd llvm/build/bin;
Expand All @@ -80,7 +81,7 @@ runs:
# TODO: For now just linux x86_64
# Review for location of components (paths) and any archive package/unpackage reqs.
#- name: install config files to pick up libraries for cross compilation.
# if: inputs.create_dpcpp_artefact_method == 'build'
# if: contains(inputs.download_dpcpp_artefact, inputs.target) != true
# shell: bash
# run: |
# echo Installing configuration files
Expand All @@ -94,8 +95,9 @@ runs:
# " >../install/bin/$arch-unknown-linux-gnu.cfg;
# done

- name: download dpc plus plus
if: inputs.create_dpcpp_artefact_method == 'download_release'
- name: download dpc plus plus from official releases
# TODO: This is a bit imperfect as it should parse it properly
if: contains(inputs.download_dpcpp_artefact, inputs.target) && contains(inputs.download_dpcpp_artefact, 'download_release')
shell: bash
run: |
mkdir -p llvm/build/install
Expand All @@ -108,8 +110,23 @@ runs:
tar xf sycl_linux.tar.gz
rm sycl_linux.tar.gz

- name: download previous dpcpp if needed ${{ inputs.target }} ${{ matrix.download_dpcpp_artefact}}
shell: bash
if: contains(inputs.download_dpcpp_artefact, inputs.target) && contains(inputs.download_dpcpp_artefact, 'download_release') != true
run: |
download_id=`echo "${{inputs.download_dpcpp_artefact}}"`
echo "echo $download_id | sed 's/.*${{inputs.target}}=//' | sed 's/;.*//'"
download_id=`echo $download_id | sed 's/.*${{inputs.target}}=//' | sed 's/;.*//'`
echo download id is "'$download_id'"
# TODO : make this work on windows
mkdir -p llvm/build/install
gh run download $download_id -n dpcpp_${{ inputs.target }} -D llvm/build/install
ls llvm/build/install


- name: package artefacts # package/unpackage avoids known 'permissions loss' issue
shell: bash
if: contains(inputs.download_dpcpp_artefact, inputs.target) != true
run: |
cd llvm/build/install
tar cf dpcpp.tar *
Expand Down
22 changes: 19 additions & 3 deletions .github/actions/do_build_ock_artefact/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ inputs:
vulkan_sdk_install:
description: 'vulkan install flag'
default: true
download_ock_artefact:
description: 'download ock artefact rather than building, of form <target>=id;<target2=id2>.'
default: ''

# TODO: This has not been tested yet on windows so would likely need some updating.
runs:
Expand All @@ -32,6 +35,7 @@ runs:
# installs tools, ninja, installs llvm and sets up ccache
- name: setup
uses: ./.github/actions/setup_build
if: contains(inputs.download_ock_artefact, inputs.target) != true
with:
llvm_version: ${{ inputs.llvm_version }}
llvm_build_type: RelAssert
Expand All @@ -40,16 +44,16 @@ runs:
os: ${{ contains(inputs.target, 'windows') && 'windows' || 'ubuntu' }}

- name: build ock x86
if: steps.calc_vars.outputs.arch == 'x86_64'
if: steps.calc_vars.outputs.arch == 'x86_64' && contains(inputs.download_ock_artefact, inputs.target) != true
uses: ./.github/actions/do_build_ock
with:
build_targets: install
offline_kernel_tests: OFF
extra_flags: -DCA_ENABLE_TESTS=OFF -DCA_ENABLE_EXAMPLES=OFF -DCA_ENABLE_DOCUMENTATION=OFF
shell_to_use: ${{ contains(inputs.target, 'windows') && 'pwsh' || 'bash' }}

- name: build ock other ${{ matrix.target }}
if: steps.calc_vars.outputs.arch != 'x86_64'
- name: build ock other ${{ inputs.target }}
if: steps.calc_vars.outputs.arch != 'x86_64' && contains(inputs.download_ock_artefact, inputs.target) != true
uses: ./.github/actions/do_build_ock
with:
build_targets: install
Expand All @@ -59,6 +63,18 @@ runs:
offline_kernel_tests: OFF
host_fp16: ON

- name: download previous ock if needed ${{ inputs.target }} ${{ matrix.download_dpcpp_artefact}}
shell: bash
if: contains(inputs.download_ock_artefact, inputs.target)
run: |
download_id=`echo "${{inputs.download_ock_artefact}}"`
echo "echo $download_id | sed 's/.*${{inputs.target}}=//' | sed 's/;.*//'"
download_id=`echo $download_id | sed 's/.*${{inputs.target}}=//' | sed 's/;.*//'`
echo download id is "'$download_id'"
# TODO : make this work on windows
gh run download $download_id -n ock_${{ inputs.target }} -D install
ls install

# Prune it as there is too much things in there we don't want to use
# Todo: move this logic to cmake settings so that we build only what we
# want to install. As time goes on we may want to install more.
Expand Down
27 changes: 26 additions & 1 deletion .github/actions/do_build_sycl_cts/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ description: build sycl cts
inputs:
target:
description: 'target architecture'
download_sycl_cts_artefact:
description: 'download ock artefact rather than building, of form <target>=id;<target2=id2>.'
default: ''

runs:
using: "composite"
Expand All @@ -15,41 +18,48 @@ runs:
target: ${{ inputs.target }}

- name: Install Ninja
if: contains(inputs.download_sycl_cts_artefact, inputs.target) != true
uses: llvm/actions/install-ninja@main

- name: download icd artifact
if: contains(inputs.download_sycl_cts_artefact, inputs.target) != true
uses: actions/download-artifact@v4
with:
name: icd_${{inputs.target}}
path: install_icd

- name: download headers artifact
if: contains(inputs.download_sycl_cts_artefact, inputs.target) != true
uses: actions/download-artifact@v4
with:
name: header_${{inputs.target}}
path: install_headers

- name: download dpc++ artifact
if: contains(inputs.download_sycl_cts_artefact, inputs.target) != true
uses: actions/download-artifact@v4
with:
name: dpcpp_${{inputs.target}}
path: install_dpcpp

- name: unpackage dpc++ artifacts # package/unpackage avoids known 'permissions loss' issue
if: contains(inputs.download_sycl_cts_artefact, inputs.target) != true
shell: bash
run: |
cd install_dpcpp
tar xf dpcpp.tar
rm dpcpp.tar

- name: checkout sycl cts
if: contains(inputs.download_sycl_cts_artefact, inputs.target) != true
uses: actions/checkout@v4
with:
repository: KhronosGroup/SYCL-CTS
path: SYCL-CTS.src
submodules: true

- name: build SYCL CTS
if: contains(inputs.download_sycl_cts_artefact, inputs.target) != true
shell: bash
run: |
echo calling cmake and ninja on SYCL CTS
Expand All @@ -70,16 +80,31 @@ runs:
ninja -C SYCL-CTS -v -j4 -k 0 || :

- name: package artefacts # package/unpackage avoids known 'permissions loss' issue
if: contains(inputs.download_sycl_cts_artefact, inputs.target) != true
shell: bash
run: |
cd SYCL-CTS
# only bin
tar cf sycl-cts.tar bin

- name: download sycl cts artefact # package/unpackage avoids known 'permissions loss' issue
if: contains(inputs.download_sycl_cts_artefact, inputs.target)
shell: bash
run: |
download_id=`echo "${{inputs.download_sycl_cts_artefact}}"`
echo "echo $download_id | sed 's/.*${{inputs.target}}=//' | sed 's/;.*//'"
download_id=`echo $download_id | sed 's/.*${{inputs.target}}=//' | sed 's/;.*//'`
echo download id is "'$download_id'"
# TODO : make this work on windows
mkdir -p SYCL-CTS
gh run download $download_id -n dpcpp_${{ inputs.target }} -D SYCL-CTS
ls SYCL-CTS


- name: upload artefact
uses: actions/upload-artifact@v4
with:
name: sycl_cts_${{inputs.target}}
path: SYCL-CTS/sycl-cts.tar
retention-days: 1
retention-days: 2

22 changes: 22 additions & 0 deletions .github/actions/setup_gh/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: setup gh
description: Set up github's cli gh

inputs:
os:
description: 'os to use (contains windows or ubuntu)'
default: 'ubuntu'
token:
description: 'token for gh'

runs:
using: "composite"
steps:
- name: set up secret ubuntu
shell: bash
run:
echo "GH_TOKEN=${{ inputs.token }}" >> $GITHUB_ENV
- name: install gh
if: contains(inputs.os, 'ubuntu')
shell: bash
run:
sudo apt-get install --yes gh
1 change: 1 addition & 0 deletions .github/opencl_cts/expect_fail_all.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API,api/test_api
34 changes: 33 additions & 1 deletion .github/workflows/planned_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ on:
required: false
type: boolean
default: false
download_ock_artefact:
required: false
type: string
default: ''
download_dpcpp_artefact:
required: false
type: string
default: ''
download_sycl_cts_artefact:
required: false
type: string
default: ''

jobs:

Expand Down Expand Up @@ -89,12 +101,18 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: set up gh
uses: ./.github/actions/setup_gh
with:
os: ${{ contains( matrix.target, 'windows') && 'windows' || 'ubuntu' }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: build ock artefact
uses: ./.github/actions/do_build_ock_artefact
with:
target: ${{ matrix.target }}
llvm_version: ${{ inputs.llvm_version }}
vulkan_sdk_install: false
download_ock_artefact: ${{ inputs.download_ock_artefact }}

build_icd:
if: inputs.test_tornado || inputs.test_opencl_cts || inputs.test_sycl_cts
Expand Down Expand Up @@ -174,11 +192,13 @@ jobs:
source
platform
.github

# TODO: Consider separating out opencl_cts build and run in the future
- name : build and upload opencl_cts
uses: ./.github/actions/do_build_opencl_cts
with:
target: ${{ matrix.target }}
download_opencl_artefact: ${{ inputs.download_opencl_artefact }}
- name : run opencl_cts
uses: ./.github/actions/run_opencl_cts
with:
Expand All @@ -202,10 +222,16 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: set up gh
uses: ./.github/actions/setup_gh
with:
os: ${{ contains( matrix.target, 'windows') && 'windows' || 'ubuntu' }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: build dpc++ artefact
uses: ./.github/actions/do_build_dpcpp
with:
target: ${{ matrix.target }}
download_dpcpp_artefact: ${{ inputs.download_dpcpp_artefact }}

build_sycl_cts:
needs: [workflow_vars, build_icd, build_dpcpp_native_host]
Expand All @@ -226,10 +252,16 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: build dpc++ artefact
- name: set up gh
uses: ./.github/actions/setup_gh
with:
os: ${{ contains( matrix.target, 'windows') && 'windows' || 'ubuntu' }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: build sycl cts artefact
uses: ./.github/actions/do_build_sycl_cts
with:
target: ${{ matrix.target }}
download_sycl_cts_artefact: ${{ inputs.download_sycl_cts_artefact }}

run_sycl_cts:
needs: [workflow_vars, create_ock_artefacts_ubuntu, build_dpcpp_native_host, build_sycl_cts]
Expand Down
Loading
Loading