-
Notifications
You must be signed in to change notification settings - Fork 794
[Clang][CI] Extend clang version output #20520
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
base: sycl
Are you sure you want to change the base?
Conversation
This patch adds "Nightly build" string to clang version output. Previously it was like: clang version 22.0.0git (https://github.com/intel/llvm.git 2de7d37) Now it looks like: clang version 22.0.0git (https://github.com/intel/llvm.git 2de7d37 Nightly build) I'm preserving the repo path, but extending the revision. Anyways, we need to define both CLANG_VC_REPOSITORY and CLANG_VC_REVISION CMake variables to redefine the output, see: llvm/llvm/cmake/modules/GenerateVersionFromVCS.cmake Moreover, we need to define LLVM_VC_REPOSITORY & LLVM_VC_REVISION, because if it's not the same as CLANG_VC_* variables, there will be two sections of brackets after clang version, like: clang version 22.0.0git (https://github.com/intel/llvm.git 2de7d37) (https://github.com/intel/llvm.git 2de7d37 Nightly build) This is kind of hacky, but it allows as not to change the source code.
.github/workflows/sycl-nightly.yml
Outdated
| build_configure_extra_args: '--hip --cuda' | ||
| build_configure_extra_args: | | ||
| --hip --cuda \ | ||
| -DLLVM_VC_REPOSITORY="${{ github.repositoryUrl }}" -DLLVM_VC_REVISION="${{ github.sha }} Nightly build" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we're only doing this for the nightly, is there some benefit we get to knowing if someone is using the nightly or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll also add the same thing for nightly release builds like x.y.z pre-release build and x.y.z release build for official releases, so this is needed to distinguish them.
Why? How is the "nightly build" different from regular non-nightly build? |
What you mean by regular non-nightly build? There is a huge set of options on how to build the toolchain. Nightly builds are built in some specific way, tested properly enough and published. So there is a customer request to make the version info a bit more informative. |
For more details see: #20520 This PR adds branch:hash to nightly builds on release branches. It also allows to specify a custom version manually in case of official release builds, e.g. "6.3.0 release build".
I mean builds done by other workflows (e.g. pre-commit, post-commit, etc.).
What is missing in the current version info? How does you change make it more informative? |
Previous attempt: #20520 That one is kind of hacky, therefore proceeding with a more proper solution. There is a customer request to make clang version output more informative. This patch adds a string like this to the output: "Intel SYCL compiler X build based on:" - here goes regular clang output. Where X is "development" by default. "Nightly" for regular nightly builds. "X.Y.Z Nightly" for nightly release builds. "X.Y.Z release" for official releases.
@KornevNikita, why did you open another PR? Please, use one PR for all the discussions/review process. |
There is a customer request to make clang version output more informative. This patch adds a string like this to the output: "Intel SYCL compiler X build based on:" - here goes regular clang output. Where X is "development" by default. "Nightly" for regular nightly builds. "X.Y.Z Nightly" for nightly release builds. "X.Y.Z release" for official releases.
|
@bader I've updated the PR, could you please check the description, as the approach was changed a bit.
The build info is missing. Some people are using our nightly builds, so they need this info to distinguish builds, I guess. If you're still against this change, then we can drop it, as I have nothing to say more here. Maybe @AlexeySachkov has some. Anyways, we still need this change to mark our official releases, as of now clang says nothing about it. Do you have any concerns regarding this point? |
@mdtoguchi can you confirm this? I thought we emitted release information ? |
@KornevNikita, I'm confused. I don't understand what exactly the problem you are trying to solve by adding "Nightly" string to the version reported by the driver.
I agree. I would expect our compiler to emit the version similar to the upstream compiler. |
There is additional release information emitted with the Intel compiler, but as I understand it the intel/llvm bits just emit the clang version. |
CMPLRLLVM-68631 is the internal tracker number. Hash does not exactly describe where a build is coming from: for example a local build and a build downloaded from nightly can have the same hash, but they could be built with different flags or options (like support for device image compression, or SYCL JIT). Another benefit is that we can instantly compare two nightly builds to understand which one is newer/older, without having to look up a commit hash in the repo. However, I do not see this part being implemented despite it being mentioned in the description - without it just "Nightly" string alone does not bring much benefit |
Yes, there is such mechanism in the internal compiler version, but intel/llvm clang currently reports the same info as llvm-project clang.
Added date. |
|
I want @AlexeySachkov to decide the readiness of this change as he is in context of the customer request mentioned in the description. @KornevNikita, please, get approval from @AlexeySachkov before merging this PR. |
elizabethandrews
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add tests with mock values?
Hmm, it's kind of tricky since we need to re-build clang to get the updated output, not sure how to implement it. Do you have any thoughts? At least we could add a test to Nightly to check if the output is right. |
Can you manually define SYCL_BUILD_INFO for a FE/driver test? |
I'm not sure what you mean, could you please elaborate a bit? I believe this macro is backed into clang during compilation, so the only way to change it is to re-build the application, isn't it? |
AlexeySachkov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will also need a similar PR for the release branch, correct?
Overall, this looks good to me, but we must repeat the same on the release branch as well
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for debugging purposes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, but I'd like to keep this just in case.
| toolchain_decompress_command: ${{ needs.ubuntu2404_oneapi_build.outputs.toolchain_decompress_command }} | ||
|
|
||
| build-win: | ||
| needs: get_date |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A similar functionality is used in the tagging process below:
llvm/.github/workflows/sycl-nightly.yml
Lines 369 to 377 in 698f908
| - name: Compute tag | |
| id: tag | |
| run: | | |
| if [ "${{ github.event_name == 'schedule' }}" == "true" ]; then | |
| echo "TAG=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT" | |
| else | |
| # TODO: Use date of the commit? | |
| echo "TAG=$(date +'%Y-%m-%d')-${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" | |
| fi |
I suggest that we unify all places within this workflow file which rely on a date - I think that it is important that the date we put into nightly builds is aligned with tags that we push.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated here 479b59d
I was wondering if defining the macro manually with some mock value on the RUN line would be enough to get a test. Having said that though, I looked at some previous commits in llvm.org changing version information and I don't see tests added, so I am not sure if it is required. If the driver team approves this, then it is fine by me as well. |
|
@elizabethandrews thanks for the clarification. @intel/dpcpp-clang-driver-reviewers @intel/dpcpp-cfe-reviewers @intel/dpcpp-devops-reviewers could you please take a look? |
sarnex
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yaml lgtm
| } | ||
|
|
||
| void Driver::PrintVersion(const Compilation &C, raw_ostream &OS) const { | ||
| OS << "Intel SYCL compiler " << getSYCLBuildInfo() << " build based on:\n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This information would only be output via Driver invocation and other usages of getClangFullVersion() would just emit the clang version. Is there any reason to provide a more general version output as opposed to Driver only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, initially I tried to inline this into the getClangFullVersion() function. But, it causes many tests (~50) to fail, so some tweaking is required. On the other hand, the request was to just have this note in clang++ --version. So I decided to avoid additional test changes, as they seem excessive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the info - Given that please add a --version test to verify the output is as expected to the Driver LIT tests.
There is a customer request to make
clang++ --versionoutput moreinformative. This patch adds a string like this to the output:
"Intel SYCL compiler X build based on:" - here goes regular clang output.
Where X is "development" by default.
"Nightly YYYY-MM-DD" for regular nightly builds.
"X.Y.Z Nightly YYYY-MM-DD" for nightly release builds.
"X.Y.Z release" for official releases.