|
| 1 | +# Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. |
| 2 | +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 3 | + |
| 4 | +name: compilation on hexagon (qemu user-mode) |
| 5 | + |
| 6 | +on: |
| 7 | + pull_request: |
| 8 | + types: |
| 9 | + - opened |
| 10 | + - synchronize |
| 11 | + paths: |
| 12 | + - ".github/workflows/build_llvm_libraries.yml" |
| 13 | + - ".github/workflows/compilation_on_hexagon.yml" |
| 14 | + - "build-scripts/**" |
| 15 | + - "core/**" |
| 16 | + - "!core/deps/**" |
| 17 | + - "product-mini/**" |
| 18 | + - "tests/wamr-test-suites/**" |
| 19 | + - "wamr-compiler/**" |
| 20 | + push: |
| 21 | + branches: |
| 22 | + - main |
| 23 | + - "dev/**" |
| 24 | + paths: |
| 25 | + - ".github/workflows/build_llvm_libraries.yml" |
| 26 | + - ".github/workflows/compilation_on_hexagon.yml" |
| 27 | + - "build-scripts/**" |
| 28 | + - "core/**" |
| 29 | + - "!core/deps/**" |
| 30 | + - "product-mini/**" |
| 31 | + - "tests/wamr-test-suites/**" |
| 32 | + - "wamr-compiler/**" |
| 33 | + workflow_dispatch: |
| 34 | + |
| 35 | +# Cancel any in-flight jobs for the same PR/branch so there's only one active |
| 36 | +# at a time |
| 37 | +concurrency: |
| 38 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 39 | + cancel-in-progress: true |
| 40 | + |
| 41 | +permissions: |
| 42 | + contents: read |
| 43 | + |
| 44 | +jobs: |
| 45 | + build_llvm_libraries: |
| 46 | + permissions: |
| 47 | + contents: read |
| 48 | + actions: write |
| 49 | + uses: ./.github/workflows/build_llvm_libraries.yml |
| 50 | + with: |
| 51 | + os: "ubuntu-22.04" |
| 52 | + arch: "X86 Hexagon" |
| 53 | + |
| 54 | + build_wamrc: |
| 55 | + needs: [build_llvm_libraries] |
| 56 | + runs-on: ubuntu-22.04 |
| 57 | + steps: |
| 58 | + - name: checkout |
| 59 | + uses: actions/checkout@v6.0.2 |
| 60 | + |
| 61 | + - name: Get LLVM libraries |
| 62 | + id: retrieve_llvm_libs |
| 63 | + uses: actions/cache@v5 |
| 64 | + with: |
| 65 | + path: | |
| 66 | + ./core/deps/llvm/build/bin |
| 67 | + ./core/deps/llvm/build/include |
| 68 | + ./core/deps/llvm/build/lib |
| 69 | + ./core/deps/llvm/build/libexec |
| 70 | + ./core/deps/llvm/build/share |
| 71 | + key: ${{ needs.build_llvm_libraries.outputs.cache_key }} |
| 72 | + |
| 73 | + - name: Quit if cache miss |
| 74 | + if: steps.retrieve_llvm_libs.outputs.cache-hit != 'true' |
| 75 | + run: echo "::error::can not get prebuilt llvm libraries" && exit 1 |
| 76 | + |
| 77 | + - name: Build wamrc |
| 78 | + run: | |
| 79 | + mkdir build && cd build |
| 80 | + cmake .. -DCMAKE_BUILD_TYPE=Release |
| 81 | + cmake --build . --config Release --parallel $(nproc) |
| 82 | + working-directory: wamr-compiler |
| 83 | + |
| 84 | + - name: Upload wamrc |
| 85 | + uses: actions/upload-artifact@v7.0.1 |
| 86 | + with: |
| 87 | + name: wamrc-hexagon |
| 88 | + path: wamr-compiler/build/wamrc |
| 89 | + |
| 90 | + build_iwasm: |
| 91 | + runs-on: ubuntu-22.04 |
| 92 | + steps: |
| 93 | + - name: checkout |
| 94 | + uses: actions/checkout@v6.0.2 |
| 95 | + |
| 96 | + - name: Install QEMU user-mode |
| 97 | + run: sudo apt-get update && sudo apt-get install -y qemu-user |
| 98 | + |
| 99 | + - name: Install clang-22 and lld-22 |
| 100 | + run: | |
| 101 | + wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc |
| 102 | + echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-22 main" | sudo tee /etc/apt/sources.list.d/llvm-22.list |
| 103 | + sudo apt-get update |
| 104 | + sudo apt-get install -y clang-22 lld-22 |
| 105 | +
|
| 106 | + - name: Install CodeLinaro Hexagon toolchain |
| 107 | + run: | |
| 108 | + wget -q https://artifacts.codelinaro.org/artifactory/codelinaro-toolchain-for-hexagon/22.1.4_/hexagon-debs-22.1.4_.tar.gz |
| 109 | + tar xf hexagon-debs-22.1.4_.tar.gz |
| 110 | + sudo dpkg -i hexagon-debs/*.deb |
| 111 | +
|
| 112 | + - name: Cross-compile iwasm for Hexagon |
| 113 | + run: | |
| 114 | + cmake -S product-mini/platforms/hexagon \ |
| 115 | + -B build-hexagon \ |
| 116 | + -DCMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/build-scripts/toolchains/hexagon-linux-musl.cmake \ |
| 117 | + -DCMAKE_BUILD_TYPE=Release \ |
| 118 | + -DWAMR_DISABLE_HW_BOUND_CHECK=1 \ |
| 119 | + -DWAMR_BUILD_SHRUNK_MEMORY=0 \ |
| 120 | + -DWAMR_BUILD_SPEC_TEST=1 \ |
| 121 | + -DWAMR_BUILD_LIBC_WASI=0 |
| 122 | + cmake --build build-hexagon --parallel $(nproc) |
| 123 | +
|
| 124 | + - name: Verify iwasm binary |
| 125 | + run: | |
| 126 | + file build-hexagon/iwasm |
| 127 | + qemu-hexagon build-hexagon/iwasm --version |
| 128 | +
|
| 129 | + - name: Upload iwasm |
| 130 | + uses: actions/upload-artifact@v7.0.1 |
| 131 | + with: |
| 132 | + name: iwasm-hexagon |
| 133 | + path: build-hexagon/iwasm |
| 134 | + |
| 135 | + spec_test: |
| 136 | + needs: [build_iwasm, build_wamrc] |
| 137 | + runs-on: ubuntu-22.04 |
| 138 | + strategy: |
| 139 | + fail-fast: false |
| 140 | + matrix: |
| 141 | + test_option: |
| 142 | + - "-s spec -b -P" |
| 143 | + - "-s spec -b -S -P" |
| 144 | + running_mode: |
| 145 | + - "classic-interp" |
| 146 | + - "fast-interp" |
| 147 | + - "aot" |
| 148 | + exclude: |
| 149 | + # SIMD AOT needs further validation |
| 150 | + - test_option: "-s spec -b -S -P" |
| 151 | + running_mode: "aot" |
| 152 | + steps: |
| 153 | + - name: checkout |
| 154 | + uses: actions/checkout@v6.0.2 |
| 155 | + |
| 156 | + - name: Install QEMU user-mode |
| 157 | + run: sudo apt-get update && sudo apt-get install -y qemu-user |
| 158 | + |
| 159 | + - name: Download iwasm artifact |
| 160 | + uses: actions/download-artifact@v4.2.0 |
| 161 | + with: |
| 162 | + name: iwasm-hexagon |
| 163 | + path: ./ |
| 164 | + |
| 165 | + - name: Download wamrc artifact |
| 166 | + if: matrix.running_mode == 'aot' |
| 167 | + uses: actions/download-artifact@v4.2.0 |
| 168 | + with: |
| 169 | + name: wamrc-hexagon |
| 170 | + path: ./ |
| 171 | + |
| 172 | + - name: Set up iwasm wrapper |
| 173 | + run: | |
| 174 | + chmod +x ./iwasm |
| 175 | + # Place the real Hexagon binary at a known path |
| 176 | + mv ./iwasm ./iwasm-hexagon-real |
| 177 | + # Create a wrapper that invokes iwasm via qemu-hexagon user-mode. |
| 178 | + # Place it where test_wamr.sh expects to find it. |
| 179 | + mkdir -p product-mini/platforms/hexagon/build |
| 180 | + printf '#!/bin/sh\nexec qemu-hexagon %s/iwasm-hexagon-real "$@"\n' \ |
| 181 | + "${GITHUB_WORKSPACE}" > product-mini/platforms/hexagon/build/iwasm |
| 182 | + chmod +x product-mini/platforms/hexagon/build/iwasm |
| 183 | + # Verify it works |
| 184 | + product-mini/platforms/hexagon/build/iwasm --version |
| 185 | +
|
| 186 | + - name: Set up wamrc |
| 187 | + if: matrix.running_mode == 'aot' |
| 188 | + run: | |
| 189 | + chmod +x ./wamrc |
| 190 | + mkdir -p wamr-compiler/build |
| 191 | + cp ./wamrc wamr-compiler/build/wamrc |
| 192 | +
|
| 193 | + - name: Run spec tests |
| 194 | + timeout-minutes: 60 |
| 195 | + run: | |
| 196 | + ./test_wamr.sh ${{ matrix.test_option }} \ |
| 197 | + -m HEXAGON \ |
| 198 | + -t ${{ matrix.running_mode }} \ |
| 199 | + -j hexagon \ |
| 200 | + ${{ matrix.running_mode == 'aot' && format('-A {0}/wamr-compiler/build/wamrc', github.workspace) || '' }} |
| 201 | + working-directory: ./tests/wamr-test-suites |
0 commit comments