Skip to content

Commit 5684727

Browse files
build: improve L0 driver versioning to allow HotFix number
new format is: BBBBB.HHH, where: * BBBBB is build number * HHH is hotfix number Signed-off-by: Artur Harasimiuk <[email protected]>
1 parent a70aaa7 commit 5684727

File tree

11 files changed

+28
-14
lines changed

11 files changed

+28
-14
lines changed

driver_version.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
#cmakedefine NEO_REVISION "${NEO_REVISION}"
1313

1414
#define NEO_VERSION_BUILD ${NEO_VERSION_BUILD}
15+
#define NEO_VERSION_HOTFIX ${NEO_VERSION_HOTFIX}
1516

1617
#endif /* DRIVER_VERSION_H */

level_zero/core/source/driver/driver_handle_imp.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@ ze_result_t DriverHandleImp::getApiVersion(ze_api_version_t *version) {
113113
}
114114

115115
ze_result_t DriverHandleImp::getProperties(ze_driver_properties_t *properties) {
116-
uint32_t versionBuild = static_cast<uint32_t>(NEO_VERSION_BUILD);
116+
uint32_t versionBuild = static_cast<uint32_t>(NEO_VERSION_BUILD) << 12;
117+
uint32_t versionHotfix = static_cast<uint32_t>(NEO_VERSION_HOTFIX);
117118

118-
properties->driverVersion = DriverHandleImp::initialDriverVersionValue + versionBuild;
119+
properties->driverVersion = versionBuild + versionHotfix;
119120
if (NEO::debugManager.flags.OverrideDriverVersion.get() > -1) {
120121
properties->driverVersion = static_cast<uint32_t>(NEO::debugManager.flags.OverrideDriverVersion.get());
121122
}

level_zero/core/source/driver/driver_handle_imp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ struct DriverHandleImp : public DriverHandle {
5151
~DriverHandleImp() override;
5252
DriverHandleImp();
5353

54-
static constexpr uint32_t initialDriverVersionValue = 0x01030000;
55-
5654
ze_result_t createContext(const ze_context_desc_t *desc,
5755
uint32_t numDevices,
5856
ze_device_handle_t *phDevices,

level_zero/core/test/unit_tests/sources/driver/test_driver.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ TEST_F(DriverVersionTest, WhenGettingDriverVersionThenExpectedDriverVersionIsRet
203203
ze_result_t res = driverHandle->getProperties(&properties);
204204
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
205205

206-
auto expectedDriverVersion = static_cast<uint32_t>(DriverHandleImp::initialDriverVersionValue);
207-
expectedDriverVersion += static_cast<uint32_t>(NEO_VERSION_BUILD);
206+
auto expectedDriverVersion = static_cast<uint32_t>(NEO_VERSION_BUILD << 12);
207+
expectedDriverVersion += static_cast<uint32_t>(NEO_VERSION_HOTFIX);
208208
EXPECT_EQ(expectedDriverVersion, properties.driverVersion);
209209
}
210210

@@ -227,12 +227,12 @@ TEST_F(DriverVersionTest, GivenDebugOverrideWhenGettingDriverVersionThenExpected
227227
expectedDriverVersion = 10;
228228
EXPECT_EQ(expectedDriverVersion, properties.driverVersion);
229229

230-
NEO::debugManager.flags.OverrideDriverVersion.set(DriverHandleImp::initialDriverVersionValue + 20);
230+
NEO::debugManager.flags.OverrideDriverVersion.set((29383 << 12) + 71);
231231

232232
res = driverHandle->getProperties(&properties);
233233
EXPECT_EQ(ZE_RESULT_SUCCESS, res);
234234

235-
expectedDriverVersion = DriverHandleImp::initialDriverVersionValue + 20;
235+
expectedDriverVersion = (0x72c7000 + 0x47);
236236
EXPECT_EQ(expectedDriverVersion, properties.driverVersion);
237237
}
238238

@@ -249,8 +249,8 @@ TEST_F(DriverVersionTest, givenCallToGetDriverPropertiesThenUuidIsSet) {
249249
EXPECT_NE(0u, uniqueId);
250250

251251
auto driverVersion = static_cast<uint32_t>(uuid & 0xFFFFFFFF);
252-
auto expectedDriverVersion = static_cast<uint32_t>(DriverHandleImp::initialDriverVersionValue);
253-
expectedDriverVersion += static_cast<uint32_t>(NEO_VERSION_BUILD);
252+
auto expectedDriverVersion = static_cast<uint32_t>(NEO_VERSION_BUILD << 12);
253+
expectedDriverVersion += static_cast<uint32_t>(NEO_VERSION_HOTFIX);
254254
EXPECT_EQ(expectedDriverVersion, driverVersion);
255255
}
256256

scripts/packaging/l0_gpu_driver/build_l0_gpu_driver_deb.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
#
4-
# Copyright (C) 2021-2023 Intel Corporation
4+
# Copyright (C) 2021-2024 Intel Corporation
55
#
66
# SPDX-License-Identifier: MIT
77
#
@@ -32,10 +32,10 @@ source "${REPO_DIR}/scripts/packaging/${BRANCH_SUFFIX}/functions.sh"
3232
source "${REPO_DIR}/scripts/packaging/${BRANCH_SUFFIX}/l0_gpu_driver/l0_gpu_driver.sh"
3333

3434
get_api_version # API_VERSION-API_VERSION_SRC and API_DEB_MODEL_LINK
35-
get_l0_gpu_driver_version # NEO_L0_VERSION_MAJOR.NEO_L0_VERSION_MINOR.NEO_L0_VERSION_PATCH
35+
get_l0_gpu_driver_version # NEO_L0_VERSION_MAJOR.NEO_L0_VERSION_MINOR.NEO_L0_VERSION_PATCH.NEO_L0_VERSION_HOTFIX
3636

3737
if [ -z "${BRANCH_SUFFIX}" ]; then
38-
VERSION="${NEO_L0_VERSION_MAJOR}.${NEO_L0_VERSION_MINOR}.${NEO_L0_VERSION_PATCH}${API_DEB_MODEL_LINK}"
38+
VERSION="${NEO_L0_VERSION_MAJOR}.${NEO_L0_VERSION_MINOR}.${NEO_L0_VERSION_PATCH}-${NEO_L0_VERSION_HOTFIX}${API_DEB_MODEL_LINK}"
3939
else
4040
VERSION="${NEO_L0_VERSION_MAJOR}.${NEO_L0_VERSION_MINOR}.${NEO_L0_VERSION_PATCH}${API_VERSION}-${NEO_L0_VERSION_HOTFIX}${API_VERSION_SRC}${API_DEB_MODEL_LINK}"
4141
fi
@@ -85,6 +85,7 @@ fi
8585

8686
# Update rules file with new version
8787
perl -pi -e "s/^ver = .*/ver = $NEO_L0_VERSION_PATCH/" $BUILD_DIR/debian/rules
88+
perl -pi -e "s/^ver_hf = .*/ver_hf = $NEO_L0_VERSION_HOTFIX/" $BUILD_DIR/debian/rules
8889

8990
#needs a top level CMAKE file
9091
cat << EOF | tee $BUILD_DIR/CMakeLists.txt

scripts/packaging/l0_gpu_driver/build_l0_gpu_driver_rpm.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ if [ "${BUILD_SRPM}" == "1" ]; then
4747
source "${REPO_DIR}/scripts/packaging/${BRANCH_SUFFIX}/l0_gpu_driver/l0_gpu_driver.sh"
4848

4949
get_api_version # API_VERSION-API_VERSION_SRC and API_RPM_MODEL_LINK
50-
get_l0_gpu_driver_version # NEO_L0_VERSION_MAJOR.NEO_L0_VERSION_MINOR.NEO_L0_VERSION_PATCH
50+
get_l0_gpu_driver_version # NEO_L0_VERSION_MAJOR.NEO_L0_VERSION_MINOR.NEO_L0_VERSION_PATCH.NEO_L0_VERSION_HOTFIX
5151

5252
VERSION="${NEO_L0_VERSION_MAJOR}.${NEO_L0_VERSION_MINOR}.${NEO_L0_VERSION_PATCH}${API_VERSION}"
5353
RELEASE="${NEO_L0_VERSION_HOTFIX}${API_VERSION_SRC}${API_RPM_MODEL_LINK}"
@@ -77,6 +77,7 @@ if [ "${BUILD_SRPM}" == "1" ]; then
7777
perl -pi -e "s/^%global rel .*/%global rel ${RELEASE}/" $SPEC
7878
perl -pi -e "s/^%global NEO_RELEASE_WITH_REGKEYS .*/%global NEO_RELEASE_WITH_REGKEYS ${RELEASE_WITH_REGKEYS}/" $SPEC
7979
perl -pi -e "s/^%global build_id .*/%global build_id ${NEO_L0_VERSION_PATCH}/" $SPEC
80+
perl -pi -e "s/^%global hotfix_id .*/%global hotfix_id ${NEO_L0_VERSION_HOTFIX}/" $SPEC
8081

8182
rpmbuild --define "_topdir $BUILD_DIR" -bs $SPEC --define 'build_type ${CMAKE_BUILD_TYPE}' "${build_args[@]}"
8283
mkdir -p ${REPO_DIR}/../output/SRPMS

scripts/packaging/l0_gpu_driver/l0_gpu_driver.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,6 @@ get_l0_gpu_driver_version() {
2424
unset __NEO_L0_VERSION_PATCH_TMP
2525
__NEO_L0_VERSION_HOTFIX_TMP=$(echo $NEO_TAG | awk -F '-' '{ if(NF>1) { print $2; } }')
2626
NEO_L0_VERSION_HOTFIX="${NEO_L0_VERSION_HOTFIX:-$__NEO_L0_VERSION_HOTFIX_TMP}"
27+
NEO_L0_VERSION_HOTFIX="${NEO_L0_VERSION_HOTFIX:-0}"
2728
unset __NEO_L0_VERSION_HOTFIX_TMP
2829
}

scripts/packaging/l0_gpu_driver/rhel_8/SPECS/l0_gpu_driver.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
%global ver xxx
33
%global rel xxx
44
%global build_id xxx
5+
%global hotfix_id xxx
56
%global NEO_RELEASE_WITH_REGKEYS FALSE
67
%global NEO_ENABLE_XE_EU_DEBUG_SUPPORT FALSE
78
%global NEO_I915_PRELIM_HEADERS_DIR %{nil}
@@ -62,6 +63,7 @@ cd build
6263
%cmake .. \
6364
-GNinja ${NEO_BUILD_EXTRA_OPTS} \
6465
-DNEO_VERSION_BUILD=%{build_id} \
66+
-DNEO_VERSION_HOTFIX=%{hotfix_id} \
6567
-DCMAKE_BUILD_TYPE=Release \
6668
-DNEO_BUILD_WITH_OCL=FALSE \
6769
-DNEO_SKIP_UNIT_TESTS=TRUE \

scripts/packaging/l0_gpu_driver/sles_15/SPECS/l0_gpu_driver.spec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
%global ver xxx
55
%global rel xxx
66
%global build_id xxx
7+
%global hotfix_id xxx
78
%global NEO_RELEASE_WITH_REGKEYS FALSE
89
%global NEO_ENABLE_XE_EU_DEBUG_SUPPORT FALSE
910
%global NEO_I915_PRELIM_HEADERS_DIR %{nil}
@@ -72,6 +73,7 @@ Intel(R) Graphics Compute Runtime for oneAPI Level Zero - development headers
7273
%cmake .. \
7374
-GNinja ${NEO_BUILD_EXTRA_OPTS} \
7475
-DNEO_VERSION_BUILD=%{build_id} \
76+
-DNEO_VERSION_HOTFIX=%{hotfix_id} \
7577
-DCMAKE_BUILD_TYPE=%{build_type} \
7678
-DNEO_BUILD_WITH_OCL=FALSE \
7779
-DNEO_SKIP_UNIT_TESTS=TRUE \

scripts/packaging/l0_gpu_driver/ubuntu_20.04/debian/rules

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/make -f
22
ver = xxx
3+
ver_hf = 0
34

45
%:
56
dh $@ --builddir build/ --buildsystem=cmake+ninja
@@ -16,6 +17,7 @@ override_dh_auto_configure:
1617
dh_auto_configure -- ${NEO_BUILD_EXTRA_OPTS} \
1718
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
1819
-DNEO_VERSION_BUILD=$(ver) \
20+
-DNEO_VERSION_HOTFIX=$(ver_hf) \
1921
-DNEO_SKIP_UNIT_TESTS=${NEO_SKIP_UNIT_TESTS} \
2022
-DNEO_ENABLE_i915_PRELIM_DETECTION=${NEO_ENABLE_i915_PRELIM_DETECTION} \
2123
-DNEO_ENABLE_XE_EU_DEBUG_SUPPORT=${NEO_ENABLE_XE_EU_DEBUG_SUPPORT} \

0 commit comments

Comments
 (0)