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

hsimple.root compilation segfaults V6.28/06 with target znver3 and lto #14037

Closed
1 task done
dalel487 opened this issue Nov 9, 2023 · 4 comments
Closed
1 task done
Assignees
Labels

Comments

@dalel487
Copy link

dalel487 commented Nov 9, 2023

Check duplicate issues.

  • Checked for duplicates

Description

Compilation fails on the final step (hsimple.root). Cmake produces the following output

[2377/2377] Generating tutorials/hsimple.root
FAILED: tutorials/hsimple.root /home/user/Builds/root_build/tutorials/hsimple.root 
cd /home/user/Builds/root_build/tutorials && LD_LIBRARY_PATH=/home/user/Builds/root_build/lib:/opt/openmpi/lib:/opt/rocm/lib:/opt/nvidia/hpc_sdk/Linux_x86_64/23.3/cuda/12.0/targets/x86_64-linux/lib:/opt/AMD/aocl/aocl-linux-aocc-4.1.0/aocc/lib:/usr/lib64:/usr/lib:/opt/AMD/aocc-compiler-4.1.0.sles15/ompd:/opt/AMD/aocc-compiler-4.1.0.sles15/lib:/opt/AMD/aocc-compiler-4.1.0.sles15/lib32:/usr/lib/x86_64-linux-gnu:/usr/lib64:/usr/lib32:/usr/lib:/opt/openmpi/lib:/opt/rocm/lib:/opt/nvidia/hpc_sdk/Linux_x86_64/23.3/cuda/12.0/targets/x86_64-linux/lib:/opt/AMD/aocl/aocl-linux-aocc-4.1.0/aocc/lib:/usr/lib64:/usr/lib:/opt/AMD/aocc-compiler-4.1.0.sles15/ompd:/opt/AMD/aocc-compiler-4.1.0.sles15/lib:/opt/AMD/aocc-compiler-4.1.0.sles15/lib32:/usr/lib/x86_64-linux-gnu:/usr/lib64:/usr/lib32:/usr/lib: ROOTIGNOREPREFIX=1 ROOT_HIST=0 /home/user/Builds/root_build/bin/root.exe -l -q -b -n -x hsimple.C -e return

Processing hsimple.C...

 *** Break *** segmentation violation

There was a crash.
This is the entire stack trace of all threads:

#0  0x00007f2dab100ad7 in __GI___wait4 (pid=5485, stat_loc=stat_loc
entry=0x7fff17431338, options=options
entry=0, usage=usage
entry=0x0) at ../sysdeps/unix/sysv/linux/wait4.c:30
#1  0x00007f2dab100c4b in __GI___waitpid (pid=<optimized out>, stat_loc=stat_loc
entry=0x7fff17431338, options=options
entry=0) at waitpid.c:38
#2  0x00007f2dab05051b in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:172
#3  0x00007f2dabac274b in TUnixSystem::StackTrace() () from /home/user/Builds/root_build/lib/libCore.so
#4  0x00007f2dabac7624 in TUnixSystem::DispatchSignals(ESignals) () from /home/user/Builds/root_build/lib/libCore.so
#5  <signal handler called>
#6  0x00007f2da746e068 in llvm::PHINode::getIncomingValueForBlock(llvm::BasicBlock const*) const () from /home/user/Builds/root_build/lib/libCling.so
#7  0x00007f2da82a91e8 in llvm::TryToSimplifyUncondBranchFromEmptyBlock(llvm::BasicBlock*, llvm::DomTreeUpdater*) () from /home/user/Builds/root_build/lib/libCling.so
#8  0x00007f2da83255f9 in llvm::simplifyCFG(llvm::BasicBlock*, llvm::TargetTransformInfo const&, llvm::DomTreeUpdater*, llvm::SimplifyCFGOptions const&, llvm::ArrayRef<llvm::WeakVH>) () from /home/user/Builds/root_build/lib/libCling.so
#9  0x00007f2da7e3dac6 in iterativelySimplifyCFG(llvm::Function&, llvm::TargetTransformInfo const&, llvm::DomTreeUpdater*, llvm::SimplifyCFGOptions const&) () from /home/user/Builds/root_build/lib/libCling.so
#10 0x00007f2da7e62d63 in simplifyFunctionCFGImpl(llvm::Function&, llvm::TargetTransformInfo const&, llvm::DominatorTree*, llvm::SimplifyCFGOptions const&) () from /home/user/Builds/root_build/lib/libCling.so
#11 0x00007f2da87a6698 in llvm::FPPassManager::runOnFunction(llvm::Function&) () from /home/user/Builds/root_build/lib/libCling.so
#12 0x00007f2da87a699e in llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&) () from /home/user/Builds/root_build/lib/libCling.so
#13 0x00007f2da625bdb7 in cling::Interpreter::executeTransaction(cling::Transaction&) () from /home/user/Builds/root_build/lib/libCling.so
#14 0x00007f2da62a2d7a in cling::IncrementalParser::commitTransaction(llvm::PointerIntPair<cling::Transaction*, 2u, cling::IncrementalParser::EParseResult, llvm::PointerLikeTypeTraits<cling::Transaction*>, llvm::PointerIntPairInfo<cling::Transaction*, 2u, llvm::PointerLikeTypeTraits<cling::Transaction*> > >&, bool) () from /home/user/Builds/root_build/lib/libCling.so
#15 0x00007f2da62ae449 in cling::MetaSema::actOnLCommand(llvm::StringRef, cling::Transaction**) () from /home/user/Builds/root_build/lib/libCling.so
#16 0x00007f2da8ac18f5 in cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) [clone .constprop.0] () from /home/user/Builds/root_build/lib/libCling.so
#17 0x00007f2da61776e9 in HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /home/user/Builds/root_build/lib/libCling.so
#18 0x00007f2da61bdc7f in TCling::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /home/user/Builds/root_build/lib/libCling.so
#19 0x00007f2da61be51e in TCling::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) () from /home/user/Builds/root_build/lib/libCling.so
#20 0x00007f2dab964d69 in TApplication::ExecuteFile(char const*, int*, bool) () from /home/user/Builds/root_build/lib/libCore.so
#21 0x00007f2dabd06bdc in TRint::ProcessLineNr(char const*, char const*, int*) () from /home/user/Builds/root_build/lib/libRint.so
#22 0x00007f2dabd0f3ad in TRint::Run(bool) () from /home/user/Builds/root_build/lib/libRint.so
#23 0x00000000004011ad in main ()
===========================================================


