Skip to content
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

Update ROOT and Cling to LLVM18 #15696

Merged
merged 43 commits into from
Sep 11, 2024
Merged

Conversation

devajithvs
Copy link
Contributor

@devajithvs devajithvs commented May 31, 2024

This Pull request:

Rebase

A few relevant LLVM commits that were referenced for the rebase:

Notes

  • Cling and Root commits for the rebase are kept separate for now (can squash similar commits together later).
  • Also added a temporary commit root-project/llvm-project@4066693 in LLVM to prevent building of mlgo-utils, which will not compile when all the test folders are removed. We can either keep it or add an exception to this file in the Root GitHub workflow to not remove the test folders under mlgo-utils.

TO DISCUSS/PROPERLY FIX

  • The commit 64f7cf6 is memleaking; it is a temporary fix for now to prevent some failing tests, like gtest-roofit-histfactory-test-testHistFactory.
  • This commit: de5d141 is a temporarily fix reintroducing a memory leak.
  • This commit: d79963e fixes an issue with failing tests like tutorial-hist-cumulative when JITLink is turned on. This works for now, but will need to investigate further on why resource trackers were not destructed in the right order.
    • Not a critical issue: Can also look into this later after the merge.
  • Discussion on a proper solution for the macOS modulemap issue

Changes or fixes:

Checklist:

  • Fix mac13 build
  • tested changes locally
  • updated the docs (if necessary)

This PR fixes #

@devajithvs devajithvs self-assigned this May 31, 2024
@hahnjo hahnjo added in:Cling clean build Ask CI to do non-incremental build on PR labels May 31, 2024
Copy link

github-actions bot commented May 31, 2024

Test Results

    13 files      13 suites   3d 2h 28m 40s ⏱️
 3 029 tests  3 029 ✅ 0 💤 0 ❌
33 856 runs  33 856 ✅ 0 💤 0 ❌

Results for commit a52d34d.

♻️ This comment has been updated with latest results.

@stephanlachnit
Copy link
Contributor

I know this is totally not relevant for you, but I am still wondering: does this allow me to use system clang or are there still downstream patches required?

@hahnjo
Copy link
Member

hahnjo commented Jul 19, 2024

I know this is totally not relevant for you, but I am still wondering: does this allow me to use system clang or are there still downstream patches required?

Hi Stephan, no we still require downstream patches. Their number gets reduced on every upgrade, you can track the status for LLVM 18 here: https://github.com/root-project/llvm-project/commits/ROOT-llvm18. More importantly, and not yet reflected in ROOT-llvm18, we will now also require a patch to the core LLVM JIT infrastructure (until upgrading past LLVM 19): llvm/llvm-project#95532

@stephanlachnit
Copy link
Contributor

Thanks for the update!

@bellenot
Copy link
Member

bellenot commented Aug 9, 2024

