Skip to content

Commit

Permalink
TBD
Browse files Browse the repository at this point in the history
  • Loading branch information
coldav committed Nov 20, 2024
1 parent 7441b2f commit 2440fe1
Show file tree
Hide file tree
Showing 9 changed files with 385 additions and 298 deletions.
45 changes: 45 additions & 0 deletions .github/actions/calc_vars/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: calc vars
description: calc vars

inputs:
target:
description: 'TBD'
default: host_x86

outputs:
arch:
value: ${{ steps.calc_vars_action.outputs.arch }}
toolchain:
value: ${{ steps.calc_vars_action.outputs.toolchain }}
cmake_toolchain:
value: ${{ steps.calc_vars_action.outputs.cmake_toolchain }}
runs:
# We don't want a new docker just a list of steps, so mark as composite
using: "composite"
steps:
- shell: bash
id: calc_vars_action
run: |
export ARCH=
export TOOLCHAIN=
export CMAKE_TOOLCHAIN=
if [[ "${{inputs.target}}" = "host_x86_64_linux" ]]; then
export ARCH=x86_64 >> $GITHUB_OUTPUT
elif [[ "${{inputs.target}}" = "host_x86_64_windows" ]]; then
export ARCH=x86_64 >> $GITHUB_OUTPUT
elif [[ "${{inputs.target}}" = "host_aarch64_linux" ]]; then
export ARCH=aarch64 >> $GITHUB_OUTPUT;
export TOOLCHAIN=$GITHUB_WORKSPACE/platform/arm-linux/aarch64-toolchain.cmake
export CMAKE_TOOLCHAIN="--toolchain $TOOLCHAIN"
elif [[ "${{inputs.target}}" = "host_riscv64_linux" ]]; then
export ARCH=riscv64 >> $GITHUB_OUTPUT;
export TOOLCHAIN=$GITHUB_WORKSPACE/platform/riscv64-linux/riscv64-toolchain.cmake
export CMAKE_TOOLCHAIN="--toolchain $TOOLCHAIN"
else
echo Unknown target ${{inputs.target}}
exit 1
fi
echo "arch=$ARCH" >> $GITHUB_OUTPUT
echo "toolchain=$TOOLCHAIN" >> $GITHUB_OUTPUT
echo "cmake_toolchain=$CMAKE_TOOLCHAIN" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
90 changes: 25 additions & 65 deletions .github/actions/do_build_icd/action.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,39 @@
name: pull and build icd loader
description: pull icd loader and build with a particular toolchain

# Note this can be reused withing the same job for different architectures

inputs:
toolchain:
description: 'path to toolchain'
default: ''
#$GITHUB_WORKSPACE/ock/platform/x86_64-linux.cmake
build_type:
description: 'build type'
default: Release
name:
description: 'artifact name'
default: ubuntu-22.04-x86_64
shell_to_use:
description: "which shell to use (default bash)"
default: bash
target:
description: 'TBD'

runs:
# We don't want a new docker just a list of steps, so mark as composite
using: "composite"
steps:
# - name: clone ock platform
# uses: actions/checkout@v4
# with:
# sparse-checkout: |
# platform
# path: ock
- name: calc vars
id: calc_vars
uses: ./.github/actions/calc_vars
with:
target: ${{ inputs.target }}

- name: check paths
shell: ${{ inputs.shell_to_use }}
run: |
pwd
ls -d *
- name: Install Ninja
uses: llvm/actions/install-ninja@main

- name: clone headers
uses: actions/checkout@v4
with:
repository: KhronosGroup/OpenCL-Headers
path: headers

- name: build headers
shell: ${{ inputs.shell_to_use }}
shell: bash
run: |
pwd
ls -d *
cmake headers -Bheaders/build ${{ inputs.toolchain }} -DCMAKE_INSTALL_PREFIX=$PWD/headers_install -GNinja
ninja -v -C headers/build
ninja -v -C headers/build install
cmake headers -Bheaders/build_${{steps.calc_vars.outputs.arch}} ${{ steps.calc_vars.outputs.cmake_toolchain }} -DCMAKE_INSTALL_PREFIX=$PWD/headers_install_${{steps.calc_vars.outputs.arch}} -GNinja
ninja -v -C headers/build_${{steps.calc_vars.outputs.arch}}
ninja -v -C headers/build_${{steps.calc_vars.outputs.arch}} install
- name: clone icd
Expand All @@ -55,52 +43,24 @@ runs:
path: icd

