Skip to content

Commit cacd07b

Browse files
committed
[sycl-rel-6_3] Extend clang versin output
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 7ce4d2f commit cacd07b

File tree

8 files changed

+43
-2
lines changed

8 files changed

+43
-2
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: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,37 @@ name: SYCL Release Branch Nightly
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
sycl_build_info:
57

68
permissions: read-all
79

810
jobs:
11+
get_build_info:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
info: ${{ steps.get_info.outputs.info }}
15+
steps:
16+
# TODO: version detection can be automated, e.g. by using branch name.
17+
- id: get_info
18+
run: |
19+
if [ -n "${{ inputs.sycl_build_info }}" ]; then
20+
echo "info=${{ inputs.sycl_build_info }}" >> $GITHUB_OUTPUT
21+
else
22+
date=$(date +'%Y-%m-%d')
23+
version="6.3.0"
24+
info="Nightly $date $version pre-release"
25+
echo "info=$info" >> $GITHUB_OUTPUT
26+
fi
27+
928
ubuntu2204_build:
29+
needs: get_build_info
1030
uses: ./.github/workflows/sycl-linux-build.yml
1131
secrets: inherit
1232
with:
1333
build_cache_root: "/__w/"
1434
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'
35+
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'
1636
build_image: ghcr.io/intel/llvm/release_build:latest
1737
pack_release: 'true'
1838

@@ -78,9 +98,10 @@ jobs:
7898
sycl_toolchain_decompress_command: ${{ needs.ubuntu2204_build.outputs.artifact_decompress_command }}
7999

80100
build-win:
101+
needs: get_build_info
81102
uses: ./.github/workflows/sycl-windows-build.yml
82103
with:
83-
build_configure_extra_args: '-DLLVM_SPIRV_ENABLE_LIBSPIRV_DIS=off -DCMAKE_POSITION_INDEPENDENT_CODE=ON --disable-jit --no-assertions --add_security_flags=sanitize'
104+
build_configure_extra_args: '-DSYCL_BUILD_INFO="${{ needs.get_build_info.outputs.info }}" -DLLVM_SPIRV_ENABLE_LIBSPIRV_DIS=off -DCMAKE_POSITION_INDEPENDENT_CODE=ON --disable-jit --no-assertions --add_security_flags=sanitize'
84105
pack_release: 'true'
85106

86107
# 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 {

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)