Skip to content

NPU CiD Build

NPU CiD Build #15

Workflow file for this run

name: NPU CiD Build
on:
workflow_dispatch:
inputs:
os:
description: 'OS in the form of "ubuntu_20_04" or "windows_2022".'
type: string
required: true
default: ubuntu_24_04
build-runner:
description: 'Runner tag on which the builds will run. Example: "ubuntu-latest-32-cores" or "windows-2022-16-core"'
type: string
required: true
default: ubuntu-latest-32-cores
openvino-cmake-options:
description: 'Extra OpenVINO CMake options (appended last, whitespace separated).'
type: string
required: false
build-cache:
description: 'Push packages to cache for the first run, use them in the following runs.'
type: boolean
required: false
default: true
build-cache-key-suffix:
description: 'Cache identifier. Merge commit hash by default.'
type: string
required: false
publish-release-assets:
description: 'Find the release tag associated with the commit and upload release assets.'
type: boolean
required: false
default: false
workflow_call:
inputs:
os:
description: 'OS in the form of "ubuntu_20_04" or "windows_2022".'
type: string
required: true
build-runner:
description: 'Runner tag on which the builds will run. Example: "ubuntu-latest-32-cores" or "windows-2022-16-core"'
type: string
required: true
openvino-cmake-options:
description: 'Extra OpenVINO CMake options (appended last, whitespace separated).'
type: string
required: false
build-cache:
description: 'Push packages to cache for the first run, use them in the following runs.'
type: boolean
required: false
default: false
build-cache-key-suffix:
description: 'Cache identifier. Merge commit hash by default.'
type: string
required: false
tbb-root:
description: 'Custom TBB root (optional). If set, passed as -DTBBROOT='
type: string
required: false
publish-release-assets:
description: 'Find the release tag associated with the commit and upload release assets.'
type: boolean
required: false
default: false
outputs:
build-package:
description: 'Produced CiD artifact name (uploaded artifact)'
value: ${{ jobs.Build.outputs.build-package }}
secrets:
release_token:
description: 'PAT with Contents: read/write'
required: false
defaults:
run:
shell: bash
permissions:
actions: read
contents: read
packages: read
statuses: read
jobs:
Build:
name: Build
runs-on: ${{ inputs.build-runner }}
timeout-minutes: 240
permissions:
actions: read
contents: read
packages: read
statuses: read
id-token: write
attestations: write
outputs:
build-package: ${{ steps.set-build-package-name.outputs.build-package }}
env:
DEBIAN_FRONTEND: noninteractive
IS_WINDOWS: ${{ startsWith(inputs.os, 'windows_') && '1' || '0' }}
CMAKE_BUILD_TYPE: Release
OPENVINO_REPO: ./openvino
NPU_ACTIONS_DIR: ./npu_actions
NPU_COMPILER_REPO: ./npu_compiler
OPENVINO_BUILD_DIR: ./openvino_build
CID_PACKAGE_ARTIFACTS_DIR: ./cid_artifacts
steps:
- name: Dump event info
run: |
echo "Event name: ${{ github.event_name }}"
echo "Full event payload:"
jq . "$GITHUB_EVENT_PATH"
- name: Prepare artifact dir
run: |
cmake -E make_directory "${CID_PACKAGE_ARTIFACTS_DIR}"
- name: Checkout actions
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
path: ${{ env.NPU_ACTIONS_DIR }}
sparse-checkout: |
.github/actions
sparse-checkout-cone-mode: false
- name: Get versions
uses: ./npu_actions/.github/actions/versions
id: versions
- name: Compute packaging params
id: package-params
run: |
if [[ "${{ env.IS_WINDOWS }}" == "1" ]]; then
echo "package-prefix=w" >> $GITHUB_OUTPUT
echo "package-platform-tag=win" >> $GITHUB_OUTPUT
echo "package-extension=zip" >> $GITHUB_OUTPUT
echo "cpack-generator=ZIP" >> $GITHUB_OUTPUT
else
echo "package-prefix=l" >> $GITHUB_OUTPUT
echo "package-platform-tag=linux" >> $GITHUB_OUTPUT
echo "package-extension=tar.gz" >> $GITHUB_OUTPUT
echo "cpack-generator=TGZ" >> $GITHUB_OUTPUT
fi
- name: Get package name
id: package-name
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
CI_CONTEXT="precommit"
else
CI_CONTEXT="postcommit"
fi
TIME_STAMP=$(date +'%y%m%d_%H%M')
BASE_PREFIX="${{ steps.package-params.outputs.package-prefix }}"
PLATFORM="${{ steps.package-params.outputs.package-platform-tag }}"
VERSION="${{ steps.versions.outputs.npu-compiler-version }}"
EXTENSION="${{ steps.package-params.outputs.package-extension }}"
cid_package_base_name="${BASE_PREFIX}_vpux_compiler_l0_${PLATFORM}_${{ inputs.os }}-${VERSION}-"
cid_package_base_name+="${CMAKE_BUILD_TYPE}_dyntbb_${CI_CONTEXT}_cid_${{ github.sha }}_${TIME_STAMP}"
cid_package_full_name="${cid_package_base_name}.${EXTENSION}"
echo "CiD package will be generated with the following name: $cid_package_full_name"
echo "cid-package-base-name=$cid_package_base_name" >> $GITHUB_OUTPUT
echo "cid-package-full-name=$cid_package_full_name" >> $GITHUB_OUTPUT
- name: Get cache key
if: ${{ inputs.build-cache }}
id: cache-key
run: |
BASE_PREFIX="${{ steps.package-params.outputs.package-prefix }}"
cache_key="${BASE_PREFIX}_cid_${{ inputs.os }}_cache_${{ inputs.build-cache-key-suffix || github.sha }}"
echo "cache-key=$cache_key" >> $GITHUB_OUTPUT
- name: Restore CiD artifacts from cache
if: ${{ inputs.build-cache }}
id: cache-restore
uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
key: ${{ steps.cache-key.outputs.cache-key }}
path: ${{ env.CID_PACKAGE_ARTIFACTS_DIR }}
- name: Clone OpenVINO
if: ${{ !steps.cache-restore.outputs.cache-hit }}
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
timeout-minutes: 15
with:
repository: ${{ steps.versions.outputs.openvino-repository }}
path: ${{ env.OPENVINO_REPO }}
submodules: true
ref: ${{ steps.versions.outputs.openvino-sha }}
- name: Checkout NPU Compiler
if: ${{ !steps.cache-restore.outputs.cache-hit }}
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
path: ${{ env.NPU_COMPILER_REPO }}
submodules: true
lfs: true
- name: System info
if: ${{ !steps.cache-restore.outputs.cache-hit }}
uses: openvinotoolkit/openvino/.github/actions/system_info@82bbf0292c5bd490bc25a383e63d6461d3ee05c5 # 2025.4.1
- name: Setup python version
if: ${{ !steps.cache-restore.outputs.cache-hit }}
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: '3.13'
- name: Install python deps
if: ${{ !steps.cache-restore.outputs.cache-hit }}
run: |
python -m pip install --require-hashes -r "${NPU_COMPILER_REPO}/.github/requirements-dev.txt"
- name: Setup MSVC env (x64)
if: ${{ !steps.cache-restore.outputs.cache-hit && env.IS_WINDOWS == '1' }}
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
with:
arch: x64
- name: Prepare environment
if: ${{ !steps.cache-restore.outputs.cache-hit }}
env:
TBB_ROOT_OPT: ${{ inputs.tbb-root }}
run: |
if [[ -n "${TBB_ROOT_OPT}" ]]; then
echo "EXTRA_OPTS=-DTBBROOT=${TBB_ROOT_OPT}" >> "$GITHUB_ENV"
else
echo "EXTRA_OPTS=" >> "$GITHUB_ENV"
fi
if [[ "${IS_WINDOWS}" == "1" ]]; then
OPENVINO_ABS="$(realpath "${OPENVINO_REPO}")"
TOOLCHAIN_FILE="${OPENVINO_ABS}/cmake/toolchains/onecoreuap.toolchain.cmake"
EXTRA_OPTS_VALUE="-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} -DENABLE_PDB_IN_RELEASE=ON ${EXTRA_OPTS:-}"
echo "EXTRA_OPTS=${EXTRA_OPTS_VALUE}" >> "$GITHUB_ENV"
fi
- name: CMake configure - OpenVINO + NPU
if: ${{ !steps.cache-restore.outputs.cache-hit }}
run: |
cmake \
-G Ninja \
-D CMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \
-D BUILD_SHARED_LIBS=OFF \
-D OPENVINO_EXTRA_MODULES=$(realpath ${NPU_COMPILER_REPO}) \
-D ENABLE_LTO=OFF \
-D ENABLE_FASTER_BUILD=OFF \
-D ENABLE_CPPLINT=OFF \
-D ENABLE_TESTS=OFF \
-D ENABLE_FUNCTIONAL_TESTS=OFF \
-D ENABLE_SAMPLES=OFF \
-D ENABLE_JS=OFF \
-D ENABLE_PYTHON=OFF \
-D ENABLE_PYTHON_PACKAGING=OFF \
-D ENABLE_WHEEL=OFF \
-D ENABLE_OV_ONNX_FRONTEND=OFF \
-D ENABLE_OV_PYTORCH_FRONTEND=OFF \
-D ENABLE_OV_PADDLE_FRONTEND=OFF \
-D ENABLE_OV_TF_FRONTEND=OFF \
-D ENABLE_OV_TF_LITE_FRONTEND=OFF \
-D ENABLE_OV_JAX_FRONTEND=OFF \
-D ENABLE_OV_IR_FRONTEND=ON \
-D THREADING=TBB \
-D ENABLE_TBBBIND_2_5=OFF \
-D ENABLE_SYSTEM_TBB=OFF \
-D ENABLE_TBB_RELEASE_ONLY=OFF \
-D ENABLE_HETERO=OFF \
-D ENABLE_MULTI=OFF \
-D ENABLE_AUTO=OFF \
-D ENABLE_AUTO_BATCH=OFF \
-D ENABLE_TEMPLATE=OFF \
-D ENABLE_PROXY=OFF \
-D ENABLE_INTEL_CPU=OFF \
-D ENABLE_INTEL_GPU=OFF \
-D ENABLE_NPU_PLUGIN_ENGINE=OFF \
-D ENABLE_DRIVER_COMPILER_ADAPTER=OFF \
-D ENABLE_INTEL_NPU_INTERNAL=OFF \
-D ENABLE_INTEL_NPU_PROTOPIPE=OFF \
-D BUILD_COMPILER_FOR_DRIVER=ON \
-D ENABLE_PRIVATE_TESTS=OFF \
-D ENABLE_NPU_LSP_SERVER=OFF \
${EXTRA_OPTS} \
${{ inputs.openvino-cmake-options }} \
-S ${OPENVINO_REPO} \
-B ${OPENVINO_BUILD_DIR}
- name: CMake build - CiD targets
if: ${{ !steps.cache-restore.outputs.cache-hit }}
run: |
cmake \
--build "${OPENVINO_BUILD_DIR}" \
--parallel \
--config "${CMAKE_BUILD_TYPE}" \
--target npu_driver_compiler compilerTest profilingTest vpuxCompilerL0Test loaderTest
- name: CMake cpack - CiD target
if: ${{ !steps.cache-restore.outputs.cache-hit }}
run: |
cpack -V \
--config "${OPENVINO_BUILD_DIR}/CPackConfig.cmake" \
-C "${CMAKE_BUILD_TYPE}" \
-G "${{ steps.package-params.outputs.cpack-generator }}" \
-B "${CID_PACKAGE_ARTIFACTS_DIR}" \
-D CPACK_COMPONENTS_ALL=CiD \
-D CPACK_CMAKE_GENERATOR=Ninja \
-D CPACK_PACKAGE_FILE_NAME="${{ steps.package-name.outputs.cid-package-base-name }}"
- name: CiD Package renaming
run: |
mv "${CID_PACKAGE_ARTIFACTS_DIR}/"*.${{ steps.package-params.outputs.package-extension }} \
"${CID_PACKAGE_ARTIFACTS_DIR}/${{ steps.package-name.outputs.cid-package-full-name }}"
- name: Cache CiD artifacts
if: ${{ inputs.build-cache && !steps.cache-restore.outputs.cache-hit }}
uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
with:
path: ${{ env.CID_PACKAGE_ARTIFACTS_DIR }}
key: ${{ steps.cache-key.outputs.cache-key }}
- name: Upload CiD package
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: ${{ steps.package-name.outputs.cid-package-full-name }}
path: |
${{ env.CID_PACKAGE_ARTIFACTS_DIR }}/${{ steps.package-name.outputs.cid-package-full-name }}
- name: Set build package name to outputs
id: set-build-package-name
run: |
echo "build-package=${{ steps.package-name.outputs.cid-package-full-name }}" >> $GITHUB_OUTPUT
- name: Attest, sign & upload CiD release package
if: ${{ github.event_name != 'pull_request' && inputs.publish-release-assets }}
uses: ./npu_actions/.github/actions/sign-and-release
with:
artifact-path: ${{ env.CID_PACKAGE_ARTIFACTS_DIR }}/${{ steps.package-name.outputs.cid-package-full-name }}
release-tag: ${{ steps.versions.outputs.npu-compiler-tag }}
repository: ${{ steps.versions.outputs.npu-compiler-repository }}
release-token: ${{ secrets.release_token || secrets.RELEASE_WRITER_TOKEN }}
workflow-path: ".github/workflows/job_build_cid.yml"