The lines below might hint at the cause of the crash. If you see question
marks as part of the stack trace, try to recompile with debugging information
enabled and export CLING_DEBUG=1 environment variable before running.
You may get help by asking at the ROOT forum https://root.cern/forum
Only if you are really convinced it is a bug in ROOT then please submit a
report at https://root.cern/bugs Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#6  0x00007f2da746e068 in llvm::PHINode::getIncomingValueForBlock(llvm::BasicBlock const*) const () from /home/user/Builds/root_build/lib/libCling.so
#7  0x00007f2da82a91e8 in llvm::TryToSimplifyUncondBranchFromEmptyBlock(llvm::BasicBlock*, llvm::DomTreeUpdater*) () from /home/user/Builds/root_build/lib/libCling.so
#8  0x00007f2da83255f9 in llvm::simplifyCFG(llvm::BasicBlock*, llvm::TargetTransformInfo const&, llvm::DomTreeUpdater*, llvm::SimplifyCFGOptions const&, llvm::ArrayRef<llvm::WeakVH>) () from /home/user/Builds/root_build/lib/libCling.so
#9  0x00007f2da7e3dac6 in iterativelySimplifyCFG(llvm::Function&, llvm::TargetTransformInfo const&, llvm::DomTreeUpdater*, llvm::SimplifyCFGOptions const&) () from /home/user/Builds/root_build/lib/libCling.so
#10 0x00007f2da7e62d63 in simplifyFunctionCFGImpl(llvm::Function&, llvm::TargetTransformInfo const&, llvm::DominatorTree*, llvm::SimplifyCFGOptions const&) () from /home/user/Builds/root_build/lib/libCling.so
#11 0x00007f2da87a6698 in llvm::FPPassManager::runOnFunction(llvm::Function&) () from /home/user/Builds/root_build/lib/libCling.so
#12 0x00007f2da87a699e in llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&) () from /home/user/Builds/root_build/lib/libCling.so
#13 0x00007f2da625bdb7 in cling::Interpreter::executeTransaction(cling::Transaction&) () from /home/user/Builds/root_build/lib/libCling.so
#14 0x00007f2da62a2d7a in cling::IncrementalParser::commitTransaction(llvm::PointerIntPair<cling::Transaction*, 2u, cling::IncrementalParser::EParseResult, llvm::PointerLikeTypeTraits<cling::Transaction*>, llvm::PointerIntPairInfo<cling::Transaction*, 2u, llvm::PointerLikeTypeTraits<cling::Transaction*> > >&, bool) () from /home/user/Builds/root_build/lib/libCling.so
#15 0x00007f2da62ae449 in cling::MetaSema::actOnLCommand(llvm::StringRef, cling::Transaction**) () from /home/user/Builds/root_build/lib/libCling.so
#16 0x00007f2da8ac18f5 in cling::MetaProcessor::process(llvm::StringRef, cling::Interpreter::CompilationResult&, cling::Value*, bool) [clone .constprop.0] () from /home/user/Builds/root_build/lib/libCling.so
#17 0x00007f2da61776e9 in HandleInterpreterException(cling::MetaProcessor*, char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /home/user/Builds/root_build/lib/libCling.so
===========================================================


