|
| 1 | +name: Linux MLIR Build |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + inputs: |
| 5 | + os: |
| 6 | + description: 'OS that is used for building in the form of "ubuntu_20_04"' |
| 7 | + type: string |
| 8 | + required: true |
| 9 | + build-runner: |
| 10 | + description: 'Machine on which the builds will run' |
| 11 | + type: string |
| 12 | + required: true |
| 13 | + openvino-organization: |
| 14 | + description: 'OpenVINO fork owner to clone' |
| 15 | + type: string |
| 16 | + required: true |
| 17 | + openvino-commit: |
| 18 | + description: 'OpenVINO commit to checkout' |
| 19 | + type: string |
| 20 | + required: true |
| 21 | + openvino-cmake-options: |
| 22 | + description: 'A string of options passed to OpenVINO CMake' |
| 23 | + type: string |
| 24 | + required: false |
| 25 | + npu-cmake-options: |
| 26 | + description: 'A string of options passed to NPU Compiler CMake' |
| 27 | + type: string |
| 28 | + required: false |
| 29 | + build-cache: |
| 30 | + description: 'Whether to take previously built OpenVINO/NPU package.' |
| 31 | + type: boolean |
| 32 | + required: false |
| 33 | + default: false |
| 34 | + build-cache-key-suffix: |
| 35 | + description: 'Cache package suffix' |
| 36 | + type: string |
| 37 | + required: false |
| 38 | + with-tests: |
| 39 | + description: 'Whether to build test targets' |
| 40 | + type: boolean |
| 41 | + required: false |
| 42 | + default: false |
| 43 | + openvino-install-artifact: |
| 44 | + description: 'OpenVINO/NPU build package name to be stored as the action artifact' |
| 45 | + type: string |
| 46 | + required: true |
| 47 | + default: false |
| 48 | + |
| 49 | +defaults: |
| 50 | + run: |
| 51 | + shell: bash |
| 52 | + |
| 53 | +permissions: read-all |
| 54 | + |
| 55 | +env: |
| 56 | + OPENVINO_INSTALL_DIR: ./openvino_install |
| 57 | + |
| 58 | +jobs: |
| 59 | + Cache: |
| 60 | + name: Cache |
| 61 | + if: ${{ inputs.build-cache }} |
| 62 | + runs-on: ubuntu-latest |
| 63 | + outputs: |
| 64 | + cache-hit: ${{ steps.restore.outputs.cache-hit }} |
| 65 | + cache-key: ${{ steps.key.outputs.cache_key }} |
| 66 | + steps: |
| 67 | + - name: Get cache key |
| 68 | + id: key |
| 69 | + run: | |
| 70 | + cache_key="l_ov_dyn_${{ inputs.os }}_cache_${{ inputs.build-cache-key-suffix || github.sha }}" |
| 71 | + echo "cache_key=$cache_key" >> $GITHUB_OUTPUT |
| 72 | +
|
| 73 | + - name: Restore OpenVINO/NPU package from cache |
| 74 | + id: restore |
| 75 | + uses: actions/cache/restore@v4 |
| 76 | + with: |
| 77 | + key: ${{ steps.key.outputs.cache_key }} |
| 78 | + path: ${{ env.OPENVINO_INSTALL_DIR }} |
| 79 | + |
| 80 | + - name: Upload artifacts |
| 81 | + if: ${{ steps.restore.outputs.cache-hit }} |
| 82 | + uses: actions/upload-artifact@v4 |
| 83 | + with: |
| 84 | + path: ${{ env.OPENVINO_INSTALL_DIR }} |
| 85 | + name: ${{ inputs.openvino-install-artifact }} |
| 86 | + |
| 87 | + Build: |
| 88 | + name: Build |
| 89 | + needs: Cache |
| 90 | + if: ${{ always() && needs.Cache.outputs.cache-hit != 'true' }} |
| 91 | + runs-on: ${{ inputs.build-runner }} |
| 92 | + timeout-minutes: 240 |
| 93 | + env: |
| 94 | + DEBIAN_FRONTEND: noninteractive |
| 95 | + CMAKE_BUILD_TYPE: 'Release' |
| 96 | + OPENVINO_REPO: ./openvino |
| 97 | + NPU_COMPILER_REPO: ./npu_compiler |
| 98 | + OPENVINO_BUILD_DIR: ./openvino_build |
| 99 | + NPU_COMPILER_BUILD_DIR: ./npu_compiler_build |
| 100 | + steps: |
| 101 | + - name: Clone OpenVINO |
| 102 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 103 | + timeout-minutes: 15 |
| 104 | + with: |
| 105 | + repository: ${{ inputs.openvino-organization }}/openvino |
| 106 | + path: ${{ env.OPENVINO_REPO }} |
| 107 | + submodules: true |
| 108 | + ref: ${{ inputs.openvino-commit }} |
| 109 | + |
| 110 | + - name: Clone NPU Compiler |
| 111 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 112 | + timeout-minutes: 15 |
| 113 | + with: |
| 114 | + path: ${{ env.NPU_COMPILER_REPO }} |
| 115 | + submodules: true |
| 116 | + lfs: true |
| 117 | + |
| 118 | + - name: System info |
| 119 | + uses: openvinotoolkit/openvino/.github/actions/system_info@master |
| 120 | + |
| 121 | + - name: Install python dependencies |
| 122 | + run: | |
| 123 | + python3 -m pip install -r ${OPENVINO_REPO}/src/bindings/python/wheel/requirements-dev.txt |
| 124 | + python3 -m pip install -r ${OPENVINO_REPO}/src/frontends/onnx/tests/requirements.txt |
| 125 | + python3 -m pip install -r ${OPENVINO_REPO}/src/frontends/tensorflow/tests/requirements.txt |
| 126 | + python3 -m pip install -r ${OPENVINO_REPO}/src/frontends/tensorflow_lite/tests/requirements.txt |
| 127 | + python3 -m pip install -r ${OPENVINO_REPO}/src/frontends/paddle/tests/requirements.txt |
| 128 | +
|
| 129 | + - name: Prepare environment |
| 130 | + run: | |
| 131 | + if [[ "${{ inputs.with-tests }}" == "true" ]]; then |
| 132 | + echo "ENABLE_TESTS_FLAG=ON" >> $GITHUB_ENV |
| 133 | + else |
| 134 | + echo "ENABLE_TESTS_FLAG=OFF" >> $GITHUB_ENV |
| 135 | + fi |
| 136 | +
|
| 137 | + - name: CMake configure - OpenVINO |
| 138 | + run: | |
| 139 | + cmake \ |
| 140 | + ${{ inputs.openvino-cmake-options }} \ |
| 141 | + -G "Ninja Multi-Config" \ |
| 142 | + -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} \ |
| 143 | + -DENABLE_LTO=OFF \ |
| 144 | + -DENABLE_TESTS=${{ env.ENABLE_TESTS_FLAG }} \ |
| 145 | + -DENABLE_INTEL_CPU=ON \ |
| 146 | + -DENABLE_INTEL_GPU=ON \ |
| 147 | + -DENABLE_INTEL_NPU=ON \ |
| 148 | + -DENABLE_IMD_BACKEND=OFF \ |
| 149 | + -DENABLE_ONEDNN_FOR_GPU=OFF \ |
| 150 | + -DENABLE_AUTO=ON \ |
| 151 | + -DENABLE_AUTO_BATCH=ON \ |
| 152 | + -DENABLE_HETERO=ON \ |
| 153 | + -DENABLE_MULTI=ON \ |
| 154 | + -DENABLE_TEMPLATE=ON \ |
| 155 | + -DENABLE_OV_ONNX_FRONTEND=ON \ |
| 156 | + -DENABLE_OV_PADDLE_FRONTEND=ON \ |
| 157 | + -DENABLE_OV_TF_FRONTEND=ON \ |
| 158 | + -DENABLE_OV_TF_LITE_FRONTEND=OFF \ |
| 159 | + -DENABLE_OV_IR_FRONTEND=ON \ |
| 160 | + -DENABLE_MLIR_COMPILER=ON \ |
| 161 | + -DENABLE_PLUGINS_XML=ON \ |
| 162 | + -DENABLE_PYTHON=ON \ |
| 163 | + -DENABLE_WHEEL=ON \ |
| 164 | + -DENABLE_TBBBIND_2_5=ON \ |
| 165 | + -DENABLE_DEBUG_CAPS=ON \ |
| 166 | + -DENABLE_NPU_DEBUG_CAPS=ON \ |
| 167 | + -DENABLE_SANITIZER=OFF \ |
| 168 | + -DENABLE_THREAD_SANITIZER=OFF \ |
| 169 | + -DENABLE_UB_SANITIZER=OFF \ |
| 170 | + -S ${OPENVINO_REPO} \ |
| 171 | + -B ${OPENVINO_BUILD_DIR} |
| 172 | +
|
| 173 | + - name: Cmake build - OpenVINO |
| 174 | + run: | |
| 175 | + cmake --build ${OPENVINO_BUILD_DIR} --parallel $(nproc) --config ${{ env.CMAKE_BUILD_TYPE }} |
| 176 | +
|
| 177 | + - name: Cmake install - OpenVINO |
| 178 | + run: | |
| 179 | + cmake --install ${OPENVINO_BUILD_DIR} --config ${{ env.CMAKE_BUILD_TYPE }} --prefix ${OPENVINO_INSTALL_DIR} |
| 180 | + cmake --install ${OPENVINO_BUILD_DIR} --config ${{ env.CMAKE_BUILD_TYPE }} --prefix ${OPENVINO_INSTALL_DIR} --component python_wheels |
| 181 | + cmake --install ${OPENVINO_BUILD_DIR} --config ${{ env.CMAKE_BUILD_TYPE }} --prefix ${OPENVINO_INSTALL_DIR} --component tests |
| 182 | + cmake --install ${OPENVINO_BUILD_DIR} --config ${{ env.CMAKE_BUILD_TYPE }} --prefix ${OPENVINO_INSTALL_DIR} --component developer_package |
| 183 | +
|
| 184 | + - name: CMake configure - NPU Compiler |
| 185 | + run: | |
| 186 | + cmake \ |
| 187 | + ${{ inputs.npu-cmake-options }} \ |
| 188 | + -G "Ninja Multi-Config" \ |
| 189 | + -DCMAKE_BUILD_TYPE=${{ env.CMAKE_BUILD_TYPE }} \ |
| 190 | + -DOpenVINODeveloperPackage_DIR=$(realpath ${OPENVINO_BUILD_DIR}) \ |
| 191 | + -DENABLE_TESTS=${{ env.ENABLE_TESTS_FLAG }} \ |
| 192 | + -DENABLE_DEVELOPER_BUILD=OFF \ |
| 193 | + -DENABLE_MLIR_COMPILER=ON \ |
| 194 | + -DBUILD_COMPILER_FOR_DRIVER=OFF \ |
| 195 | + -DENABLE_DRIVER_COMPILER_ADAPTER=ON \ |
| 196 | + -DENABLE_SOURCE_PACKAGE=OFF \ |
| 197 | + -S ${NPU_COMPILER_REPO} \ |
| 198 | + -B ${NPU_COMPILER_BUILD_DIR} |
| 199 | +
|
| 200 | + - name: Cmake build - NPU Compiler |
| 201 | + run: | |
| 202 | + cmake --build ${NPU_COMPILER_BUILD_DIR} --parallel $(nproc) --config ${{ env.CMAKE_BUILD_TYPE }} |
| 203 | +
|
| 204 | + - name: Cmake install - NPU Compiler |
| 205 | + run: | |
| 206 | + cmake --install ${NPU_COMPILER_BUILD_DIR} --config ${{ env.CMAKE_BUILD_TYPE }} --prefix ${OPENVINO_INSTALL_DIR} |
| 207 | + cmake --install ${NPU_COMPILER_BUILD_DIR} --config ${{ env.CMAKE_BUILD_TYPE }} --prefix ${OPENVINO_INSTALL_DIR} --component tests |
| 208 | +
|
| 209 | + - name: Cache artifacts |
| 210 | + if: ${{ inputs.build-cache }} |
| 211 | + uses: actions/cache/save@v4 |
| 212 | + with: |
| 213 | + path: ${{ env.OPENVINO_INSTALL_DIR }} |
| 214 | + key: ${{ needs.Cache.outputs.cache-key }} |
| 215 | + |
| 216 | + - name: Upload artifacts |
| 217 | + id: save_artifact |
| 218 | + uses: actions/upload-artifact@v4 |
| 219 | + with: |
| 220 | + path: ${{ env.OPENVINO_INSTALL_DIR }} |
| 221 | + name: ${{ inputs.openvino-install-artifact }} |
0 commit comments