Here is the stack trace on Windows:

  Generating etc/allDict.cxx.pch

  Generating PCH for bindings\tpython core core\clingutils core\imt core\rint core\thread graf2d\asimage graf2d\fitsio graf2d\gpad graf2d\gpadv7 graf2d\graf graf2d\postscript graf2d\primitivesv7 graf2d\win32gdk gr
  af3d\g3d graf3d\gl gui\fitpanel gui\fitpanelv7 gui\gui hist\hist hist\histdrawv7 hist\histpainter hist\histv7 hist\spectrum hist\spectrumpainter hist\unfold io\io math\genetic math\genvector math\mathcore math\m
  athmore math\matrix math\minuit math\minuit2 math\physics math\smatrix math\vecops net\net roofit\RDataFrameHelpers roofit\histfactory roofit\hs3 roofit\jsoninterface roofit\roofit roofit\roofitcore roofit\roofi
  tmore roofit\roostats tmva\pymva tmva\sofie tmva\tmva tmva\tmvagui tree\dataframe tree\ntuple tree\ntupleutil tree\tree tree\treeplayer tree\treeviewer tree\webviewer

  missing serialization code for annotation token
  UNREACHABLE executed at C:\root-dev\git\dev.llvm18\interpreter\llvm-project\clang\lib\Serialization\ASTWriter.cpp:4514!
  PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
  Stack dump:
  0.    Program arguments: .\\bin\\rootcling -rootbuild -generate-pch -f allDict.cxx -noDictSelection -D__CLING__ -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DROOT_PCH -I.\\include -I.\\etc -I.\\etc\\dictpch -
  I.\\etc\\cling -IC:\\Python311\\Lib\\site-packages\\numpy\\core\\include -IC:\\Python311\\include -IC:\\libs\\x64\\GSL\\2.7\\include -IC:\\libs\\x64\\libxml2\\2.7.8\\include -IC:\\libs\\x64\\sqlite3\\3.45.2 -IC:
  /root-dev/git/dev.llvm18/graf2d/win32gdk/gdk/src etc\\dictpch\\allHeaders.h -IC:/root-dev/git/dev.llvm18/graf2d/win32gdk/gdk/src -IC:/root-dev/git/dev.llvm18/graf2d/win32gdk/gdk/src/gdk -IC:/root-dev/git/dev.llv
  m18/graf2d/win32gdk/gdk/src/glib -IC:/root-dev/build/x64/dev.llvm18/include -IC:/root-dev/git/dev.llvm18/core etc\\dictpch\\allLinkDefs.h
  Exception Code: 0x80000003
   #0 0x00007ffc2c2306eb HandleAbort C:\root-dev\git\dev.llvm18\interpreter\llvm-project\llvm\lib\Support\Windows\Signals.inc:424:0
   #1 0x00007ffcabe91881 (C:\windows\System32\ucrtbase.dll+0x71881)
   #2 0x00007ffcabe92851 (C:\windows\System32\ucrtbase.dll+0x72851)
   #3 0x00007ffc2c1dad4c llvm::llvm_unreachable_internal(char const *, char const *, unsigned int) C:\root-dev\git\dev.llvm18\interpreter\llvm-project\llvm\lib\Support\ErrorHandling.cpp:212:0
   #4 0x00007ffc25258963 clang::ASTWriter::AddToken(class clang::Token const &, class llvm::SmallVectorImpl<unsigned __int64> &) C:\root-dev\git\dev.llvm18\interpreter\llvm-project\clang\lib\Serialization\ASTWrite
  r.cpp:4514:0
   #5 0x00007ffc2525399f clang::ASTWriter::WriteLateParsedTemplates(class clang::Sema &) C:\root-dev\git\dev.llvm18\interpreter\llvm-project\clang\lib\Serialization\ASTWriter.cpp:4340:0
   #6 0x00007ffc252568d1 clang::ASTWriter::WriteASTCore(class clang::Sema &, class llvm::StringRef, class clang::Module *) C:\root-dev\git\dev.llvm18\interpreter\llvm-project\clang\lib\Serialization\ASTWriter.cpp:
  5117:0
   #7 0x00007ffc2525852a clang::ASTWriter::WriteAST(class clang::Sema &, class llvm::StringRef, class clang::Module *, class llvm::StringRef, bool) C:\root-dev\git\dev.llvm18\interpreter\llvm-project\clang\lib\Ser
  ialization\ASTWriter.cpp:4649:0
   #8 0x00007ffc237996f8 WriteAST C:\root-dev\git\dev.llvm18\core\dictgen\src\rootcling_impl.cxx:2021:0
   #9 0x00007ffc23799959 GenerateAllDict C:\root-dev\git\dev.llvm18\core\dictgen\src\rootcling_impl.cxx:2042:0
  #10 0x00007ffc237ac399 RootClingMain(int, char **, bool) C:\root-dev\git\dev.llvm18\core\dictgen\src\rootcling_impl.cxx:5010:0
  #11 0x00007ffc2378c455 ROOT_rootcling_Driver C:\root-dev\git\dev.llvm18\core\dictgen\src\rootcling_impl.cxx:6238:0
  #12 0x00007ff68e2f2605 main C:\root-dev\git\dev.llvm18\main\src\rootcling.cxx:44:0
  #13 0x00007ff68e2f2924 invoke_main D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78:0
  #14 0x00007ff68e2f2924 __scrt_common_main_seh D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288:0
  #15 0x00007ffcacad7374 (C:\windows\System32\KERNEL32.DLL+0x17374)
  #16 0x00007ffcae65cc91 (C:\windows\SYSTEM32\ntdll.dll+0x4cc91)
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): error MSB8066: Custom build for 'C:\root-dev\build\x64\dev.llvm18\CMakeFiles\6485b15e5a52a9a93f
294ac9c6ea6f8f\allDict.cxx.pch.rule;C:\root-dev\build\x64\dev.llvm18\CMakeFiles\c2921ee0b70b9f5a32ad0eb8246e0cd2\onepcm.rule;C:\root-dev\git\dev.llvm18\CMakeLists.txt' exited with code -1. [C:\root-dev\build\x64\d
ev.llvm18\onepcm.vcxproj]

