Skip to content

Commit d26e73c

Browse files
authored
[sycl-rel-6_3] Extend clang version output (#20637)
Almost the same as #20520. Except it modifies `sycl-rel-nightly.yml` instead of `sycl-nightly.yml` and adds an input to specify a version of release.
1 parent fed9b59 commit d26e73c

File tree

9 files changed

+48
-1
lines changed

9 files changed

+48
-1
lines changed

.github/workflows/sycl-linux-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ jobs:
183183
id: build
184184
# Emulate default value for manual dispatch as we've run out of available arguments.
185185
run: cmake --build $GITHUB_WORKSPACE/build --target ${{ inputs.build_target || 'sycl-toolchain' }}
186+
- run: $GITHUB_WORKSPACE/build/bin/clang++ --version
186187
- name: check-llvm
187188
if: always() && !cancelled() && contains(inputs.changes, 'llvm')
188189
run: |

.github/workflows/sycl-rel-nightly.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,40 @@ name: SYCL Release Branch Nightly
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
sycl_build_info:
7+
description: |
8+
Compiler build info, e.g. "X.Y.Z release"
9+
510
611
permissions: read-all
712

813
jobs:
14+
get_build_info:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
info: ${{ steps.get_info.outputs.info }}
18+
steps:
19+
# TODO: version detection can be automated, e.g. by using branch name.
20+
- id: get_info
21+
run: |
22+
if [ -n "${{ inputs.sycl_build_info }}" ]; then
23+
echo "info=${{ inputs.sycl_build_info }}" >> $GITHUB_OUTPUT
24+
else
25+
date=$(date +'%Y-%m-%d')
26+
version="6.3.0"
27+
info="Nightly $date $version pre-release"
28+
echo "info=$info" >> $GITHUB_OUTPUT
29+
fi
30+
931
ubuntu2204_build:
32+
needs: get_build_info
1033
uses: ./.github/workflows/sycl-linux-build.yml
1134
secrets: inherit
1235
with:
1336
build_cache_root: "/__w/"
1437
build_artifact_suffix: default
15-
build_configure_extra_args: '-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_LIBDIR=lib --disable-jit --no-assertions --add_security_flags=sanitize --hip --cuda'
38+
build_configure_extra_args: '-DSYCL_BUILD_INFO="${{ needs.get_build_info.outputs.info }}" -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_LIBDIR=lib --disable-jit --no-assertions --add_security_flags=sanitize --hip --cuda'
1639
build_image: ghcr.io/intel/llvm/release_build:latest
1740
pack_release: 'true'
1841

@@ -73,6 +96,7 @@ jobs:
7396
sycl_toolchain_decompress_command: ${{ needs.ubuntu2204_build.outputs.artifact_decompress_command }}
7497

7598
build-win:
99+
needs: get_build_info
76100
uses: ./.github/workflows/sycl-windows-build.yml
77101
with:
78102
# We upload both Linux/Windows build via Github's "Releases"

.github/workflows/sycl-windows-build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ jobs:
153153
shell: bash
154154
run: |
155155
cmake --build build --target ${{ inputs.build_target }}
156+
- run: build/bin/clang++ --version
156157
- name: check-llvm
157158
if: always() && !cancelled() && contains(inputs.changes, 'llvm')
158159
shell: bash

clang/include/clang/Basic/Version.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ namespace clang {
6666
/// the CL_SYCL_LANGUAGE_VERSION and SYCL_LANGUAGE_VERSION macros.
6767
llvm::SmallVector<std::pair<llvm::StringRef, llvm::StringRef>, 2>
6868
getSYCLVersionMacros(const LangOptions &LangOpts);
69+
70+
/// Retrieves a string representing the Intel SYCL compiler build info.
71+
std::string getSYCLBuildInfo();
6972
}
7073

7174
#endif // LLVM_CLANG_BASIC_VERSION_H

clang/lib/Basic/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ add_custom_command(OUTPUT "${version_inc}"
4242
"-DLLVM_VC_REVISION=${llvm_vc_revision}"
4343
"-DLLVM_FORCE_VC_REVISION=${LLVM_FORCE_VC_REVISION}"
4444
"-DLLVM_FORCE_VC_REPOSITORY=${LLVM_FORCE_VC_REPOSITORY}"
45+
"-DSYCL_BUILD_INFO=${SYCL_BUILD_INFO}"
4546
-P "${generate_vcs_version_script}")
4647

4748
# Mark the generated header as being generated.

clang/lib/Basic/Version.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ std::string getClangVendor() {
6565
#endif
6666
}
6767

68+
std::string getSYCLBuildInfo() {
69+
#ifdef SYCL_BUILD_INFO
70+
return SYCL_BUILD_INFO;
71+
#else
72+
return "development";
73+
#endif
74+
}
75+
6876
std::string getClangFullRepositoryVersion() {
6977
std::string buf;
7078
llvm::raw_string_ostream OS(buf);

clang/lib/Driver/Driver.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2825,6 +2825,7 @@ void Driver::PrintSYCLToolHelp(const Compilation &C) const {
28252825
}
28262826

28272827
void Driver::PrintVersion(const Compilation &C, raw_ostream &OS) const {
2828+
OS << "Intel SYCL compiler " << getSYCLBuildInfo() << " build based on:\n";
28282829
if (IsFlangMode()) {
28292830
OS << getClangToolFullVersion("flang") << '\n';
28302831
} else {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// RUN: %clang --version 2>&1 | FileCheck %s
2+
3+
// CHECK: Intel SYCL compiler{{.*}}based on:

llvm/cmake/modules/GenerateVersionFromVCS.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ foreach(name IN LISTS NAMES)
5656
append_info(${name} "${revision}" "${repository}")
5757
endforeach()
5858

59+
if(SYCL_BUILD_INFO)
60+
file(APPEND "${HEADER_FILE}.tmp"
61+
"#define SYCL_BUILD_INFO \"${SYCL_BUILD_INFO}\"\n")
62+
endif()
63+
5964
# Copy the file only if it has changed.
6065
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
6166
"${HEADER_FILE}.tmp" "${HEADER_FILE}")

0 commit comments

Comments
 (0)