-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add ock artefact building #574
Open
coldav
wants to merge
1
commit into
uxlfoundation:main
Choose a base branch
from
coldav:colin/build_ock_artefact
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: calc vars | ||
description: calculate variables based off the target name that may be useful in other steps | ||
|
||
inputs: | ||
target: | ||
description: 'target architecture' | ||
|
||
outputs: | ||
arch: | ||
description: "base architecture - one of x86, x86_64, arm, aarch64 or riscv64" | ||
value: ${{ steps.calc_vars_action.outputs.arch }} | ||
toolchain: | ||
description: "path to toolchain file for architecture" | ||
value: ${{ steps.calc_vars_action.outputs.toolchain }} | ||
cmake_toolchain: | ||
description: "cmake argument to pass to " | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: pull and build opencl icd loader | ||
description: pull icd loader and build with a particular toolchain, uploading opencl header and icd artefacts | ||
|
||
inputs: | ||
target: | ||
description: 'target architecture' | ||
|
||
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: clone headers | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: KhronosGroup/OpenCL-Headers | ||
path: headers | ||
|
||
- name: build headers | ||
shell: bash | ||
run: | | ||
pwd | ||
ls -d * | ||
cmake headers -Bheaders/build_${{steps.calc_vars.outputs.arch}} -DCMAKE_TOOLCHAIN_FILE=${{ steps.calc_vars.outputs.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: upload header artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: header_${{inputs.target}} | ||
path: headers_install_${{steps.calc_vars.outputs.arch}} | ||
retention-days: 1 | ||
|
||
- name: clone icd | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: KhronosGroup/OpenCL-ICD-Loader | ||
path: icd | ||
|
||
- name: icd cmake | ||
shell: bash | ||
run: | ||
cmake icd -B icd/build_${{steps.calc_vars.outputs.arch}} -DCMAKE_TOOLCHAIN_FILE=${{ steps.calc_vars.outputs.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: bash | ||
run: | | ||
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: icd_${{inputs.target}} | ||
path: install_icd_${{steps.calc_vars.outputs.arch}} | ||
retention-days: 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: build-ock-artefacts | ||
description: Action to build the oneapi-construction-kit as an artefact | ||
|
||
# Note we need to support tip at some point | ||
|
||
inputs: | ||
llvm_version: | ||
description: 'llvm version we want to use (18-19)' | ||
default: '19' | ||
target: | ||
description: 'target architecture' | ||
|
||
# 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 }} | ||
|
||
- 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 | ||
extra_flags: -DCA_ENABLE_TESTS=OFF -DCA_ENABLE_EXAMPLES=OFF -DCA_ENABLE_DOCUMENTATION=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 | ||
toolchain_file: ${{ steps.calc_vars.outputs.toolchain }} | ||
extra_flags: -DCA_BUILTINS_TOOLS_DIR=${{ github.workspace }}/llvm_install_native/bin -DCA_ENABLE_TESTS=OFF -DCA_ENABLE_EXAMPLES=OFF -DCA_ENABLE_DOCUMENTATION=OFF | ||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: build tornado | ||
description: build tornado | ||
|
||
inputs: | ||
target: | ||
description: 'target architecture' | ||
|
||
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_${{inputs.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: clone TornadoVM | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: beehive-lab/TornadoVM | ||
path: TornadoVM_build | ||
ref: develop | ||
|
||
- name: build tornadovm | ||
shell: bash | ||
run: | | ||
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 | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: run tornado | ||
description: run tornado | ||
|
||
# This action is not standalone and assumes it has been run after the build_tornado action | ||
# and that the icd is already installed at install_icd | ||
inputs: | ||
target: | ||
description: 'target architecture' | ||
|
||
runs: | ||
# We don't want a new docker just a list of steps, so mark as composite | ||
using: "composite" | ||
steps: | ||
- name: Download ock artefact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ock_${{inputs.target}} | ||
path: install_ock | ||
|
||
- name: Run tornado example | ||
shell: bash | ||
run: | | ||
export ARTEFACT_CHECKOUT_PATH=$GITHUB_WORKSPACE/install_ock | ||
export ICD_LOADER_INSTALL_PATH=$GITHUB_WORKSPACE/install_icd | ||
export LD_LIBRARY_PATH=$ICD_LOADER_INSTALL_PATH/lib:$LD_LIBRARY_PATH | ||
echo $LD_LIBRARY_PATH | ||
export OCL_ICD_FILENAMES=$ARTEFACT_CHECKOUT_PATH/lib/libCL.so | ||
export JAVA_HOME=`readlink -f $(command -v java) | sed 's/\/bin\/java//'` | ||
export TORNADO_SDK=$GITHUB_WORKSPACE/TornadoVM_build/bin/sdk | ||
export PATH=$TORNADO_SDK/bin:$PATH | ||
git clone https://github.com/beehive-lab/TornadoVM.git -b develop --depth 1 | ||
cd TornadoVM | ||
CA_HOST_DUMP_ASM=1 tornado --printKernel --threadInfo -m tornado.examples/uk.ac.manchester.tornado.examples.compute.MatrixMultiplication2D 256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ permissions: {} | |
|
||
jobs: | ||
analyze-host-x86_64-release: | ||
if: false | ||
name: Analyze host x86_64 release | ||
permissions: | ||
# required for all workflows | ||
|
@@ -72,6 +73,7 @@ jobs: | |
category: "/language:c-cpp" | ||
|
||
analyze-riscv-m1: | ||
if: false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBD remove |
||
name: Analyze riscv m1 | ||
permissions: | ||
# required for all workflows | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBD remove