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: Add ock artefact building #574

Open
wants to merge 3 commits 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
100 changes: 100 additions & 0 deletions .github/actions/do_build_icd/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: pull and build icd loader
description: pull icd loader and build with a particular toolchain

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

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: clone headers
uses: actions/checkout@v4
with:
repository: KhronosGroup/OpenCL-Headers
path: headers
- name: build headers
shell: ${{ inputs.shell_to_use }}
run: |
cmake headers -Bheaders/build ${{ inputs.toolchain }} . -DCMAKE_INSTALL_PREFIX=headers_install -GNinja
ninja -v -C headers/build
ninja -v -C headers/build install
pwd
ls -R .


- name: clone icd
uses: actions/checkout@v4
with:
repository: KhronosGroup/OpenCL-ICD-Loader
path: icd

- name: icd cmake
shell: ${{ inputs.shell_to_use }}
run:
cmake -B icd/build . ${{ inputs.toolchain }}
-DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DCMAKE_INSTALL_PREFIX=install_icd
-DOpenCLHeaders_DIR=headers_install/share/cmake/OpenCLHeaders" -GNinja

- name: icd build
shell: ${{ inputs.shell_to_use }}
run: |
ninja -v -C build
ninja -v -C build install
pwd
ls -R .

- name: upload icd artifact
uses: actions/upload-artifact@v4
with:
name: icd_${{ inputs.name }}
path: install
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
12 changes: 4 additions & 8 deletions .github/actions/do_build_ock/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,9 @@ inputs:
shell_to_use:
description: "which shell to use (default bash)"
default: bash
c_compiler:
description: "C compiler (default gcc)"
default: "gcc"
cxx_compiler:
description: "C++ compiler (default g++)"
default: "g++"
toolchain_file:
description: "Path to toolchain file"
default: ""

runs:
# We don't want a new docker just a list of steps, so mark as composite
Expand Down Expand Up @@ -164,8 +161,7 @@ runs:
-DCA_CL_DISABLE_UNITCL_VECZ_CHECKS=${{ inputs.disable_unitcl_vecz_checks }}
-DCA_GTEST_LAUNCHER="${{ inputs.gtest_launcher }}"
-DCA_BUILD_32_BITS=${{ inputs.build_32_bit }}
-DCMAKE_C_COMPILER=${{ inputs.c_compiler }}
-DCMAKE_CXX_COMPILER=${{ inputs.cxx_compiler }}
-DCMAKE_TOOLCHAIN_FILE=${{ inputs.toolchain_file }}
${{ inputs.extra_flags }}
.
- name: build_ock
Expand Down
10 changes: 9 additions & 1 deletion .github/actions/setup_build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@ runs:
sudo apt-get install --yes doxygen
sudo apt-get install --yes vulkan-sdk
if [ "${{ inputs.arch }}" = "x86" ]; then sudo apt-get install --yes gcc-multilib g++-multilib libc6-dev:i386 lib32tinfo-dev ; fi

# aarch64: Enable ability to install arm64 packages for cross compilation
# The main archive only hosts amd64 and i386, also add ports for arm64.
# Also install Arm/Aarch64 requirements
if [ "${{ inputs.arch }}" = "aarch64" ]; then \
# sudo dpkg --add-architecture arm64 ; \
sudo apt-get install --yes gcc-11-arm-linux-gnueabihf g++-11-arm-linux-gnueabihf; \
sudo apt-get install --yes gcc-11-aarch64-linux-gnu g++-11-aarch64-linux-gnu; \
fi
# sudo sed -i -e '/^deb /{h;s|deb |&[arch=amd64,i386] |p;g;s|deb http://[^ ]*|deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports|p;d}' /etc/apt/sources.list; \
- name: Install windows prerequisites
if: ${{ inputs.os == 'windows' }}
shell: pwsh
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
push:
branches:
- main
pull_request:
branches:
- main
# pull_request:
# branches:
# - main
schedule:
- cron: '19 9 * * 3'

Expand Down
217 changes: 217 additions & 0 deletions .github/workflows/planned_testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
# Simple workflow for running non-documentation PR testing
name: Run ock tests for PR testing
on:
workflow_call:
inputs:
ock:
required: false
type: boolean
default: true
target_list:
required: false
type: string
default: '["x86_64", "aarch64", "riscv64"]'
os_list:
required: false
type: string
default: '["ubuntu-22.04", "windows-2019"]'
update_cache:
required: false
type: boolean
default: false
# target_host_x86_64_windows:
# required: false
# type: boolean
# default: false
# target_host_aarch64_linux:
# required: false
# type: boolean
# default: true
llvm_version:
required: false
type: string
default: 18

env:
target_list: '["x86_64","aarch64", "riscv64"]'
os_list: '["ubuntu-22.04", "windows-2019"]'

jobs:

calc_matrix:
runs-on: ubuntu-latest
name: Calc matrix
outputs:
target_list: ${{ steps.step1.outputs.target_list }}
os_list: ${{ steps.step1.outputs.os_list }}
steps:
- id: step1
run: |
# echo "target_list=$target_list" >> "$GITHUB_OUTPUT"
# echo "os_list=$os_list" >> "$GITHUB_OUTPUT"
echo 'target_list=${{ inputs.target_list }}' >> "$GITHUB_OUTPUT"
echo 'os_list=${{ inputs.os_list }}' >> "$GITHUB_OUTPUT"
cat $GITHUB_OUTPUT