- name: icd cmake
shell: ${{ inputs.shell_to_use }}
shell: bash
run:
cmake icd -B icd/build ${{ inputs.toolchain }}
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DCMAKE_INSTALL_PREFIX=$PWD/install_icd
-DOpenCLHeaders_DIR=$PWD/headers_install/share/cmake/OpenCLHeaders -GNinja
cmake icd -B icd/build_${{steps.calc_vars.outputs.arch}} ${{ steps.calc_vars.outputs.cmake_toolchain }}
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DCMAKE_INSTALL_PREFIX=$PWD/install_icd_${{steps.calc_vars.outputs.arch}}
-DOpenCLHeaders_DIR=$PWD/headers_install_${{steps.calc_vars.outputs.arch}}/share/cmake/OpenCLHeaders -GNinja

- name: icd build
shell: ${{ inputs.shell_to_use }}
shell: bash
run: |
ninja -v -C icd/build
ninja -v -C icd/build install
ninja -v -C icd/build_${{steps.calc_vars.outputs.arch}}
ninja -v -C icd/build_${{steps.calc_vars.outputs.arch}} install
pwd
ls icd/
- name: upload icd artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.name }}
path: install_icd
name: icd_${{inputs.target}}_${{steps.calc_vars.outputs.arch}}
path: install_icd_${{steps.calc_vars.outputs.arch}}
retention-days: 1

# - name: cmake_ock
# shell: ${{ inputs.shell_to_use }}
# - mkdir -p $CI_PROJECT_DIR/build
# - cd $CI_PROJECT_DIR/build
# - git -c advice.detachedHead=false
# clone https://github.com/KhronosGroup/OpenCL-Headers
# --single-branch --depth 1
# - cd OpenCL-Headers
# - git log -1
# - mkdir build
# - cmake -Bbuild ${{ inputs.toolchain }} .
# "-DCMAKE_INSTALL_PREFIX=$OPENCL_HEADERS_PATH" -GNinja
# - ninja -v -C build
# - ninja -v -C build install
# - cd ..

# - git -c advice.detachedHead=false
# clone https://github.com/KhronosGroup/OpenCL-ICD-Loader
# --single-branch --depth 1
# - cd OpenCL-ICD-Loader
# - git log -1
# - mkdir build
# - cmake -Bbuild . ${{ inputs.toolchain }}
# "-DCMAKE_BUILD_TYPE=$ICD_BUILD_TYPE" -DCMAKE_INSTALL_PREFIX=$ICD_LOADER_INSTALL_PATH
# "-DOpenCLHeaders_DIR=$OPENCL_HEADERS_PATH/share/cmake/OpenCLHeaders" -GNinja
# - ninja -v -C build
# - ninja -v -C build install
# - cd $CI_PROJECT_DIR
74 changes: 74 additions & 0 deletions .github/actions/do_build_ock_artefact/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: build-ock-artefacts
description: Action to build the oneapi-construction-kit as an artefact

inputs:
llvm_version:
description: 'TBD'
default: '19'
target:
description: 'TBD'

# TODO: This has not been tested yet on windows so would likely need some updating.
runs:
# We don't want a new docker just a list of steps, so mark as composite
using: "composite"
steps:
- name: calc vars
id: calc_vars
uses: ./.github/actions/calc_vars
with:
target: ${{ inputs.target }}

- name: print vars
shell: bash
run: |
echo arch = ${{steps.calc_vars.outputs.arch}}
echo toolchain = ${{steps.calc_vars.outputs.toolchain}}
# installs tools, ninja, installs llvm and sets up sccache
- name: setup
uses: ./.github/actions/setup_build
with:
llvm_version: 19
llvm_build_type: RelAssert
cross_arch: ${{ steps.calc_vars.outputs.arch == 'x86_64' && '' || steps.calc_vars.outputs.arch }}
native_llvm_arch: ${{ steps.calc_vars.outputs.arch == 'x86_64' && '' || 'x86_64' }}

- name: build ock x86
if: steps.calc_vars.outputs.arch == 'x86_64'
uses: ./.github/actions/do_build_ock
with:
build_targets: install
offline_kernel_tests: OFF

- name: build ock other ${{ matrix.target }}
if: steps.calc_vars.outputs.arch != 'x86_64'
uses: ./.github/actions/do_build_ock
with:
build_targets: install
# Todo : target does not directly equate to arch here
toolchain_file: ${{ steps.calc_vars.outputs.toolchain }}
extra_flags: -DCA_BUILTINS_TOOLS_DIR=${{ github.workspace }}/llvm_install_native/bin
# Do we need the offline kernel as an artefact? If so currently this requires an external clc or qemu to be installed.
offline_kernel_tests: OFF
host_fp16: ON

# Prune it as there is too much things in there we don't want to use
# We may want to extend this a bit as time goes on such as clc or UnitCL
- name: prune ock artefact
shell: bash
run: |
# delete all but city runner and the python associated file under bin
find install/bin -maxdepth 1 -type f ! -name "*.py" -delete
rm -rf install/share
- name: upload ock artefact
uses: actions/upload-artifact@v4
with:
name: ock_${{ inputs.target }}
path: install
retention-days: 1

