diff --git a/.github/workflows/sycl-linux-build.yml b/.github/workflows/sycl-linux-build.yml index caa49bad5f765..9e07a1aaa0094 100644 --- a/.github/workflows/sycl-linux-build.yml +++ b/.github/workflows/sycl-linux-build.yml @@ -183,6 +183,7 @@ jobs: id: build # Emulate default value for manual dispatch as we've run out of available arguments. run: cmake --build $GITHUB_WORKSPACE/build --target ${{ inputs.build_target || 'sycl-toolchain' }} + - run: $GITHUB_WORKSPACE/build/bin/clang++ --version - name: check-llvm if: always() && !cancelled() && contains(inputs.changes, 'llvm') run: | diff --git a/.github/workflows/sycl-rel-nightly.yml b/.github/workflows/sycl-rel-nightly.yml index 14de1478f1e9b..3ac0ec4badd8b 100644 --- a/.github/workflows/sycl-rel-nightly.yml +++ b/.github/workflows/sycl-rel-nightly.yml @@ -2,17 +2,40 @@ name: SYCL Release Branch Nightly on: workflow_dispatch: + inputs: + sycl_build_info: + description: | + Compiler build info, e.g. "X.Y.Z release" + permissions: read-all jobs: + get_build_info: + runs-on: ubuntu-latest + outputs: + info: ${{ steps.get_info.outputs.info }} + steps: + # TODO: version detection can be automated, e.g. by using branch name. + - id: get_info + run: | + if [ -n "${{ inputs.sycl_build_info }}" ]; then + echo "info=${{ inputs.sycl_build_info }}" >> $GITHUB_OUTPUT + else + date=$(date +'%Y-%m-%d') + version="6.3.0" + info="Nightly $date $version pre-release" + echo "info=$info" >> $GITHUB_OUTPUT + fi + ubuntu2204_build: + needs: get_build_info uses: ./.github/workflows/sycl-linux-build.yml secrets: inherit with: build_cache_root: "/__w/" build_artifact_suffix: default - build_configure_extra_args: '-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_LIBDIR=lib --disable-jit --no-assertions --add_security_flags=sanitize --hip --cuda' + 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' build_image: ghcr.io/intel/llvm/release_build:latest pack_release: 'true' @@ -73,6 +96,7 @@ jobs: sycl_toolchain_decompress_command: ${{ needs.ubuntu2204_build.outputs.artifact_decompress_command }} build-win: + needs: get_build_info uses: ./.github/workflows/sycl-windows-build.yml with: # We upload both Linux/Windows build via Github's "Releases" diff --git a/.github/workflows/sycl-windows-build.yml b/.github/workflows/sycl-windows-build.yml index b69dc9f196ef6..3fd08e2257e78 100644 --- a/.github/workflows/sycl-windows-build.yml +++ b/.github/workflows/sycl-windows-build.yml @@ -153,6 +153,7 @@ jobs: shell: bash run: | cmake --build build --target ${{ inputs.build_target }} + - run: build/bin/clang++ --version - name: check-llvm if: always() && !cancelled() && contains(inputs.changes, 'llvm') shell: bash diff --git a/clang/include/clang/Basic/Version.h b/clang/include/clang/Basic/Version.h index eb2c56f33c66b..a7708497b3dc4 100644 --- a/clang/include/clang/Basic/Version.h +++ b/clang/include/clang/Basic/Version.h @@ -66,6 +66,9 @@ namespace clang { /// the CL_SYCL_LANGUAGE_VERSION and SYCL_LANGUAGE_VERSION macros. llvm::SmallVector, 2> getSYCLVersionMacros(const LangOptions &LangOpts); + + /// Retrieves a string representing the Intel SYCL compiler build info. + std::string getSYCLBuildInfo(); } #endif // LLVM_CLANG_BASIC_VERSION_H diff --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt index db50315a6c689..643438f82f94a 100644 --- a/clang/lib/Basic/CMakeLists.txt +++ b/clang/lib/Basic/CMakeLists.txt @@ -42,6 +42,7 @@ add_custom_command(OUTPUT "${version_inc}" "-DLLVM_VC_REVISION=${llvm_vc_revision}" "-DLLVM_FORCE_VC_REVISION=${LLVM_FORCE_VC_REVISION}" "-DLLVM_FORCE_VC_REPOSITORY=${LLVM_FORCE_VC_REPOSITORY}" + "-DSYCL_BUILD_INFO=${SYCL_BUILD_INFO}" -P "${generate_vcs_version_script}") # Mark the generated header as being generated. diff --git a/clang/lib/Basic/Version.cpp b/clang/lib/Basic/Version.cpp index 84be9bb1d992d..42c7ab3a8353f 100644 --- a/clang/lib/Basic/Version.cpp +++ b/clang/lib/Basic/Version.cpp @@ -65,6 +65,14 @@ std::string getClangVendor() { #endif } +std::string getSYCLBuildInfo() { +#ifdef SYCL_BUILD_INFO + return SYCL_BUILD_INFO; +#else + return "development"; +#endif +} + std::string getClangFullRepositoryVersion() { std::string buf; llvm::raw_string_ostream OS(buf); diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index cae629698fac6..364f7a8fa5581 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -2825,6 +2825,7 @@ void Driver::PrintSYCLToolHelp(const Compilation &C) const { } void Driver::PrintVersion(const Compilation &C, raw_ostream &OS) const { + OS << "Intel SYCL compiler " << getSYCLBuildInfo() << " build based on:\n"; if (IsFlangMode()) { OS << getClangToolFullVersion("flang") << '\n'; } else { diff --git a/clang/test/Driver/sycl-build-info.c b/clang/test/Driver/sycl-build-info.c new file mode 100644 index 0000000000000..689caa964eac6 --- /dev/null +++ b/clang/test/Driver/sycl-build-info.c @@ -0,0 +1,3 @@ +// RUN: %clang --version 2>&1 | FileCheck %s + +// CHECK: Intel SYCL compiler{{.*}}based on: diff --git a/llvm/cmake/modules/GenerateVersionFromVCS.cmake b/llvm/cmake/modules/GenerateVersionFromVCS.cmake index 1b3b2946e62b2..b4a16d1b640c8 100644 --- a/llvm/cmake/modules/GenerateVersionFromVCS.cmake +++ b/llvm/cmake/modules/GenerateVersionFromVCS.cmake @@ -56,6 +56,11 @@ foreach(name IN LISTS NAMES) append_info(${name} "${revision}" "${repository}") endforeach() +if(SYCL_BUILD_INFO) + file(APPEND "${HEADER_FILE}.tmp" + "#define SYCL_BUILD_INFO \"${SYCL_BUILD_INFO}\"\n") +endif() + # Copy the file only if it has changed. execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${HEADER_FILE}.tmp" "${HEADER_FILE}")