# create_ock_artefacts:
# needs: calc_matrix
# strategy:
# matrix:
# target: ${{ fromJson(needs.calc_matrix.outputs.target_list) }}
# os: ${{ fromJson(needs.calc_matrix.outputs.os_list) }}
# build_type: [RelAssert]
# exclude:
# - os: windows-2019
# - target: riscv64
# # - target: aarch64

# runs-on: ${{ matrix.os }}
# steps:
# - name: Checkout repo
# uses: actions/checkout@v4

# # TODO: Move this to a single action
# - name: load native llvm
# if: ${{ matrix.target }} != "x86_64" && ${{ matrix.os }} == "ubuntu-22.04"
# uses: actions/cache/restore@v4
# with:
# path: llvm_install/**
# key: llvm-ubuntu-22.04-x86_64-v19-RelAssert
# fail-on-cache-miss: true
# - name: mv llvm native
# if: ${{ matrix.target }} != "x86_64" && ${{ matrix.os }} == "ubuntu-22.04"
# run: mv llvm_install llvm_install_native

# # installs tools, ninja, installs llvm and sets up sccache
# - name: setup-ubuntu
# if: ${{ matrix.target }} == "x86_64" && ${{ matrix.os }} == "ubuntu-22.04"
# uses: ./.github/actions/setup_build
# with:
# llvm_version: 19
# llvm_build_type: RelAssert
# # For now target and arch match
# arch: ${{ matrix.target }}
# save: ${{ inputs.update_cache }}

# - name: build ock x86
# if: ${{ matrix.target == 'x86_64' }}
# uses: ./.github/actions/do_build_ock
# with:
# build_targets: install
# offline_kernel_tests: OFF

# - name: build ock other ${{ matrix.target }}
# if: ${{ matrix.target != 'x86_64' }}
# uses: ./.github/actions/do_build_ock
# with:
# build_targets: install
# # Todo : target does not directly equate to arch here
# arch: ${{ matrix.target }}
# toolchain_file: "platform/arm-linux/aarch64-toolchain.cmake"
# 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 ${{ matrix.target }}
# run: |
# # delete all but city runner and the python associated file under bin
# find install_ock_${{matrix.os}}_${{matrix.target}}/bin -maxdepth 1 -type f ! -name "*.py" -delete
# rm -rf install_ock_${{matrix.os}}_${{matrix.target}}/share

# - name: upload ock artefact
# uses: actions/upload-artifact@v4
# with:
# name: ock_${{matrix.os}}_${{matrix.target}}
# path: install
# retention-days: 1


# use_ock_artefacts_all:
# needs: [ calc_matrix, create_ock_artefacts ]
# strategy:
# matrix:
# target: ${{ fromJson(needs.calc_matrix.outputs.target_list) }}
# os: ${{ fromJson(needs.calc_matrix.outputs.os_list) }}
# build_type: [RelAssert]
# exclude:
# - os: windows-2019
# target: aarch64
# - os: windows-2019
# target: riscv64


build_icd:
needs: [ calc_matrix ]
strategy:
matrix:
target: ${{ fromJson(needs.calc_matrix.outputs.target_list) }}
os: ${{ fromJson(needs.calc_matrix.outputs.os_list) }}
build_type: [RelAssert]
exclude:
- os: windows-2019
- target: riscv64
runs-on: ${{ matrix.os }}
steps:
- name: clone ock platform
uses: actions/checkout@v4
with:
sparse-checkout: |
platform
.github
- name : build icd x86_64
if: ${{matrix.target}} == "x86_64"
uses: ./.github/actions/do_build_icd
with:
# Todo : not just support linux here
name: icd_${{matrix.os}}_${{matrix.target}}

- name : build icd other
if: ${{matrix.target}} != "x86_64"
uses: ./.github/actions/do_build_icd
with:
# Todo : not just support linux here
toolchain: --toolchain $GITHUB_WORKSPACE/toolchains/${{matrix.target}}-linux.cmake"
name: icd_${{matrix.os}}_${{matrix.target}}

# toolchain:
# description: 'path to toolchain'
# default: $GITHUB_WORKSPACE/ock/platform/x86_64-linux.cmake
# build_type:
# description: 'path to toolchain'
# default: ock/platform/x86_64-linux.cmake
# name:
# description: 'artifact name'
# default: ubuntu-22.04-x86_64

# use_ock_artefacts:
# needs: [ calc_matrix, create_ock_artefacts ]
# strategy:
# matrix:
# target: ${{ fromJson(needs.calc_matrix.outputs.target_list) }}
# os: ${{ fromJson(needs.calc_matrix.outputs.os_list) }}
# build_type: [RelAssert]
# exclude:
# - os: windows-2019
# - target: riscv64
# runs-on: ${{ matrix.os }}
# steps:
# - name: Download ock artefact
# uses: actions/download-artifact@v4
# with:
# name: ock_${{matrix.os}}_${{matrix.target}}
# path: ock_${{matrix.os}}_${{matrix.target}}

# - name: print ock artefact
# run: |
# ls -R .
# echo "${{ matrix.os }} ${{ matrix.build_type }} ${{ matrix.arch }}" > foo.txt

# --define CA_CL_ENABLE_ICD_LOADER=ON
# --define OCL_EXTENSION_cl_khr_command_buffer=ON
# --define OCL_EXTENSION_cl_khr_command_buffer_mutable_dispatch=ON
# --define OCL_EXTENSION_cl_khr_extended_async_copies=ON
# --target check-ock
# -B build
Loading
Loading