Skip to content

[SYCL] Add runtime library versioning #1604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
option(SYCL_ENABLE_WERROR "Treat all warnings as errors in SYCL project" OFF)
option(SYCL_ADD_DEV_VERSION_POSTFIX "Adds -V postfix to version string" ON)

set(SYCL_MAJOR_VERSION 0)
set(SYCL_MINOR_VERSION 1)
set(SYCL_PATCH_VERSION 0)
set(SYCL_DEV_ABI_VERSION 0)
Comment on lines +11 to +14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These numbers should be manually incremented every time we make some breaking or non-breaking changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only DEV_ABI version must be incremented, and only when breaking change happens. The rest of the numbers is changed once per release.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarification.

if (SYCL_ADD_DEV_VERSION_POSTFIX)
set(SYCL_VERSION_POSTFIX "-${SYCL_DEV_ABI_VERSION}")
endif()
set(SYCL_VERSION_STRING "${SYCL_MAJOR_VERSION}.${SYCL_MINOR_VERSION}.${SYCL_PATCH_VERSION}${SYCL_VERSION_POSTFIX}")

# enable all warnings by default
if (MSVC)
Expand Down Expand Up @@ -200,7 +210,11 @@ add_subdirectory( source )

# Auxilliary extras for SYCL headers/library
if (NOT WIN32)
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/xmethods/$<TARGET_FILE_NAME:sycl>-gdb.py" DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT sycl-headers-extras)
install(FILES
"${CMAKE_CURRENT_SOURCE_DIR}/xmethods/libsycl.so-gdb.py"
RENAME "${CMAKE_CURRENT_SOURCE_DIR}/xmethods/$<TARGET_FILE_NAME:sycl>-gdb.py"
DESTINATION lib${LLVM_LIBDIR_SUFFIX}
COMPONENT sycl-headers-extras)
endif()

# SYCL toolchain builds all components: compiler, libraries, headers, etc.
Expand Down
10 changes: 9 additions & 1 deletion sycl/doc/ABIPolicyGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,15 @@ Adding a new exported symbol is considered to be non-breaking change.

## ABI Versioning Policy

TBD
The release version of the DPC++ runtime library follows
[Semantic Versioning](https://semver.org/) scheme: `MAJOR.MINOR.PATCH`. `MAJOR`
version indicates breaking change. Version `X` is backwards incompatible with
version `X-1`. `MINOR` indicates a non-breaking change. The development version
of the library has a postfix `-V` that indicates breaking changes between
releases. Every time a pull request introduces a breaking change, it must also
uplift `V`. It is pull request author responsibility to accordingly update
this version. If `V > 0` on release date, then `MAJOR_VERSION` is uplifted and
`V` is set to zero.

## `__SYCL_EXPORT` Macro

Expand Down
14 changes: 13 additions & 1 deletion sycl/source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
#cmake_policy(SET CMP0057 NEW)
#include(AddLLVM)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in
${CMAKE_CURRENT_BINARY_DIR}/version.rc
@ONLY)

if (SYCL_ENABLE_XPTI_TRACING)
if (NOT EXISTS ${LLVM_EXTERNAL_XPTI_SOURCE_DIR})
message (FATAL_ERROR "Undefined LLVM_EXTERNAL_XPTI_SOURCE_DIR variable: Must be set when XPTI tracing is set to ON")
Expand All @@ -19,7 +24,10 @@ function(add_sycl_rt_library LIB_NAME)
set(LIB_OBJ_NAME ${LIB_NAME}_object)

add_library(${LIB_OBJ_NAME} OBJECT ${ARG_SOURCES})
add_library(${LIB_NAME} SHARED $<TARGET_OBJECTS:${LIB_OBJ_NAME}>)
add_library(${LIB_NAME} SHARED
$<TARGET_OBJECTS:${LIB_OBJ_NAME}>
${CMAKE_CURRENT_BINARY_DIR}/version.rc)

if (ARG_COMPILE_OPTIONS)
target_compile_options(${LIB_OBJ_NAME} PRIVATE ${ARG_COMPILE_OPTIONS})
endif()
Expand Down Expand Up @@ -74,6 +82,10 @@ function(add_sycl_rt_library LIB_NAME)

add_common_options(${LIB_NAME})

set_target_properties(${LIB_NAME} PROPERTIES
VERSION ${SYCL_VERSION_STRING}
SOVERSION ${SYCL_MAJOR_VERSION})

endfunction(add_sycl_rt_library)

set(SYCL_SOURCES
Expand Down
26 changes: 26 additions & 0 deletions sycl/source/version.rc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#define VER_FILEVERSION @SYCL_MAJOR_VERSION@,@SYCL_MINOR_VERSION@,@SYCL_PATCH_VERSION@,@SYCL_DEV_ABI_VERSION@
#define VER_FILEVERSION_STR "@SYCL_VERSION_STRING@\0"

#define VER_PRODUCTVERSION @SYCL_MAJOR_VERSION@,@SYCL_MINOR_VERSION@,0,0
#define VER_PRODUCTVERSION_STR "@SYCL_MAJOR_VERSION@.@SYCL_MINOR_VERSION@\0"

1 VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END
/* For some reason the ProductVersion would not appear unless I add */
/* the following section: VarFileInfo */
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 1252
END
END