free(): invalid next size (fast)
ninja: build stopped: subcommand failed.

Notes:

  • I've pasted the instructions used to build the code in the reproducer section. Compiler is gcc-13/g++-13 from OpenSUSE repos and target architecture is znver3 (5800X3D)
  • I had to make a small change to root_src/interpreter/cling/lib/Interpreter/CIFactory.cpp. The option argvCompile.push_back("-O0 -fno-omit-frame-pointer"); at line 1349 needed to be split into two lines. This bug appears to be unrelated.

Unfortunately I'm writing this in a rush so may have missed something that you need/got the formatting ugly. Don't be afraid to ask if you need any clarification.
Thanks!

Reproducer

mkdir root_build;
git clone --branch latest-stable --depth=1 https://github.com/root-project/root.git root_src
cd root_build
cmake --build . --target clean && rm -rf ./* &&  cmake -G Ninja -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=gcc-13 -DCMAKE_CXX_COMPILER=g++-13 -DCMAKE_Fortran_COMPILER=gfortran-13 -DCMAKE_ASM_FLAGS="-flto -march=native" -DCMAKE_C_FLAGS="-flto -march=native" -DCMAKE_CXX_FLAGS="-flto -march=native" -DCMAKE_ASM_FLAGS_RELEASE="-O3 -DNDEBUG" -DCMAKE_C_FLAGS_RELEASE="-O3 -DNDEBUG" -DCMAKE_CXX_FLAGS_RELEASE="-O3 -DNDEBUG" -Dccache=ON -Dgnuinstall=ON -Dimt=OFF -Dminuit2-omp=ON -Dminuit2-mpi=ON -Dminuit2=ON -Dmpi=ON -Dpyroot=OFF -Dxrootd=OFF -Dveccore=ON -Dvc=ON -Dcudnn=OFF -Dtmva-pymva=OFF -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU"  -Ddoxygen=ON ../root_src && clear && cmake --build . -- -j 16

CMakeCache.txt

ROOT version

V6.28/06

Installation method

Built from source

Operating system

Linux version 6.5.9-1-default (geeko@buildhost) (gcc (SUSE Linux) 13.2.1 20230912 [revision b96e66fd4ef3e36983969fb8cdd1956f551a074b], GNU ld (GNU Binutils; openSUSE Tumbleweed) 2.40.0.20230412-5) #1 SMP PREEMPT_DYNAMIC Wed Oct 25 10:31:37 UTC 2023 (29edc7c)

Additional context

No response

@dalel487 dalel487 added the bug label Nov 9, 2023
@dalel487
Copy link
Author

dalel487 commented Nov 10, 2023

Tried again with v6.28/08. Same result.

@dalel487 dalel487 changed the title hsimple.root compilation segfaults V6.28/-6 hsimple.root compilation segfaults V6.28/06 Nov 10, 2023
@Axel-Naumann Axel-Naumann changed the title hsimple.root compilation segfaults V6.28/06 hsimple.root compilation segfaults V6.28/06 with target znver3 Dec 4, 2023
@Axel-Naumann
Copy link
Member

@dalel487 do you know whether lto actually works with llvm?

@Axel-Naumann Axel-Naumann changed the title hsimple.root compilation segfaults V6.28/06 with target znver3 hsimple.root compilation segfaults V6.28/06 with target znver3 and lto Dec 4, 2023
@dalel487
Copy link
Author

dalel487 commented Dec 7, 2023

Just tried without lto and it worked. Tried another machine with icx without ipo (Intel's version of lto) and it also compiled there.

Problem solved. Don't use lto. Thanks!

@dalel487 dalel487 closed this as completed Dec 7, 2023
Copy link

github-actions bot commented Dec 8, 2023

Hi @dalel487, @Axel-Naumann,

It appears this issue is closed, but wasn't yet added to a project. Please add upcoming versions that will include the fix, or 'not applicable' otherwise.

Sincerely,
🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

2 participants