Skip to content

Commit b5b2a99

Browse files
Add CiD build (#177)
* Add CiD build * Add Windows CiD workflow * Package name fixes and python version fixes * Add toolchain * Win build hot fix * Small improvements * Enable PDB for windows builds * Enable everything back
1 parent 5aa47b4 commit b5b2a99

File tree

9 files changed

+658
-33
lines changed

9 files changed

+658
-33
lines changed

.github/actions/versions/action.yml

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,28 +38,48 @@ runs:
3838
shell: bash
3939
run: |
4040
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
41-
echo "npu-compiler-repository=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_OUTPUT
42-
echo "npu-compiler-sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
41+
NPU_REPO=${{ github.event.pull_request.head.repo.full_name }}
42+
NPU_SHA=${{ github.event.pull_request.head.sha }}
4343
else
44-
echo "npu-compiler-repository=${{ github.repository }}" >> $GITHUB_OUTPUT
45-
echo "npu-compiler-sha=${{ github.sha }}" >> $GITHUB_OUTPUT
44+
NPU_REPO=${{ github.repository }}
45+
NPU_SHA=${{ github.sha }}
4646
fi
4747
48-
- name: Create NPU Compiler tag
48+
echo "NPU Compiler repository = $NPU_REPO"
49+
echo "NPU Compiler commit sha = $NPU_SHA"
50+
echo "npu-compiler-repository=$NPU_REPO" >> $GITHUB_OUTPUT
51+
echo "npu-compiler-sha=$NPU_SHA" >> $GITHUB_OUTPUT
52+
53+
- name: Get NPU tag
4954
id: create-npu-tag
5055
shell: bash
56+
env:
57+
GITHUB_TOKEN: ${{ github.token }}
58+
NPU_REPO: ${{ steps.get-npu-sha.outputs.npu-compiler-repository }}
59+
NPU_SHA: ${{ steps.get-npu-sha.outputs.npu-compiler-sha }}
5160
run: |
52-
NPU_TAG=ci_${GITHUB_SHA:0:7}
53-
echo "NPU Compiler tag to be used in NPU Driver Linux build : $NPU_TAG"
54-
echo "npu-compiler-tag=$NPU_TAG" >> $GITHUB_OUTPUT
61+
NPU_TAG=""
62+
if JSON=$(gh api --paginate "repos/$NPU_REPO/tags?per_page=100" 2>/dev/null); then
63+
NPU_TAG=$(printf '%s' "$JSON" | jq -r --arg sha "$NPU_SHA" '
64+
.[] | select(.commit.sha == $sha) | .name
65+
' | head -n1)
66+
fi
67+
68+
if [[ -z "${NPU_TAG}" ]]; then
69+
echo "No tag found associated with the current commit, temporary tag will be used."
70+
NPU_TAG="ci_${NPU_SHA:0:7}"
71+
fi
72+
73+
echo "NPU Compiler tag to be used in NPU builds : $NPU_TAG"
74+
echo "npu-compiler-tag=${NPU_TAG}" >> $GITHUB_OUTPUT
5575
5676
- name: Fetch and parse OpenVINO config from NPU Compiler
5777
id: read-openvino-sha
5878
shell: bash
5979
run: |
6080
NPU_REPO=${{ steps.get-npu-sha.outputs.npu-compiler-repository }}
6181
NPU_SHA=${{ steps.get-npu-sha.outputs.npu-compiler-sha }}
62-
JSON=$(curl -s \
82+
JSON=$(curl -sS --fail --retry 5 --retry-delay 2 \
6383
-H "Accept: application/vnd.github.v3.raw" \
6484
https://api.github.com/repos/${NPU_REPO}/contents/validation/openvino_config.json?ref=${NPU_SHA} \
6585
)
@@ -76,7 +96,7 @@ runs:
7696
run: |
7797
NPU_REPO=${{ steps.get-npu-sha.outputs.npu-compiler-repository }}
7898
NPU_SHA=${{ steps.get-npu-sha.outputs.npu-compiler-sha }}
79-
JSON=$(curl -s \
99+
JSON=$(curl -sS --fail --retry 5 --retry-delay 2 \
80100
-H "Accept: application/vnd.github.v3.raw" \
81101
https://api.github.com/repos/${NPU_REPO}/contents/validation/linux_npu_driver_config.json?ref=${NPU_SHA} \
82102
)
@@ -93,7 +113,7 @@ runs:
93113
run: |
94114
OV_REPO=${{ steps.read-openvino-sha.outputs.openvino-repository }}
95115
OV_SHA=${{ steps.read-openvino-sha.outputs.openvino-sha }}
96-
JSON=$(curl -s \
116+
JSON=$(curl -sS --fail --retry 5 --retry-delay 2 \
97117
-H "Accept: application/vnd.github.v3.raw" \
98118
https://api.github.com/repos/${OV_REPO}/contents/src/plugins/intel_npu/tools/omz_version.json?ref=${OV_SHA} \
99119
)
Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
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

Comments
 (0)