|
| 1 | +name: Linux NPU CiD Build |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + os: |
| 7 | + description: 'OS that is used for building in the form of "ubuntu_20_04"' |
| 8 | + type: string |
| 9 | + required: true |
| 10 | + build-runner: |
| 11 | + description: 'Machine on which the builds will run' |
| 12 | + type: string |
| 13 | + required: true |
| 14 | + openvino-cmake-options: |
| 15 | + description: 'Extra OpenVINO CMake options (appended last)' |
| 16 | + type: string |
| 17 | + required: false |
| 18 | + build-cache: |
| 19 | + description: 'Cache produced CiD artifact directory' |
| 20 | + type: boolean |
| 21 | + required: false |
| 22 | + default: false |
| 23 | + build-cache-key-suffix: |
| 24 | + description: 'Cache key suffix' |
| 25 | + type: string |
| 26 | + required: false |
| 27 | + tbb-root: |
| 28 | + description: 'Custom TBB root (optional). If set, passed as -DTBBROOT=' |
| 29 | + type: string |
| 30 | + required: false |
| 31 | + publish-release-assets: |
| 32 | + description: 'The workflow will find a release tag associated with the commit and push the release asset.' |
| 33 | + type: boolean |
| 34 | + required: false |
| 35 | + default: false |
| 36 | + outputs: |
| 37 | + build-package: |
| 38 | + description: 'Produced CiD artifact name (uploaded artifact)' |
| 39 | + value: ${{ jobs.Build.outputs.build-package }} |
| 40 | + secrets: |
| 41 | + release_token: |
| 42 | + description: 'PAT with Contents: read/write' |
| 43 | + required: false |
| 44 | + |
| 45 | +defaults: |
| 46 | + run: |
| 47 | + shell: bash |
| 48 | + |
| 49 | +permissions: |
| 50 | + actions: read |
| 51 | + contents: read |
| 52 | + packages: read |
| 53 | + statuses: read |
| 54 | + |
| 55 | +jobs: |
| 56 | + Build: |
| 57 | + name: Build |
| 58 | + runs-on: ${{ inputs.build-runner }} |
| 59 | + timeout-minutes: 240 |
| 60 | + permissions: |
| 61 | + actions: read |
| 62 | + contents: read |
| 63 | + packages: read |
| 64 | + statuses: read |
| 65 | + outputs: |
| 66 | + build-package: ${{ steps.set-build-package-name.outputs.build-package }} |
| 67 | + env: |
| 68 | + DEBIAN_FRONTEND: noninteractive |
| 69 | + CMAKE_BUILD_TYPE: Release |
| 70 | + OPENVINO_REPO: ./openvino |
| 71 | + NPU_ACTIONS_DIR: ./npu_actions |
| 72 | + NPU_COMPILER_REPO: ./npu_compiler |
| 73 | + OPENVINO_BUILD_DIR: ./openvino_build |
| 74 | + CID_PACKAGE_ARTIFACTS_DIR: ./cid_artifacts |
| 75 | + CID_PACKAGE_BASE_NAME: l_cid_${{ inputs.os }}_${{ github.sha }} |
| 76 | + CID_PACKAGE_FULL_NAME: l_cid_${{ inputs.os }}_${{ github.sha }}.tar.gz |
| 77 | + |
| 78 | + steps: |
| 79 | + - name: Prepare artifact dir |
| 80 | + run: mkdir -p "${CID_PACKAGE_ARTIFACTS_DIR}" |
| 81 | + |
| 82 | + - name: Get cache key |
| 83 | + if: ${{ inputs.build-cache }} |
| 84 | + id: cache-key |
| 85 | + run: | |
| 86 | + cache_key="l_cid_${{ inputs.os }}_cache_${{ inputs.build-cache-key-suffix || github.sha }}" |
| 87 | + echo "cache-key=$cache_key" >> $GITHUB_OUTPUT |
| 88 | +
|
| 89 | + - name: Restore CiD artifacts from cache |
| 90 | + if: ${{ inputs.build-cache }} |
| 91 | + id: cache-restore |
| 92 | + uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 |
| 93 | + with: |
| 94 | + key: ${{ steps.cache-key.outputs.cache-key }} |
| 95 | + path: ${{ env.CID_PACKAGE_ARTIFACTS_DIR }} |
| 96 | + |
| 97 | + - name: Checkout versions action |
| 98 | + if: ${{ !steps.cache-restore.outputs.cache-hit }} |
| 99 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 100 | + with: |
| 101 | + path: ${{ env.NPU_ACTIONS_DIR }} |
| 102 | + sparse-checkout: | |
| 103 | + .github/actions/versions |
| 104 | + sparse-checkout-cone-mode: false |
| 105 | + |
| 106 | + - name: Get versions |
| 107 | + if: ${{ !steps.cache-restore.outputs.cache-hit }} |
| 108 | + uses: ./npu_actions/.github/actions/versions |
| 109 | + id: versions |
| 110 | + |
| 111 | + - name: Clone OpenVINO |
| 112 | + if: ${{ !steps.cache-restore.outputs.cache-hit }} |
| 113 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 114 | + timeout-minutes: 15 |
| 115 | + with: |
| 116 | + repository: ${{ steps.versions.outputs.openvino-repository }} |
| 117 | + path: ${{ env.OPENVINO_REPO }} |
| 118 | + submodules: true |
| 119 | + ref: ${{ steps.versions.outputs.openvino-sha }} |
| 120 | + |
| 121 | + - name: Checkout NPU Compiler |
| 122 | + if: ${{ !steps.cache-restore.outputs.cache-hit }} |
| 123 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 124 | + with: |
| 125 | + path: ${{ env.NPU_COMPILER_REPO }} |
| 126 | + submodules: true |
| 127 | + lfs: true |
| 128 | + |
| 129 | + - name: System info |
| 130 | + if: ${{ !steps.cache-restore.outputs.cache-hit }} |
| 131 | + uses: openvinotoolkit/openvino/.github/actions/system_info@c01cd93e24d1cd78bfbb401eed51c08fb93e0816 # 2025.2.0 |
| 132 | + |
| 133 | + - name: Install python deps |
| 134 | + if: ${{ !steps.cache-restore.outputs.cache-hit }} |
| 135 | + run: | |
| 136 | + python3 -m pip install --require-hashes -r ${NPU_COMPILER_REPO}/.github/requirements-dev.txt |
| 137 | +
|
| 138 | + - name: Prepare environment |
| 139 | + if: ${{ !steps.cache-restore.outputs.cache-hit }} |
| 140 | + env: |
| 141 | + TBB_ROOT_OPT: ${{ inputs.tbb-root }} |
| 142 | + run: | |
| 143 | + if [[ -n "${TBB_ROOT_OPT}" ]]; then |
| 144 | + echo "EXTRA_OPTS=-DTBBROOT=${TBB_ROOT_OPT}" >> "$GITHUB_ENV" |
| 145 | + else |
| 146 | + echo "EXTRA_OPTS=" >> "$GITHUB_ENV" |
| 147 | + fi |
| 148 | +
|
| 149 | + - name: CMake configure - OpenVINO + NPU |
| 150 | + if: ${{ !steps.cache-restore.outputs.cache-hit }} |
| 151 | + run: | |
| 152 | + cmake \ |
| 153 | + -G Ninja \ |
| 154 | + -D CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ |
| 155 | + -D BUILD_SHARED_LIBS=OFF \ |
| 156 | + -D OPENVINO_EXTRA_MODULES=$(realpath ${NPU_COMPILER_REPO}) \ |
| 157 | + -D ENABLE_LTO=OFF \ |
| 158 | + -D ENABLE_FASTER_BUILD=OFF \ |
| 159 | + -D ENABLE_CPPLINT=OFF \ |
| 160 | + -D ENABLE_TESTS=OFF \ |
| 161 | + -D ENABLE_FUNCTIONAL_TESTS=OFF \ |
| 162 | + -D ENABLE_SAMPLES=OFF \ |
| 163 | + -D ENABLE_JS=OFF \ |
| 164 | + -D ENABLE_PYTHON=OFF \ |
| 165 | + -D ENABLE_PYTHON_PACKAGING=OFF \ |
| 166 | + -D ENABLE_WHEEL=OFF \ |
| 167 | + -D ENABLE_OV_ONNX_FRONTEND=OFF \ |
| 168 | + -D ENABLE_OV_PYTORCH_FRONTEND=OFF \ |
| 169 | + -D ENABLE_OV_PADDLE_FRONTEND=OFF \ |
| 170 | + -D ENABLE_OV_TF_FRONTEND=OFF \ |
| 171 | + -D ENABLE_OV_TF_LITE_FRONTEND=OFF \ |
| 172 | + -D ENABLE_OV_JAX_FRONTEND=OFF \ |
| 173 | + -D ENABLE_OV_IR_FRONTEND=ON \ |
| 174 | + -D THREADING=TBB \ |
| 175 | + -D ENABLE_TBBBIND_2_5=OFF \ |
| 176 | + -D ENABLE_SYSTEM_TBB=OFF \ |
| 177 | + -D ENABLE_TBB_RELEASE_ONLY=OFF \ |
| 178 | + -D ENABLE_HETERO=OFF \ |
| 179 | + -D ENABLE_MULTI=OFF \ |
| 180 | + -D ENABLE_AUTO=OFF \ |
| 181 | + -D ENABLE_AUTO_BATCH=OFF \ |
| 182 | + -D ENABLE_TEMPLATE=OFF \ |
| 183 | + -D ENABLE_PROXY=OFF \ |
| 184 | + -D ENABLE_INTEL_CPU=OFF \ |
| 185 | + -D ENABLE_INTEL_GPU=OFF \ |
| 186 | + -D ENABLE_NPU_PLUGIN_ENGINE=OFF \ |
| 187 | + -D ENABLE_DRIVER_COMPILER_ADAPTER=OFF \ |
| 188 | + -D ENABLE_INTEL_NPU_INTERNAL=OFF \ |
| 189 | + -D ENABLE_INTEL_NPU_PROTOPIPE=OFF \ |
| 190 | + -D BUILD_COMPILER_FOR_DRIVER=ON \ |
| 191 | + -D ENABLE_PRIVATE_TESTS=OFF \ |
| 192 | + -D ENABLE_NPU_LSP_SERVER=OFF \ |
| 193 | + ${EXTRA_OPTS} \ |
| 194 | + ${{ inputs.openvino-cmake-options }} \ |
| 195 | + -S ${OPENVINO_REPO} \ |
| 196 | + -B ${OPENVINO_BUILD_DIR} |
| 197 | +
|
| 198 | + - name: CMake build - CiD targets |
| 199 | + if: ${{ !steps.cache-restore.outputs.cache-hit }} |
| 200 | + run: | |
| 201 | + cmake \ |
| 202 | + --build ${OPENVINO_BUILD_DIR} \ |
| 203 | + --parallel $(nproc) \ |
| 204 | + --config ${CMAKE_BUILD_TYPE} \ |
| 205 | + --target npu_driver_compiler compilerTest profilingTest vpuxCompilerL0Test loaderTest |
| 206 | +
|
| 207 | + - name: CMake cpack - CiD target |
| 208 | + if: ${{ !steps.cache-restore.outputs.cache-hit }} |
| 209 | + run: | |
| 210 | + cpack -V \ |
| 211 | + --config "${OPENVINO_BUILD_DIR}/CPackConfig.cmake" \ |
| 212 | + -C "${CMAKE_BUILD_TYPE}" \ |
| 213 | + -G TGZ \ |
| 214 | + -B "${CID_PACKAGE_ARTIFACTS_DIR}" \ |
| 215 | + -D CPACK_COMPONENTS_ALL=CiD \ |
| 216 | + -D CPACK_CMAKE_GENERATOR=Ninja \ |
| 217 | + -D CPACK_PACKAGE_FILE_NAME="${CID_PACKAGE_BASE_NAME}" |
| 218 | +
|
| 219 | + - name: CiD Package renaming |
| 220 | + run: | |
| 221 | + mv "${CID_PACKAGE_ARTIFACTS_DIR}/"*.tar.gz \ |
| 222 | + "${CID_PACKAGE_ARTIFACTS_DIR}/${CID_PACKAGE_FULL_NAME}" |
| 223 | +
|
| 224 | + - name: Cache CiD artifacts |
| 225 | + if: ${{ inputs.build-cache && !steps.cache-restore.outputs.cache-hit }} |
| 226 | + uses: actions/cache/save@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 |
| 227 | + with: |
| 228 | + path: ${{ env.CID_PACKAGE_ARTIFACTS_DIR }} |
| 229 | + key: ${{ steps.cache-key.outputs.cache-key }} |
| 230 | + |
| 231 | + - name: Upload CiD package |
| 232 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 233 | + with: |
| 234 | + path: ${{ env.CID_PACKAGE_ARTIFACTS_DIR }}/${{ env.CID_PACKAGE_FULL_NAME }} |
| 235 | + name: ${{ env.CID_PACKAGE_FULL_NAME }} |
| 236 | + |
| 237 | + - name: Set build package name to outputs |
| 238 | + id: set-build-package-name |
| 239 | + run: | |
| 240 | + echo "build-package=${CID_PACKAGE_FULL_NAME}" >> $GITHUB_OUTPUT |
| 241 | + |
| 242 | + - name: Upload asset to existing release tag |
| 243 | + if: ${{ github.event_name != 'pull_request' && inputs.publish-release-assets }} |
| 244 | + env: |
| 245 | + GITHUB_TOKEN: ${{ secrets.release_token || secrets.RELEASE_WRITER_TOKEN }} |
| 246 | + run: | |
| 247 | + NPU_TAG="${{ steps.versions.outputs.npu-compiler-tag }}" |
| 248 | + CID_ASSET="${CID_PACKAGE_ARTIFACTS_DIR}/${CID_PACKAGE_FULL_NAME}" |
| 249 | +
|
| 250 | + gh release upload "$NPU_TAG" "$CID_ASSET" --clobber |
| 251 | + echo "Uploaded $CID_ASSET to release $NPU_TAG" |
0 commit comments