@hahnjo
Copy link
Member

hahnjo commented Aug 20, 2024

FWIW the current state compiles fine on RISC-V and is at least able to run df103_NanoAODHiggsAnalysis.py 😉

@devajithvs devajithvs force-pushed the dev.llvm18 branch 4 times, most recently from 81d5c1b to d79963e Compare August 21, 2024 12:10
@vgvassilev
Copy link
Member

@smuzaffar, @devajithvs and @hahnjo have everything working reasonably with the llvm18 upgrade. Can you check this PR against cmssw?

@vgvassilev
Copy link
Member

@smuzaffar, @devajithvs and @hahnjo have everything working reasonably with the llvm18 upgrade. Can you check this PR against cmssw?

@iarspider, could you give us a hand?

@dpiparo
Copy link
Member

dpiparo commented Aug 27, 2024

@smuzaffar, @devajithvs and @hahnjo have everything working reasonably with the llvm18 upgrade. Can you check this PR against cmssw?

@iarspider, could you give us a hand?

I allow myself to add @aandvalenzuela to perhaps get some help.

devajithvs and others added 28 commits September 10, 2024 16:07
- Include `StringExtras.h`
This is now needed due to:
llvm/llvm-project@3ff3af3
In LLVM 18 with incremental extensions enabled, the Preprocessor will
never report tok::eof, but tok::annot_repl_input_end instead.
Prevents failures such as:

```
Processing roottest/root/meta/runnamespace.C...
Error in cling::MetaProcessor: cannot read from binary input:
'runnamespace.C'
```
This is needed for macros that start with `{` after the rebase
C++20 builds were failing due to the commit:
llvm-project/commit/574ee1c02ef73b66c5957cf93888234b0471695f

with an error `imported non C++20 importable modules`
This makes them run after the <Platform> library: It provides the
__cxa_atexit function, which must not be found in the process.
LLVM now defines multiple Dylibs, and __cxa_atexit is provided in
the <Platform> library.
We started seeing an assertion failure in ~FinalizedAlloc when we
moved the generators to ProcessSymbols JITDylib:
[cling] Move generators to ProcessSymbols JITDylib

This ikely changed the destruction order that caused the assertion to
trigger.
This fixes the Cling test Driver/E.C.
This applies the upstream changes in commit
llvm/llvm-project@9992b38
to a copy of the modulemap from MacOSX14.2.sdk.
This fixes the failing python enum tests like:
- `roottest-python-cpp-cpp`
- `roottest-python-cmdLineUtils-ROOT_8197`

Also remove `R__BYTESWAP` which should not be needed anymore.

The leak was fixed with:
llvm/llvm-project#78311

This caused our tests to fail as they relied on the
previous behavior.
Upstream LLVM now unconditionally uses indirect / PC relative
personality encodings since commit
llvm/llvm-project@ca65969

This leads to references of DW.ref.__gxx_personality_v0 that cannot
be resolved with RuntimeDyld, that we are still using for the moment.
As a fix, auto-claim symbols as we are doing for PPC, see upstream commit:
llvm/llvm-project@72ea1a7
There are still failures with RuntimeDyld on AArch64 which seem to
be solved with JITLink, so make the switch now.
@dpiparo dpiparo merged commit 7f00674 into root-project:master Sep 11, 2024
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clean build Ask CI to do non-incremental build on PR in:Cling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants