Skip to content

Commit

Permalink
Add ock artefact building
Browse files Browse the repository at this point in the history
  • Loading branch information
coldav committed Nov 13, 2024
1 parent a64b736 commit 769c8a4
Show file tree
Hide file tree
Showing 4 changed files with 226 additions and 16 deletions.
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
176 changes: 176 additions & 0 deletions .github/workflows/planned_testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# 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 }}
toolchain_file: scripts/../platform/arm-linux/${{ matrix.target }}-toolchain.cmake"

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

- 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
install_dir: install_ock_${{matrix.os}}_${{matrix.target}}
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 0 -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_ock_${{matrix.os}}_${{matrix.target}}
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


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}}

- 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
34 changes: 34 additions & 0 deletions .github/workflows/planned_testing_caller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Calling workflow for running PR style tests
name: Run ock tests for PR style testing
on:
pull_request:
paths:
- '.github/workflows/planned_testing.yml'
# schedule:
# # Run Mon-Fri at 7pm
# - cron: '00 19 * * 1-5'

jobs:
run-with-pull:
# This makes the diagram too big if we post much here so P_ for pull request.
name: P_
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/workflows/planned_testing.yml
with:
# target_list: '["x86_64", "aarch64", "riscv64"]'
target_list: '["x86_64", "aarch64"]'
# os_list: '["ubuntu-22.04", "windows-2019"]'
# target_list: '["x86_64"]'
os_list: '["ubuntu-22.04"]'
# os_list: '["ubuntu-22.04"]'
# target_host_aarch64_linux: true

# # Could have multiple here
# run-with-cron:
# name: Call PR testing on schedule
# if: ${{ github.event_name == 'schedule' }}
# uses: ./.github/workflows/run_pr_tests.yml
# with:
# update_cache: true

# additional ones here for cron and/or push to main - also can be in different file.
26 changes: 13 additions & 13 deletions .github/workflows/run_pr_tests_caller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ on:
- cron: '00 19 * * 1-5'

jobs:
run-with-pull:
name: Call PR testing on pull request
if: ${{ github.event_name == 'pull_request' }}
uses: ./.github/workflows/run_pr_tests.yml
with:
update_cache: false
# run-with-pull:
# name: Call PR testing on pull request
# if: ${{ github.event_name == 'pull_request' }}
# uses: ./.github/workflows/run_pr_tests.yml
# with:
# update_cache: false

# Could have multiple here
run-with-cron:
name: Call PR testing on schedule
if: ${{ github.event_name == 'schedule' }}
uses: ./.github/workflows/run_pr_tests.yml
with:
update_cache: true
# # Could have multiple here
# run-with-cron:
# name: Call PR testing on schedule
# if: ${{ github.event_name == 'schedule' }}
# uses: ./.github/workflows/run_pr_tests.yml
# with:
# update_cache: true

# additional ones here for cron and/or push to main - also can be in different file.

0 comments on commit 769c8a4

Please sign in to comment.