diff --git a/driver_version.h.in b/driver_version.h.in index ececba299e..d52b248232 100644 --- a/driver_version.h.in +++ b/driver_version.h.in @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2021 Intel Corporation + * Copyright (C) 2018-2024 Intel Corporation * * SPDX-License-Identifier: MIT * @@ -11,4 +11,6 @@ #cmakedefine NEO_OCL_DRIVER_VERSION ${NEO_OCL_DRIVER_VERSION} #cmakedefine NEO_REVISION "${NEO_REVISION}" +#define NEO_VERSION_BUILD ${NEO_VERSION_BUILD} + #endif /* DRIVER_VERSION_H */ diff --git a/level_zero/CMakeLists.txt b/level_zero/CMakeLists.txt index ed202d0c56..e2c344c580 100644 --- a/level_zero/CMakeLists.txt +++ b/level_zero/CMakeLists.txt @@ -45,11 +45,6 @@ if(BUILD_WITH_L0) return() endif() - add_definitions(-DL0_PROJECT_VERSION_MAJOR="${PROJECT_VERSION_MAJOR}") - add_definitions(-DL0_PROJECT_VERSION_MINOR="${PROJECT_VERSION_MINOR}") - add_definitions(-DL0_PROJECT_VERSION_PATCH="${PROJECT_VERSION_PATCH}") - add_definitions(-DNEO_VERSION_BUILD="${NEO_VERSION_BUILD}") - add_definitions(-DZE_ENABLE_OCL_INTEROP=1) file(WRITE "${CMAKE_BINARY_DIR}/VERSION" "${PROJECT_VERSION}") @@ -209,7 +204,6 @@ if(BUILD_WITH_L0) include_directories(ddi) # Create our shared library/DLL - configure_file(ze_intel_gpu_version.h.in ${NEO_BUILD_DIR}/ze_intel_gpu_version.h) add_library(${TARGET_NAME_L0} SHARED ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt diff --git a/level_zero/core/source/driver/CMakeLists.txt b/level_zero/core/source/driver/CMakeLists.txt index e8b31afe76..5ddb02029f 100644 --- a/level_zero/core/source/driver/CMakeLists.txt +++ b/level_zero/core/source/driver/CMakeLists.txt @@ -19,11 +19,4 @@ target_sources(${L0_STATIC_LIB_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/extension_function_address.h ${CMAKE_CURRENT_SOURCE_DIR}/host_pointer_manager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/host_pointer_manager.h - ) - -if(NOT DEFINED L0_DRIVER_VERSION) - set(L0_DRIVER_VERSION 1) -endif() - -configure_file(driver_version.h.in ${CMAKE_BINARY_DIR}/driver_version_l0.h) # Put Driver version into define diff --git a/level_zero/core/source/driver/driver_handle_imp.cpp b/level_zero/core/source/driver/driver_handle_imp.cpp index aa167fe520..5fa3a69453 100644 --- a/level_zero/core/source/driver/driver_handle_imp.cpp +++ b/level_zero/core/source/driver/driver_handle_imp.cpp @@ -33,7 +33,7 @@ #include "level_zero/core/source/gfx_core_helpers/l0_gfx_core_helper.h" #include "level_zero/core/source/image/image.h" -#include "driver_version_l0.h" +#include "driver_version.h" #include #include @@ -112,7 +112,8 @@ ze_result_t DriverHandleImp::getApiVersion(ze_api_version_t *version) { } ze_result_t DriverHandleImp::getProperties(ze_driver_properties_t *properties) { - uint32_t versionBuild = static_cast(strtoul(NEO_VERSION_BUILD, NULL, 10)); + uint32_t versionBuild = static_cast(NEO_VERSION_BUILD); + properties->driverVersion = DriverHandleImp::initialDriverVersionValue + versionBuild; if (NEO::debugManager.flags.OverrideDriverVersion.get() > -1) { properties->driverVersion = static_cast(NEO::debugManager.flags.OverrideDriverVersion.get()); diff --git a/level_zero/core/source/driver/driver_version.h.in b/level_zero/core/source/driver/driver_version.h.in deleted file mode 100644 index 96b0ce9435..0000000000 --- a/level_zero/core/source/driver/driver_version.h.in +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (C) 2020-2021 Intel Corporation - * - * SPDX-License-Identifier: MIT - * - */ - -#ifndef L0_DRIVER_VERSION_H -#define L0_DRIVER_VERSION_H - -#define L0_DRIVER_VERSION @L0_DRIVER_VERSION@ - -#endif /* L0_DRIVER_VERSION_H */ diff --git a/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp b/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp index ed6f4893a2..e4349431d8 100644 --- a/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp +++ b/level_zero/core/test/unit_tests/sources/driver/test_driver.cpp @@ -39,6 +39,8 @@ #include "level_zero/core/test/unit_tests/mocks/mock_driver.h" #include "level_zero/core/test/unit_tests/mocks/mock_driver_handle.h" +#include "driver_version.h" + #include namespace L0 { @@ -197,7 +199,8 @@ TEST_F(DriverVersionTest, WhenGettingDriverVersionThenExpectedDriverVersionIsRet ze_result_t res = driverHandle->getProperties(&properties); EXPECT_EQ(ZE_RESULT_SUCCESS, res); - auto expectedDriverVersion = static_cast(DriverHandleImp::initialDriverVersionValue + strtoul(NEO_VERSION_BUILD, NULL, 10)); + auto expectedDriverVersion = static_cast(DriverHandleImp::initialDriverVersionValue); + expectedDriverVersion += static_cast(NEO_VERSION_BUILD); EXPECT_EQ(expectedDriverVersion, properties.driverVersion); } @@ -242,7 +245,8 @@ TEST_F(DriverVersionTest, givenCallToGetDriverPropertiesThenUuidIsSet) { EXPECT_NE(0u, uniqueId); auto driverVersion = static_cast(uuid & 0xFFFFFFFF); - auto expectedDriverVersion = static_cast(DriverHandleImp::initialDriverVersionValue + strtoul(NEO_VERSION_BUILD, NULL, 10)); + auto expectedDriverVersion = static_cast(DriverHandleImp::initialDriverVersionValue); + expectedDriverVersion += static_cast(NEO_VERSION_BUILD); EXPECT_EQ(expectedDriverVersion, driverVersion); } diff --git a/version.cmake b/version.cmake index 51dbc59324..9a447f4134 100644 --- a/version.cmake +++ b/version.cmake @@ -1,5 +1,5 @@ # -# Copyright (C) 2018-2022 Intel Corporation +# Copyright (C) 2018-2024 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -80,3 +80,6 @@ set(NEO_OCL_DRIVER_VERSION "${NEO_OCL_VERSION_MAJOR}.${NEO_OCL_VERSION_MINOR}.${ # Level-Zero package version set(NEO_L0_VERSION_MAJOR 1) set(NEO_L0_VERSION_MINOR 3) + +# Remove leading zeros +string(REGEX REPLACE "^0+([0-9]+)" "\\1" NEO_VERSION_BUILD "${NEO_VERSION_BUILD}")