|
| 1 | +name: CI Linux |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + workflow_dispatch: |
| 6 | + pull_request: |
| 7 | + merge_group: |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + |
| 12 | +concurrency: |
| 13 | + # A PR number if a pull request and otherwise the commit hash. This cancels |
| 14 | + # queued and in-progress runs for the same PR (presubmit) or commit |
| 15 | + # (postsubmit). |
| 16 | + group: ci-build-test-cpp-linux-${{ github.event.number || github.sha }} |
| 17 | + cancel-in-progress: true |
| 18 | + |
| 19 | +jobs: |
| 20 | + build: |
| 21 | + name: Build (linux) |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + runs-on: |
| 26 | + - ubuntu-22.04 |
| 27 | +# - nod-ai-shared-cpubuilder-manylinux-x86_64 |
| 28 | + runs-on: ${{ matrix.runs-on }} |
| 29 | + env: |
| 30 | + CACHE_DIR: ${{ github.workspace }}/.container-cache |
| 31 | + CACHE_KEY: linux-build-manylinux-v1-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }} |
| 32 | + steps: |
| 33 | + - name: Install tmate |
| 34 | + if: ${{ matrix.runs-on == 'nod-ai-shared-cpubuilder-manylinux-x86_64' }} |
| 35 | + run: dnf install -y epel-release && dnf install -y tmate |
| 36 | + |
| 37 | + - name: Set unified TZ |
| 38 | + |
| 39 | + with: |
| 40 | + # this is an arbitrary choice |
| 41 | + timezoneLinux: "Asia/Singapore" |
| 42 | + timezoneMacos: "Asia/Singapore" |
| 43 | + timezoneWindows: "Singapore Standard Time" |
| 44 | + |
| 45 | + - name: Configure local git mirrors |
| 46 | + if: ${{ matrix.runs-on == 'nod-ai-shared-cpubuilder-manylinux-x86_64' }} |
| 47 | + run: | |
| 48 | + /gitmirror/scripts/trigger_update_mirrors.sh |
| 49 | + /gitmirror/scripts/git_config.sh |
| 50 | +
|
| 51 | + - name: Install deps |
| 52 | + if: ${{ matrix.runs-on == 'nod-ai-shared-cpubuilder-manylinux-x86_64' }} |
| 53 | + run: | |
| 54 | + dnf install -y almalinux-release-devel |
| 55 | + yum install -y elfutils-libelf-devel p7zip p7zip-plugins |
| 56 | +
|
| 57 | + - name: Install deps |
| 58 | + if: ${{ matrix.runs-on == 'ubuntu-22.04' }} |
| 59 | + run: | |
| 60 | + sudo apt install -y libelf-dev libnuma-dev libdrm-dev |
| 61 | +
|
| 62 | + - name: Setup Cpp |
| 63 | + if: ${{ matrix.runs-on == 'ubuntu-22.04' }} |
| 64 | + uses: aminya/setup-cpp@v1 |
| 65 | + with: |
| 66 | + compiler: llvm-18 |
| 67 | + cmake: true |
| 68 | + ninja: true |
| 69 | + ccache: true |
| 70 | + |
| 71 | + - name: "Checking out repository" |
| 72 | + uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 |
| 73 | + with: |
| 74 | + submodules: recursive |
| 75 | + |
| 76 | + - name: Enable cache |
| 77 | + uses: actions/cache/restore@v3 |
| 78 | + with: |
| 79 | + path: ${{ env.CACHE_DIR }} |
| 80 | + key: ${{ env.CACHE_KEY }} |
| 81 | + restore-keys: linux-build- |
| 82 | + |
| 83 | + - name: Configure ccache |
| 84 | + run: | |
| 85 | + export cache_dir="${{ env.CACHE_DIR }}" |
| 86 | + if [ -z "${cache_dir}" ]; then |
| 87 | + cache_dir="${{ github.workspace }}/.build-cache" |
| 88 | + mkdir -p "${cache_dir}" |
| 89 | + cache_dir="$(cd ${cache_dir} && pwd)" |
| 90 | + fi |
| 91 | + echo "Caching to ${cache_dir}" |
| 92 | + mkdir -p "${cache_dir}/ccache" |
| 93 | + export CCACHE_DIR="${cache_dir}/ccache" >> $GITHUB_ENV |
| 94 | + export CCACHE_MAXSIZE="700M" >> $GITHUB_ENV |
| 95 | + export CMAKE_C_COMPILER_LAUNCHER=ccache >> $GITHUB_ENV |
| 96 | + export CMAKE_CXX_COMPILER_LAUNCHER=ccache >> $GITHUB_ENV |
| 97 | + export CCACHE_COMPILERCHECK="string:$(clang --version)" >> $GITHUB_ENV |
| 98 | +
|
| 99 | + - name: Build and install libnuma |
| 100 | + if: ${{ matrix.runs-on == 'nod-ai-shared-cpubuilder-manylinux-x86_64' }} |
| 101 | + run: | |
| 102 | + curl --silent -L \ |
| 103 | + https://github.com/numactl/numactl/releases/download/v2.0.18/numactl-2.0.18.tar.gz \ |
| 104 | + -o numactl-2.0.18.tar.gz |
| 105 | + tar -xf numactl-2.0.18.tar.gz |
| 106 | + pushd numactl-2.0.18 |
| 107 | + ./configure |
| 108 | + make install |
| 109 | + popd |
| 110 | +
|
| 111 | + - name: Hack ROCR |
| 112 | + run: | |
| 113 | + sed -i 's/amdgcn-amd-amdhsa/amdgcn-amd-amdhsa -nogpulib/g' runtime/hsa-runtime/core/runtime/blit_shaders/CMakeLists.txt |
| 114 | + sed -i 's/amdgcn-amd-amdhsa/amdgcn-amd-amdhsa -nogpulib/g' runtime/hsa-runtime/core/runtime/trap_handler/CMakeLists.txt |
| 115 | + sed -i 's/amdgcn-amd-amdhsa/amdgcn-amd-amdhsa -nogpulib/g' runtime/hsa-runtime/image/blit_src/CMakeLists.txt |
| 116 | +
|
| 117 | + - name: Build ROCR distro |
| 118 | + run: | |
| 119 | + rocr_dir="$(cd ${{ github.workspace }} && pwd)" |
| 120 | + build_rocr_dir="${{ github.workspace }}/rocr-build" |
| 121 | + mkdir -p "$build_rocr_dir" |
| 122 | + build_rocr_dir="$(cd $build_rocr_dir && pwd)" |
| 123 | + rocr_install_dir="${{ github.workspace }}/rocr-install" |
| 124 | + |
| 125 | + cmake -GNinja \ |
| 126 | + -DCMAKE_BUILD_TYPE=Release \ |
| 127 | + -DCMAKE_INSTALL_PREFIX="$rocr_install_dir" \ |
| 128 | + -DClang_DIR=/usr/lib/llvm-18/lib/cmake/clang \ |
| 129 | + -DLLVM_DIR=/usr/lib/llvm-18/lib/cmake/llvm \ |
| 130 | + -DIMAGE_SUPPORT=OFF \ |
| 131 | + -S "$rocr_dir" -B "$build_rocr_dir" |
| 132 | + cmake --build "$build_rocr_dir" --target install |
| 133 | +
|
| 134 | + - name: Create artifacts |
| 135 | + if: ${{ !cancelled() }} |
| 136 | + run: | |
| 137 | + tar -cf rocr-$(git rev-parse --short HEAD).tar -C rocr-install * |
| 138 | + ls -l |
| 139 | +
|
| 140 | + - name: Upload artifacts |
| 141 | + uses: actions/upload-artifact@v4 |
| 142 | + if: ${{ !cancelled() }} |
| 143 | + with: |
| 144 | + name: linux_x86_64_distro |
| 145 | + path: rocr-*.tar |
| 146 | + if-no-files-found: warn |
| 147 | + |
| 148 | + - name: Save cache |
| 149 | + uses: actions/cache/save@v3 |
| 150 | + if: ${{ !cancelled() }} |
| 151 | + with: |
| 152 | + path: ${{ env.CACHE_DIR }} |
| 153 | + key: ${{ env.CACHE_KEY }} |
| 154 | + |
| 155 | + - name: Setup tmate session |
| 156 | + if: ${{ failure() }} |
| 157 | + |
| 158 | + with: |
| 159 | + limit-access-to-actor: true |
| 160 | + install-dependencies: ${{ matrix.runs-on == 'ubuntu-22.04' }} |
| 161 | + |
| 162 | + test_aie: |
| 163 | + name: AIE tests |
| 164 | + needs: build |
| 165 | + strategy: |
| 166 | + fail-fast: false |
| 167 | + matrix: |
| 168 | + runs-on: [linux-phoenix] |
| 169 | + runs-on: ${{ matrix.runs-on }} |
| 170 | + steps: |
| 171 | + - name: "Checking out repository" |
| 172 | + uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 |
| 173 | + |
| 174 | + - name: Download artifacts |
| 175 | + uses: actions/download-artifact@v4 |
| 176 | + with: |
| 177 | + name: linux_x86_64_distro |
| 178 | + |
| 179 | + - name: Extract artifact |
| 180 | + run: | |
| 181 | + mkdir -p rocr-install |
| 182 | + tar -xf rocr-*.tar -C rocr-install |
| 183 | + export hsa_runtime64_ROOT="$PWD/rocr-install" >> $GITHUB_ENV |
| 184 | +
|
| 185 | + - name: Build AIE test suite |
| 186 | + run: | |
| 187 | + pushd rocrtst/suites/aie |
| 188 | + build_dir="$PWD/build" |
| 189 | + mkdir -p $build_dir |
| 190 | + cmake -GNinja \ |
| 191 | + -DCMAKE_BUILD_TYPE=Release \ |
| 192 | + -Dhsa_runtime64_ROOT="${hsa_runtime64_ROOT}" \ |
| 193 | + -S "$PWD" -B "$build_dir" |
| 194 | + cmake --build "$build_dir" --target \ |
| 195 | + aie_hsa_bare_add_one \ |
| 196 | + aie_hsa_dispatch_test |
| 197 | + popd |
| 198 | +
|
| 199 | + - name: Run AIE test suite |
| 200 | + run: | |
| 201 | + pushd rocrtst/suites/aie |
| 202 | + build_dir="$PWD/build" |
| 203 | + ./"$build_dir"/aie_hsa_bare_add_one $PWD |
| 204 | + ./"$build_dir"/aie_hsa_dispatch_test $PWD |
0 commit comments