interplane.Get Omega
Read in your language

omega-kernel-template

aien-dev/omega-kernel-template

Brought by drakestapleton

branch main Branches Tags History

omega-kernel-template / .github / workflows / toolchain.yml

84 lines · 3987 bytes Raw Blame History
1# Build the PoCL CPU OpenCL runtime that tools/fetch.sh pins, on the same GitHub-hosted
2# ubuntu-24.04-arm image the kernel check uses, self-test it with the demo kernel, and
3# (when publish is true) attach it with its sha256 to the release named in toolchain.lock.
4# Ubuntu's own PoCL 5.0 package is not used: it predates the SPIR-V path this check needs.
5name: Build PoCL toolchain asset
6
7on:
8 workflow_dispatch:
9 inputs:
10 publish:
11 description: Publish the asset to the release tag in toolchain.lock
12 type: boolean
13 default: false
14
15permissions:
16 contents: read
17
18env:
19 POCL_COMMIT: 888c9774b94590fff1afef003154ca2c0ea66605
20
21jobs:
22 pocl:
23 runs-on: ubuntu-24.04-arm
24 timeout-minutes: 120
25 permissions:
26 contents: write
27 steps:
28 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29
30 - name: Install build dependencies (Ubuntu LLVM 18)
31 run: |
32 sudo apt-get update -qq
33 sudo apt-get install -y -qq --no-install-recommends \
34 cmake ninja-build pkg-config clang-18 libclang-18-dev libclang-cpp18-dev llvm-18-dev \
35 llvm-spirv-18 libllvmspirvlib-18-dev ocl-icd-libopencl1 ocl-icd-opencl-dev \
36 opencl-c-headers spirv-tools zlib1g-dev libzstd-dev
37
38 - name: Build PoCL at the pinned commit
39 run: |
40 git init -q "$RUNNER_TEMP/pocl-src"
41 git -C "$RUNNER_TEMP/pocl-src" fetch -q --depth 1 https://github.com/pocl/pocl.git "$POCL_COMMIT"
42 git -C "$RUNNER_TEMP/pocl-src" checkout -q FETCH_HEAD
43 test "$(git -C "$RUNNER_TEMP/pocl-src" rev-parse HEAD)" = "$POCL_COMMIT"
44 cmake -S "$RUNNER_TEMP/pocl-src" -B "$RUNNER_TEMP/pocl-build" -G Ninja \
45 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/pocl \
46 -DWITH_LLVM_CONFIG=/usr/lib/llvm-18/bin/llvm-config -DSTATIC_LLVM=OFF -DENABLE_LLVM=ON \
47 -DENABLE_ICD=ON -DPOCL_ICD_ABSOLUTE_PATH=ON -DENABLE_SPIRV=ON \
48 -DENABLE_HOST_CPU_DEVICES=ON -DLLC_HOST_CPU=generic -DENABLE_HWLOC=OFF \
49 -DENABLE_RELOCATION=ON -DENABLE_POCLCC=ON -DENABLE_TESTS=OFF -DENABLE_EXAMPLES=OFF
50 cmake --build "$RUNNER_TEMP/pocl-build" --parallel "$(nproc)"
51 sudo cmake --install "$RUNNER_TEMP/pocl-build"
52
53 - name: Self-test with the demo kernel
54 run: |
55 sh tools/fetch.sh omega
56 . ./toolchain.lock
57 POCL_LIBRARY="/opt/pocl/$POCL_LIB" sh tools/check.sh
58
59 - name: Package (reproducible tar) and hash
60 run: |
61 . ./toolchain.lock
62 name=${POCL_ASSET%.tar.gz}
63 mkdir -p dist
64 tar --sort=name --mtime=@0 --owner=0 --group=0 --numeric-owner \
65 --transform "s|^opt/pocl|$name|" -C / -cf - opt/pocl | gzip -n -9 > "dist/$POCL_ASSET"
66 (cd dist && sha256sum "$POCL_ASSET" > "$POCL_ASSET.sha256")
67 cat "dist/$POCL_ASSET.sha256" | tee -a "$GITHUB_STEP_SUMMARY"
68 printf 'POCL_COMMIT=%s\nLLVM=%s\n' "$POCL_COMMIT" "$(/usr/lib/llvm-18/bin/llvm-config --version)" >> "$GITHUB_STEP_SUMMARY"
69
70 - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
71 with:
72 name: pocl-asset
73 path: dist/
74
75 - name: Publish release asset
76 if: inputs.publish
77 env:
78 GH_TOKEN: ${{ github.token }}
79 run: |
80 . ./toolchain.lock
81 gh release view "$POCL_TAG" > /dev/null 2>&1 ||
82 gh release create "$POCL_TAG" --target "$GITHUB_SHA" --title "PoCL 7.2 @ ${POCL_COMMIT%${POCL_COMMIT#????????}} for ubuntu-24.04-arm" \
83 --notes "PoCL CPU OpenCL runtime built from pocl/pocl@$POCL_COMMIT against Ubuntu 24.04 LLVM 18 by run $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID. CPU device only; used by tools/check.sh to run SPIR-V on the CPU. sha256 in the .sha256 asset and in toolchain.lock."
84 gh release upload "$POCL_TAG" "dist/$POCL_ASSET" "dist/$POCL_ASSET.sha256"