Skip to content

Commit f7e827c

Browse files
committed
Refactoring
1 parent c83524d commit f7e827c

12 files changed

+652
-513
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Versions
2+
description: Parse git versions from config files
3+
4+
outputs:
5+
openvino-repository:
6+
description: 'OpenVINO Repository full name: fork/openvino'
7+
value: ${{ steps.read-openvino-sha.outputs.openvino-repository }}
8+
openvino-sha:
9+
description: 'OpenVINO commit SHA'
10+
value: ${{ steps.read-openvino-sha.outputs.openvino-sha }}
11+
npu-compiler-repository:
12+
description: 'NPU Compiler Repository full name: fork/npu_compiler'
13+
value: ${{ steps.get-npu-sha.outputs.npu-compiler-repository }}
14+
npu-compiler-sha:
15+
description: 'NPU Compiler commit SHA'
16+
value: ${{ steps.get-npu-sha.outputs.npu-compiler-sha }}
17+
npu-compiler-tag:
18+
description: 'NPU Compiler custom tag to be used in the packages build'
19+
value: ${{ steps.create-npu-tag.outputs.npu-compiler-tag }}
20+
omz-repository:
21+
description: 'Open Model Zoo Repository full name: for/open_model_zoo'
22+
value: ${{ steps.read-omz-sha.outputs.omz-repository }}
23+
omz-sha:
24+
description: 'Open Model Zoo commit SHA'
25+
value: ${{ steps.read-omz-sha.outputs.omz-sha }}
26+
27+
runs:
28+
using: 'composite'
29+
steps:
30+
- name: Get NPU original fork and commit sha
31+
id: get-npu-sha
32+
shell: bash
33+
run: |
34+
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
35+
echo "npu-compiler-repository=${{ github.event.pull_request.head.repo.full_name }}" >> $GITHUB_OUTPUT
36+
echo "npu-compiler-sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
37+
else
38+
echo "npu-compiler-repository=${{ github.repository }}" >> $GITHUB_OUTPUT
39+
echo "npu-compiler-sha=${{ github.sha }}" >> $GITHUB_OUTPUT
40+
fi
41+
42+
- name: Create NPU Compiler tag
43+
id: create-npu-tag
44+
shell: bash
45+
run: |
46+
NPU_TAG=ci_${GITHUB_SHA:0:7}
47+
echo "NPU Compiler tag to be used in NPU Driver Linux build : $NPU_TAG"
48+
echo "npu-compiler-tag=$NPU_TAG" >> $GITHUB_OUTPUT
49+
50+
- name: Fetch and parse OpenVINO config from NPU Compiler
51+
id: read-openvino-sha
52+
shell: bash
53+
run: |
54+
NPU_REPO=${{ steps.get-npu-sha.outputs.npu-compiler-repository }}
55+
NPU_SHA=${{ steps.get-npu-sha.outputs.npu-compiler-sha }}
56+
JSON=$(curl -s \
57+
-H "Accept: application/vnd.github.v3.raw" \
58+
https://api.github.com/repos/${NPU_REPO}/contents/validation/openvino_config.json?ref=${NPU_SHA} \
59+
)
60+
OV_ORG=$(echo "$JSON" | jq -r 'to_entries[0].key')
61+
OV_SHA=$(echo "$JSON" | jq -r 'to_entries[0].value')
62+
echo "OpenVINO orgranization = $OV_ORG"
63+
echo "OpenVINO commit sha = $OV_SHA"
64+
echo "openvino-repository=$OV_ORG/openvino" >> $GITHUB_OUTPUT
65+
echo "openvino-sha=$OV_SHA" >> $GITHUB_OUTPUT
66+
67+
- name: Fetch and parse OMZ config from OpenVINO
68+
id: read-omz-sha
69+
shell: bash
70+
run: |
71+
OV_REPO=${{ steps.read-openvino-sha.outputs.openvino-repository }}
72+
OV_SHA=${{ steps.read-openvino-sha.outputs.openvino-sha }}
73+
JSON=$(curl -s \
74+
-H "Accept: application/vnd.github.v3.raw" \
75+
https://api.github.com/repos/${OV_REPO}/contents/src/plugins/intel_npu/tools/omz_version.json?ref=${OV_SHA} \
76+
)
77+
OMZ_ORG=$(echo "$JSON" | jq -r 'to_entries[0].key')
78+
OMZ_SHA=$(echo "$JSON" | jq -r 'to_entries[0].value')
79+
echo "Open Model Zoo orgranization = $OMZ_ORG"
80+
echo "Open Model Zoo commit sha = $OMZ_SHA"
81+
echo "omz-repository=$OMZ_ORG/open_model_zoo" >> $GITHUB_OUTPUT
82+
echo "omz-sha=$OMZ_SHA" >> $GITHUB_OUTPUT
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
name: Linux NPU Driver 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+
driver-cmake-options:
14+
description: 'Custom CMake options for NPU Driver build'
15+
type: string
16+
required: false
17+
build-cache:
18+
description: 'Whether to take previously built Driver package'
19+
type: boolean
20+
required: false
21+
default: false
22+
build-cache-key-suffix:
23+
description: 'Cache package suffix'
24+
type: string
25+
required: false
26+
outputs:
27+
driver-install-artifact:
28+
description: 'Driver build package name to be stored as the action artifact'
29+
value: ${{ jobs.Build.outputs.driver-install-artifact }}
30+
31+
defaults:
32+
run:
33+
shell: bash
34+
35+
permissions: read-all
36+
37+
env:
38+
NPU_DRIVER_INSTALL_DIR: ./npu_driver_install
39+
NPU_DRIVER_INSTALL_ARTIFACT: l_ov_cid_${{ inputs.os }}_npu_${{ github.sha }}
40+
41+
jobs:
42+
Cache:
43+
name: Cache Driver
44+
if: ${{ inputs.build-cache }}
45+
runs-on: ubuntu-latest
46+
outputs:
47+
cache-hit: ${{ steps.restore.outputs.cache-hit }}
48+
cache-key: ${{ steps.key.outputs.cache-key }}
49+
steps:
50+
- name: Get cache key
51+
id: key
52+
run: |
53+
cache_key="l_ov_cid_${{ inputs.os }}_cache_${{ inputs.build-cache-key-suffix || github.sha }}"
54+
echo "cache-key=$cache_key" >> $GITHUB_OUTPUT
55+
56+
- name: Restore Driver package from cache
57+
id: restore
58+
uses: actions/cache/restore@v4
59+
with:
60+
key: ${{ steps.key.outputs.cache-key }}
61+
path: ${{ env.NPU_DRIVER_INSTALL_DIR }}
62+
63+
- name: Upload artifacts
64+
if: ${{ steps.restore.outputs.cache-hit }}
65+
uses: actions/upload-artifact@v4
66+
with:
67+
path: ${{ env.NPU_DRIVER_INSTALL_DIR }}
68+
name: ${{ env.NPU_DRIVER_INSTALL_ARTIFACT }}
69+
70+
Build:
71+
name: Build Driver
72+
needs: Cache
73+
if: ${{ always() && needs.Cache.outputs.cache-hit != 'true' }}
74+
runs-on: ${{ inputs.build-runner }}
75+
timeout-minutes: 240
76+
outputs:
77+
driver-install-artifact: ${{ steps.set_artifact_name.outputs.driver-install-artifact }}
78+
env:
79+
DEBIAN_FRONTEND: noninteractive
80+
NPU_ACTIONS_DIR: ./npu_actions
81+
NPU_COMPILER_REPO: ./npu_compiler
82+
NPU_DRIVER_REPO: ./npu_driver
83+
NPU_DRIVER_BUILD_DIR: ./npu_driver_build
84+
steps:
85+
- name: Checkout versions action
86+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
87+
with:
88+
path: ${{ env.NPU_ACTIONS_DIR }}
89+
sparse-checkout: |
90+
.github/actions/versions
91+
sparse-checkout-cone-mode: false
92+
93+
- name: Get versions
94+
uses: ./npu_actions/.github/actions/versions
95+
id: versions
96+
97+
- name: Clone Linux NPU Driver
98+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
99+
timeout-minutes: 15
100+
with:
101+
repository: intel/linux-npu-driver
102+
path: ${{ env.NPU_DRIVER_REPO }}
103+
submodules: true
104+
105+
- name: System info
106+
uses: openvinotoolkit/openvino/.github/actions/system_info@master
107+
108+
- name: Install system packages
109+
run: |
110+
sudo apt update
111+
sudo apt install -y build-essential git git-lfs cmake libudev-dev libboost-all-dev libssl-dev libtbb12
112+
113+
- name: Configure OpenVINO and NPU Compiler versions
114+
run: |
115+
sed -i "s|^set(OPENVINO_REPOSITORY .*|set(OPENVINO_REPOSITORY https://github.com/${{ steps.versions.outputs.openvino-repository }})|" ${NPU_DRIVER_REPO}/compiler/compiler_source.cmake
116+
sed -i '/GIT_REPOSITORY/{n;s|https://github.com/openvinotoolkit/npu_plugin.git|https://github.com/${{ steps.versions.outputs.npu-compiler-repository }}.git|}' ${NPU_DRIVER_REPO}/compiler/compiler_source.cmake
117+
sed -i "s|^set(NPU_COMPILER_TAG .*|set(NPU_COMPILER_TAG ${{ steps.versions.outputs.npu-compiler-tag }})|" ${NPU_DRIVER_REPO}/compiler/compiler_source.cmake
118+
sed -i "s|^set(NPU_COMPILER_REVISION .*|set(NPU_COMPILER_REVISION ${{ steps.versions.outputs.npu-compiler-sha }})|" ${NPU_DRIVER_REPO}/compiler/compiler_source.cmake
119+
sed -i "s|^set(NPU_COMPILER_OPENVINO_REVISION .*|set(NPU_COMPILER_OPENVINO_REVISION ${{ steps.versions.outputs.openvino-sha }})|" ${NPU_DRIVER_REPO}/compiler/compiler_source.cmake
120+
cat ${NPU_DRIVER_REPO}/compiler/compiler_source.cmake
121+
122+
- name: CMake configure - Linux NPU Driver
123+
run: |
124+
cmake \
125+
${{ inputs.driver-cmake-options }} \
126+
-DENABLE_OPENVINO_PACKAGE=ON \
127+
-DENABLE_NPU_COMPILER_BUILD=ON \
128+
-DCMAKE_INSTALL_PREFIX=$(realpath ${NPU_DRIVER_INSTALL_DIR}) \
129+
-S ${NPU_DRIVER_REPO} \
130+
-B ${NPU_DRIVER_BUILD_DIR}
131+
132+
- name: CMake build - Linux NPU Driver - deb packages
133+
run: |
134+
cmake \
135+
--build ${NPU_DRIVER_BUILD_DIR} \
136+
--parallel $(nproc) \
137+
--target package
138+
139+
- name: Copy packages
140+
run: |
141+
mkdir -p ${NPU_DRIVER_INSTALL_DIR}/external
142+
mkdir -p ${NPU_DRIVER_INSTALL_DIR}/internal
143+
mv ${NPU_DRIVER_BUILD_DIR}/intel-{level-zero-npu,fw-npu,driver-compiler-npu}*.*deb ${NPU_DRIVER_INSTALL_DIR}/external/
144+
mv ${NPU_DRIVER_BUILD_DIR}/*.*deb ${NPU_DRIVER_INSTALL_DIR}/internal/
145+
146+
- name: Cache artifacts
147+
if: ${{ inputs.build-cache }}
148+
uses: actions/cache/save@v4
149+
with:
150+
path: ${{ env.NPU_DRIVER_INSTALL_DIR }}
151+
key: ${{ needs.Cache.outputs.cache-key }}
152+
153+
- name: Upload artifacts
154+
uses: actions/upload-artifact@v4
155+
with:
156+
path: ${{ env.NPU_DRIVER_INSTALL_DIR }}
157+
name: ${{ env.NPU_DRIVER_INSTALL_ARTIFACT }}
158+
159+
- name: Set artifacts name to outputs
160+
id: set_artifact_name
161+
run: |
162+
echo "driver-install-artifact=$NPU_DRIVER_INSTALL_ARTIFACT" >> $GITHUB_OUTPUT

.github/workflows/job_build_mlir_linux.yml

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@ on:
1010
description: 'Machine on which the builds will run'
1111
type: string
1212
required: true
13-
openvino-repository:
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
2113
openvino-cmake-options:
2214
description: 'A string of options passed to OpenVINO CMake'
2315
type: string
@@ -27,7 +19,7 @@ on:
2719
type: string
2820
required: false
2921
build-cache:
30-
description: 'Whether to take previously built OpenVINO/NPU package.'
22+
description: 'Whether to take previously built OpenVINO/NPU package'
3123
type: boolean
3224
required: false
3325
default: false
@@ -40,11 +32,10 @@ on:
4032
type: boolean
4133
required: false
4234
default: false
35+
outputs:
4336
openvino-install-artifact:
4437
description: 'OpenVINO/NPU build package name to be stored as the action artifact'
45-
type: string
46-
required: true
47-
default: false
38+
value: ${{ jobs.Build.outputs.openvino-install-artifact }}
4839

4940
defaults:
5041
run:
@@ -54,58 +45,74 @@ permissions: read-all
5445

5546
env:
5647
OPENVINO_INSTALL_DIR: ./openvino_install
48+
OPENVINO_INSTALL_ARTIFACT: l_ov_dyn_${{ inputs.os }}_npu_${{ github.sha }}
5749

5850
jobs:
5951
Cache:
60-
name: Cache
52+
name: Cache MLIR
6153
if: ${{ inputs.build-cache }}
6254
runs-on: ubuntu-latest
6355
outputs:
6456
cache-hit: ${{ steps.restore.outputs.cache-hit }}
65-
cache-key: ${{ steps.key.outputs.cache_key }}
57+
cache-key: ${{ steps.key.outputs.cache-key }}
6658
steps:
6759
- name: Get cache key
6860
id: key
6961
run: |
7062
cache_key="l_ov_dyn_${{ inputs.os }}_cache_${{ inputs.build-cache-key-suffix || github.sha }}"
71-
echo "cache_key=$cache_key" >> $GITHUB_OUTPUT
63+
echo "cache-key=$cache_key" >> $GITHUB_OUTPUT
7264
7365
- name: Restore OpenVINO/NPU package from cache
7466
id: restore
7567
uses: actions/cache/restore@v4
7668
with:
77-
key: ${{ steps.key.outputs.cache_key }}
69+
key: ${{ steps.key.outputs.cache-key }}
7870
path: ${{ env.OPENVINO_INSTALL_DIR }}
7971

8072
- name: Upload artifacts
8173
if: ${{ steps.restore.outputs.cache-hit }}
8274
uses: actions/upload-artifact@v4
8375
with:
8476
path: ${{ env.OPENVINO_INSTALL_DIR }}
85-
name: ${{ inputs.openvino-install-artifact }}
77+
name: ${{ env.OPENVINO_INSTALL_ARTIFACT }}
8678

8779
Build:
88-
name: Build
80+
name: Build MLIR
8981
needs: Cache
9082
if: ${{ always() && needs.Cache.outputs.cache-hit != 'true' }}
9183
runs-on: ${{ inputs.build-runner }}
9284
timeout-minutes: 240
85+
outputs:
86+
openvino-install-artifact: ${{ steps.set_artifact_name.outputs.openvino-install-artifact }}
9387
env:
9488
DEBIAN_FRONTEND: noninteractive
9589
CMAKE_BUILD_TYPE: 'Release'
9690
OPENVINO_REPO: ./openvino
91+
NPU_ACTIONS_DIR: ./npu_actions
9792
NPU_COMPILER_REPO: ./npu_compiler
9893
OPENVINO_BUILD_DIR: ./openvino_build
9994
NPU_COMPILER_BUILD_DIR: ./npu_compiler_build
10095
steps:
96+
- name: Checkout versions action
97+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
98+
with:
99+
path: ${{ env.NPU_ACTIONS_DIR }}
100+
sparse-checkout: |
101+
.github/actions/versions
102+
sparse-checkout-cone-mode: false
103+
104+
- name: Get versions
105+
uses: ./npu_actions/.github/actions/versions
106+
id: versions
107+
101108
- name: Clone OpenVINO
102109
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
103110
timeout-minutes: 15
104111
with:
105-
repository: ${{ inputs.openvino-repository }}
112+
repository: ${{ steps.versions.outputs.openvino-repository }}
106113
path: ${{ env.OPENVINO_REPO }}
107114
submodules: true
108-
ref: ${{ inputs.openvino-commit }}
115+
ref: ${{ steps.versions.outputs.openvino-sha }}
109116

110117
- name: Clone NPU Compiler
111118
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -214,8 +221,12 @@ jobs:
214221
key: ${{ needs.Cache.outputs.cache-key }}
215222

216223
- name: Upload artifacts
217-
id: save_artifact
218224
uses: actions/upload-artifact@v4
219225
with:
220226
path: ${{ env.OPENVINO_INSTALL_DIR }}
221-
name: ${{ inputs.openvino-install-artifact }}
227+
name: ${{ env.OPENVINO_INSTALL_ARTIFACT }}
228+
229+
- name: Set artifacts name to outputs
230+
id: set_artifact_name
231+
run: |
232+
echo "openvino-install-artifact=$OPENVINO_INSTALL_ARTIFACT" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)