|
| 1 | +name: CI Linux |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + force_debug_with_tmate: |
| 7 | + type: boolean |
| 8 | + description: 'Run the build with tmate session' |
| 9 | + required: false |
| 10 | + default: false |
| 11 | + debug_with_tmate: |
| 12 | + type: boolean |
| 13 | + description: 'Run the build with a tmate session ONLY in case of failure' |
| 14 | + required: false |
| 15 | + default: false |
| 16 | + release: |
| 17 | + type: boolean |
| 18 | + description: 'Release to latest' |
| 19 | + required: false |
| 20 | + default: false |
| 21 | + pull_request: |
| 22 | + merge_group: |
| 23 | + push: |
| 24 | + branches: |
| 25 | + - amd-staging |
| 26 | + |
| 27 | +concurrency: |
| 28 | + group: ci-build-test-cpp-linux-${{ github.event.number || github.sha }} |
| 29 | + cancel-in-progress: true |
| 30 | + |
| 31 | +jobs: |
| 32 | + build: |
| 33 | + name: Build (linux) |
| 34 | + runs-on: ubuntu-22.04 |
| 35 | + container: |
| 36 | + image: quay.io/pypa/manylinux_2_28_x86_64 |
| 37 | + env: |
| 38 | + GITHUB_SHA: ${{ github.sha }} |
| 39 | + steps: |
| 40 | + - name: Install tmate |
| 41 | + run: dnf install -y epel-release && dnf install -y tmate |
| 42 | + |
| 43 | + - name: Install deps |
| 44 | + run: | |
| 45 | + dnf install -y almalinux-release-devel |
| 46 | + yum install -y elfutils-libelf-devel p7zip p7zip-plugins \ |
| 47 | + sudo ncurses-compat-libs openssh vim-common |
| 48 | +
|
| 49 | + - name: Setup Cpp |
| 50 | + uses: aminya/setup-cpp@v1 |
| 51 | + with: |
| 52 | + compiler: llvm-18 |
| 53 | + cmake: true |
| 54 | + ninja: true |
| 55 | + |
| 56 | + - name: "Checking out repository" |
| 57 | + uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 |
| 58 | + with: |
| 59 | + submodules: recursive |
| 60 | + |
| 61 | + - name: Build and install libnuma |
| 62 | + run: | |
| 63 | + curl --silent -L \ |
| 64 | + https://github.com/numactl/numactl/releases/download/v2.0.18/numactl-2.0.18.tar.gz \ |
| 65 | + -o numactl-2.0.18.tar.gz |
| 66 | + tar -xf numactl-2.0.18.tar.gz |
| 67 | + pushd numactl-2.0.18 |
| 68 | + ./configure |
| 69 | + # i have no idea why this is necessary |
| 70 | + # but without it you get something about "can't cd into dir" |
| 71 | + sed -i '7563s/`cd "$dir" && pwd`/$dir/g' libtool |
| 72 | + make install |
| 73 | + popd |
| 74 | +
|
| 75 | + - name: Hack ROCR |
| 76 | + run: | |
| 77 | + sed -i 's/amdgcn-amd-amdhsa/amdgcn-amd-amdhsa -nogpulib/g' runtime/hsa-runtime/core/runtime/blit_shaders/CMakeLists.txt |
| 78 | + sed -i 's/amdgcn-amd-amdhsa/amdgcn-amd-amdhsa -nogpulib/g' runtime/hsa-runtime/core/runtime/trap_handler/CMakeLists.txt |
| 79 | + sed -i 's/amdgcn-amd-amdhsa/amdgcn-amd-amdhsa -nogpulib/g' runtime/hsa-runtime/image/blit_src/CMakeLists.txt |
| 80 | +
|
| 81 | + - name: Build ROCR distro |
| 82 | + run: | |
| 83 | + rocr_dir="$(cd $GITHUB_WORKSPACE && pwd)" |
| 84 | + build_rocr_dir="$GITHUB_WORKSPACE/rocr-build" |
| 85 | + mkdir -p "$build_rocr_dir" |
| 86 | + build_rocr_dir="$(cd $build_rocr_dir && pwd)" |
| 87 | + rocr_install_dir="$GITHUB_WORKSPACE/rocr-install" |
| 88 | + |
| 89 | + cmake -GNinja \ |
| 90 | + -DCMAKE_BUILD_TYPE=Release \ |
| 91 | + -DCMAKE_INSTALL_PREFIX="$rocr_install_dir" \ |
| 92 | + -DClang_DIR=$HOME/llvm/lib/cmake/clang \ |
| 93 | + -DLLVM_DIR=$HOME/llvm/lib/cmake/llvm \ |
| 94 | + -DIMAGE_SUPPORT=OFF \ |
| 95 | + -S "$rocr_dir" -B "$build_rocr_dir" |
| 96 | + |
| 97 | + cmake --build "$build_rocr_dir" --target install |
| 98 | + tar -cf rocr-${GITHUB_SHA::8}.tar rocr-install |
| 99 | +
|
| 100 | + - name: Upload artifacts |
| 101 | + uses: actions/upload-artifact@v4 |
| 102 | + if: ${{ !cancelled() }} |
| 103 | + with: |
| 104 | + name: linux_x86_64_distro |
| 105 | + path: rocr-*.tar |
| 106 | + if-no-files-found: warn |
| 107 | + |
| 108 | + - name: Setup tmate session |
| 109 | + if: ${{ (failure() && inputs.debug_with_tmate) || inputs.force_debug_with_tmate }} |
| 110 | + |
| 111 | + with: |
| 112 | + limit-access-to-actor: true |
| 113 | + install-dependencies: false |
| 114 | + |
| 115 | + test_aie: |
| 116 | + name: AIE tests |
| 117 | + needs: build |
| 118 | + strategy: |
| 119 | + fail-fast: false |
| 120 | + matrix: |
| 121 | + runs-on: [linux-phoenix] |
| 122 | + runs-on: ${{ matrix.runs-on }} |
| 123 | + steps: |
| 124 | + - name: "Checking out repository" |
| 125 | + uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 |
| 126 | + |
| 127 | + - name: Download artifacts |
| 128 | + uses: actions/download-artifact@v4 |
| 129 | + with: |
| 130 | + name: linux_x86_64_distro |
| 131 | + |
| 132 | + - name: Extract artifact |
| 133 | + run: | |
| 134 | + tar -xf rocr-*.tar |
| 135 | + echo hsa_runtime64_ROOT="$PWD/rocr-install" >> $GITHUB_ENV |
| 136 | +
|
| 137 | + - name: Build and run AIE smoke test |
| 138 | + run: | |
| 139 | + pushd rocrtst/suites/aie |
| 140 | + |
| 141 | + build_dir="$PWD/build" |
| 142 | + mkdir -p $build_dir |
| 143 | + cmake -GNinja \ |
| 144 | + -DCMAKE_BUILD_TYPE=Release \ |
| 145 | + "-Dhsa-runtime64_DIR=$hsa_runtime64_ROOT/lib64/cmake/hsa-runtime64" \ |
| 146 | + -S "$PWD" -B "$build_dir" |
| 147 | + cmake --build "$build_dir" --target aie_hsa_bare_add_one |
| 148 | + |
| 149 | + "$build_dir"/aie_hsa_bare_add_one $PWD |
| 150 | + |
| 151 | + popd |
| 152 | +
|
| 153 | + - name: Build AIE test suite |
| 154 | + run: | |
| 155 | + pushd rocrtst/suites/aie |
| 156 | + |
| 157 | + build_dir="$PWD/build" |
| 158 | + mkdir -p $build_dir |
| 159 | + cmake -GNinja \ |
| 160 | + -DCMAKE_BUILD_TYPE=Release \ |
| 161 | + "-Dhsa-runtime64_DIR=$hsa_runtime64_ROOT/lib64/cmake/hsa-runtime64" \ |
| 162 | + -S "$PWD" -B "$build_dir" |
| 163 | + |
| 164 | + ! cmake --build "$build_dir" --target aie_hsa_dispatch_test |
| 165 | + |
| 166 | + popd |
| 167 | +
|
| 168 | + release: |
| 169 | + name: Release |
| 170 | + if: ${{ inputs.release }} |
| 171 | + needs: [build, test_aie] |
| 172 | + runs-on: ubuntu-22.04 |
| 173 | + permissions: |
| 174 | + id-token: write |
| 175 | + contents: write |
| 176 | + steps: |
| 177 | + - name: Download artifacts |
| 178 | + uses: actions/download-artifact@v4 |
| 179 | + with: |
| 180 | + name: linux_x86_64_distro |
| 181 | + |
| 182 | + - name: Release current commit |
| 183 | + |
| 184 | + with: |
| 185 | + artifacts: rocr-*.tar |
| 186 | + token: "${{ secrets.GITHUB_TOKEN }}" |
| 187 | + tag: "latest" |
| 188 | + name: "latest" |
| 189 | + removeArtifacts: false |
| 190 | + allowUpdates: true |
| 191 | + replacesArtifacts: true |
| 192 | + makeLatest: true |
| 193 | + artifactErrorsFailBuild: true |
0 commit comments