# Some of these are riscv or host target specific, but it does not harm at present to
# overset cmake values
# inputs:
65 changes: 65 additions & 0 deletions .github/actions/do_build_tornado/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: build tornado
description: build tornado

inputs:
target:
description: 'TBD'

runs:
# We don't want a new docker just a list of steps, so mark as composite
using: "composite"
steps:
- name: calc vars
id: calc_vars
uses: ./.github/actions/calc_vars
with:
target: ${{ inputs.target }}

- name: Install Ninja
uses: llvm/actions/install-ninja@main

- name: download icd artifact
uses: actions/download-artifact@v4
with:
name: icd_${{input.target}}
path: install_icd

# Get maven
- name: fetch maven
shell: bash
run: |
wget https://archive.apache.org/dist/maven/maven-3/3.9.3/binaries/apache-maven-3.9.3-bin.tar.gz
tar xf apache-maven-3.9.3-bin.tar.gz
# todo: setup correctly for our aarch64 runner
- name: select jdk21
if: steps.calc_vars.outputs.arch == 'x86_64'
shell: bash
run: |
sudo update-java-alternatives -s temurin-21-jdk-amd64
pip install tqdm
- name: build tornadovm
shell: bash
run: |
git clone https://github.com/beehive-lab/TornadoVM.git -b develop --depth 1 TornadoVM_build
export JAVA_HOME=`readlink -f $(command -v java) | sed 's/\/bin\/java//'`
export TORNADO_SDK=$GITHUB_WORKSPACE/TornadoVM_build/bin/sdk
export PATH=$PWD/apache-maven-3.9.3/bin:$PATH
mvn -v
java --version
cd TornadoVM_build
# The tornado build system links in OpenCL assuming it's in a known place. This gets around
# this by pass CXX as an environment variable as it's difficult to change the build system
# even if we don't use this script.
CXX="g++ -L$GITHUB_WORKSPACE/install_icd/lib" make -j8 jdk21 BACKEND=opencl
# # Not sure if gitlab ci does not follow symbolic links so copy for the artefact
# cp -r -L $TORNADO_SDK $GITHUB_WORKSPACE/TornadoVM_SDK
- name: upload tornado artifact
uses: actions/upload-artifact@v4
with:
name: tornado_${{inputs.target}}
path: TornadoVM_SDK
retention-days: 1
14 changes: 14 additions & 0 deletions .github/actions/setup_build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ inputs:
cross_arch:
description: 'Cross compilation architecture from: x86, arm, aarch64, riscv64. Default: "" (no cross compile)'
default: ""
native_llvm_arch:
description: 'Native llvm architecture if needed from: x86_64 (currently). Default: "" (no additional llvm needed)'
default: ""
# Note: runner architectures from: x86_64 (aka runner.arch: X64), aarch64 (aka runner.arch: ARM64)

runs:
Expand Down Expand Up @@ -93,6 +96,17 @@ runs:
echo "key_version=$KEY_VERSION"
echo "key_arch=$KEY_ARCH"
- name: load llvm native
if: inputs.native_llvm_arch != ''
uses: actions/cache/restore@v4
with:
path: llvm_install/**
key: llvm-${{ inputs.os }}-${{ steps.set_llvm_key.outputs.key_version }}-${{ inputs.native_llvm_arch }}-v${{ inputs.llvm_version }}-${{ inputs.llvm_build_type }}
fail-on-cache-miss: true
- shell: bash
if: inputs.native_llvm_arch != ''
run: mv llvm_install llvm_install_native

- name: load llvm
uses: actions/cache/restore@v4
with:
Expand Down
13 changes: 13 additions & 0 deletions .github/actions/sparse_checkout/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: sparse checkout
description: sparse checjout ock (currently platform and .github)

runs:
# We don't want a new docker just a list of steps, so mark as composite
using: "composite"
steps:
- name: clone ock platform
uses: actions/checkout@v4
with:
sparse-checkout: |
platform
.github
28 changes: 14 additions & 14 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ on:
push:
branches:
- main
pull_request:
branches:
- main
paths:
- 'source/**'
- 'clik/**'
- 'modules/**'
- 'examples/**'
- 'cmake/**'
- 'hal/**'
- '.github/actions/do_build_ock/**'
- '.github/actions/setup_build/**'
- '.github/workflows/codeql.yml'
- 'CMakeLists.txt'
# pull_request:
# branches:
# - main
# paths:
# - 'source/**'
# - 'clik/**'
# - 'modules/**'
# - 'examples/**'
# - 'cmake/**'
# - 'hal/**'
# - '.github/actions/do_build_ock/**'
# - '.github/actions/setup_build/**'
# - '.github/workflows/codeql.yml'
# - 'CMakeLists.txt'
schedule:
- cron: '19 9 * * 3'

Expand Down
Loading

0 comments on commit 2440fe1

Please sign in to comment.