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

AMD bug during linking #5

Open
AuroraPerego opened this issue Jun 14, 2023 · 0 comments
Open

AMD bug during linking #5

AuroraPerego opened this issue Jun 14, 2023 · 0 comments

Comments

@AuroraPerego
Copy link
Owner

AuroraPerego commented Jun 14, 2023

When compiling the SYCL version of pixeltrack-standalone for the AMD backend, it crashes during linking.
Command:

/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/bin/clang++ -O3 -fsycl -std=c++17 -O2 -fPIC -fdiagnostics-show-option -felide-constructors -fmessage-length=0 -fno-math-errno -ftree-vectorize -fvisibility-inlines-hidden -msse3 -pipe -pthread -Werror=address -Wall -Werror=array-bounds -Wno-attributes -Werror=conversion-null -Werror=delete-non-virtual-dtor -Wno-deprecated -Werror=format -Wno-long-long -Werror=main -Werror=missing-braces -Werror=narrowing -Wnon-virtual-dtor -Werror=overflow -Werror=overlength-strings -Wparentheses -Werror=pointer-arith -Wno-psabi -Werror=reorder -Wreturn-type -Werror=return-type -Werror=sign-compare -Werror=strict-aliasing -Wstrict-overflow -Werror=switch -Werror=type-limits -Wunused -Wno-unused-local-typedefs -Werror=unused-value -Wno-error=unused-variable -Wno-vla -Werror=write-strings -Wfatal-errors -g  -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch=gfx900 --rocm-path=/opt/rocm-5.0.2 -Wno-linker-warnings  \ 
   /afs/cern.ch/user/a/aperego/public/pixeltrack-standalone/obj/sycl/plugin-PixelTriplets/CAHitNtupletGeneratorKernelsAlloc.cc.o /afs/cern.ch/user/a/aperego/public/pixeltrack-standalone/obj/sycl/plugin-PixelTriplets/CAHitNtupletGeneratorOnGPU.cc.o /afs/cern.ch/user/a/aperego/public/pixeltrack-standalone/obj/sycl/plugin-PixelTriplets/HelixFitOnGPU.cc.o /afs/cern.ch/user/a/aperego/public/pixeltrack-standalone/obj/sycl/plugin-PixelTriplets/RiemannFitOnGPU.cc.o /afs/cern.ch/user/a/aperego/public/pixeltrack-standalone/obj/sycl/plugin-PixelTriplets/BrokenLineFitOnGPU.cc.o /afs/cern.ch/user/a/aperego/public/pixeltrack-standalone/obj/sycl/plugin-PixelTriplets/CAHitNtupletGeneratorKernels.cc.o /afs/cern.ch/user/a/aperego/public/pixeltrack-standalone/obj/sycl/plugin-PixelTriplets/CAHitNtupletSYCL.cc.o \
   -O2 -fPIC -pthread -Wl,-E -lstdc++fs -ldl -shared -Wl,-z,defs -L/afs/cern.ch/user/a/aperego/public/pixeltrack-standalone/lib/sycl -lFramework -lSYCLCore -lSYCLDataFormats -lCondFormats -lDataFormats -L/afs/cern.ch/user/a/aperego/public/pixeltrack-standalone/external/tbb/lib -ltbb  -L/afs/cern.ch/user/a/aperego/public/pixeltrack-standalone/external/boost/lib -L/afs/cern.ch/user/a/aperego/public/pixeltrack-standalone/external/libbacktrace/lib -lbacktrace \
   -o /afs/cern.ch/user/a/aperego/public/pixeltrack-standalone/lib/sycl/pluginPixelTriplets.so

Backtrace:

lld: /data/user/fwyzard/sycl/llvm/llvm/lib/Target/AMDGPU/SIOptimizeVGPRLiveRange.cpp:532: void {anonymous}::SIOptimizeVGPRLiveRange::optimizeLiveRange(llvm::Register, llvm::MachineBasicBlock*, llvm::MachineBasicBlock*, llvm::MachineBasicBlock*, llvm::SmallSetVector<llvm::MachineBasicBlock*, 16>&) const: Assertion `!O.readsReg()' failed.
PLEASE submit a bug report to https://github.com/intel/llvm/issues and include the crash backtrace.
Stack dump:
0.      Program arguments: /cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/bin/lld -flavor gnu -m elf64_amdgpu --no-undefined -shared -plugin-opt=-amdgpu-internalize-symbols -plugin-opt=mcpu=gfx900 -plugin-opt=O2 --lto-CGO2 -o /tmp/aperego/CAHitNtupletGeneratorKernelsAlloc-gfx900-4cc973-50fdf9.out /tmp/aperego/CAHitNtupletGeneratorKernelsAlloc-gfx900-6a6965-5bc87f.o
1.      Running pass 'CallGraph Pass Manager' on module 'ld-temp.o'.
2.      Running pass 'SI Optimize VGPR LiveRange' on function '@_ZN4Rfit10Circle_fitIN5Eigen5BlockINS1_3MapINS1_6MatrixIdLi3ELi3ELi0ELi3ELi3EEELi0ENS1_6StrideILi73728ELi24576EEEEELin1ELin1ELb0EEENS3_INS4_IdLi4ELi1ELi0ELi4ELi1EEELi0ENS1_11InnerStrideILi24576EEEEELi3EEENS_10circle_fitERKT_RKNS4_IdXmlLi2ET1_EXmlLi2ET1_EXorLNS1_14StorageOptionsE0EquaaeqmlLi2ET1_Li1EnemlLi2ET1_Li1ELSI_1EquaaeqmlLi2ET1_Li1EnemlLi2ET1_Li1ELSI_0ELSI_0EEXmlLi2ET1_EXmlLi2ET1_EEERKT0_RKNS4_IdXT1_ELi1EXorLSI_0EquaaeqT1_Li1EneLi1ELi1ELSI_1EquaaeqLi1ELi1EneT1_Li1ELSI_0ELSI_0EEXT1_ELi1EEEdb'
 #0 0x00007fc06e2cf8eb llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/lib/libLLVMSupport.so.17git+0x1b88eb)
 #1 0x00007fc06e2cd2f4 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fc06e888cf0 __restore_rt (/lib64/libpthread.so.0+0x12cf0)
 #3 0x00007fc06d470aff raise (/lib64/libc.so.6+0x4eaff)
 #4 0x00007fc06d443ea5 abort (/lib64/libc.so.6+0x21ea5)
 #5 0x00007fc06d443d79 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21d79)
 #6 0x00007fc06d469456 (/lib64/libc.so.6+0x47456)
 #7 0x00007fc06bbe1e2b (anonymous namespace)::SIOptimizeVGPRLiveRange::optimizeLiveRange(llvm::Register, llvm::MachineBasicBlock*, llvm::MachineBasicBlock*, llvm::MachineBasicBlock*, llvm::SmallSetVector<llvm::MachineBasicBlock*, 16u>&) const SIOptimizeVGPRLiveRange.cpp:0:0
 #8 0x00007fc06bbe749d (anonymous namespace)::SIOptimizeVGPRLiveRange::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SIOptimizeVGPRLiveRange.cpp:0:0
 #9 0x00007fc069259ec5 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#10 0x00007fc06a1e8776 llvm::FPPassManager::runOnFunction(llvm::Function&) (/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/lib/libLLVMCore.so.17git+0x277776)
#11 0x00007fc067626daa (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&) CallGraphSCCPass.cpp:0:0
#12 0x00007fc06a1e9263 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/lib/libLLVMCore.so.17git+0x278263)
#13 0x00007fc06b1734ba codegen(llvm::lto::Config const&, llvm::TargetMachine*, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex const&) LTOBackend.cpp:0:0
#14 0x00007fc06b173ba9 llvm::lto::backend(llvm::lto::Config const&, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex&) (/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/lib/libLLVMLTO.so.17git+0x45ba9)
#15 0x00007fc06b165c33 llvm::lto::LTO::runRegularLTO(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>) (/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/lib/libLLVMLTO.so.17git+0x37c33)
#16 0x00007fc06b166227 llvm::lto::LTO::run(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, std::function<llvm::Expected<std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>> (unsigned int, llvm::StringRef, llvm::Twine const&)>) (/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/lib/libLLVMLTO.so.17git+0x38227)
#17 0x00007fc06e6d8b22 lld::elf::BitcodeCompiler::compile() (/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/lib/liblldELF.so.17git+0x14bb22)
#18 0x00007fc06e64486f void lld::elf::LinkerDriver::compileBitcodeFiles<llvm::object::ELFType<(llvm::support::endianness)1, true>>(bool) (/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/lib/liblldELF.so.17git+0xb786f)
#19 0x00007fc06e65b8b5 lld::elf::LinkerDriver::link(llvm::opt::InputArgList&) (/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/lib/liblldELF.so.17git+0xce8b5)
#20 0x00007fc06e65d2eb lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/lib/liblldELF.so.17git+0xd02eb)
#21 0x00007fc06e65eb5a lld::elf::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) (/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/lib/liblldELF.so.17git+0xd1b5a)
#22 0x0000000000405e34 lldMain(int, char const**, llvm::raw_ostream&, llvm::raw_ostream&, bool) lld.cpp:0:0
#23 0x00000000004061ee lld_main(int, char**, llvm::ToolContext const&) (/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/bin/lld+0x4061ee)
#24 0x0000000000403411 main (/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/bin/lld+0x403411)
#25 0x00007fc06d45cd85 __libc_start_main (/lib64/libc.so.6+0x3ad85)
#26 0x000000000040344e _start (/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/bin/lld+0x40344e)
llvm-foreach: Aborted (core dumped)
clang++: fatal error: amdgcn-link command failed with exit code 254 (use -v to see invocation)
clang version 17.0.0 (https://github.com/intel/llvm 6b7424349ee3592909afde25f9921c4e8b83db10)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/bin

How to reproduce:

git clone https://github.com/cms-patatrack/pixeltrack-standalone.git
cd pixeltrack-standalone
# eventually change the SYCL_BASE at line 157 (default is the 2022-12 build)
make environment
source env.sh
make -j`nproc` sycl

or, as suggested in the backtrace, with the file CAHitNtupletGeneratorKernelsAlloc-gfx900-6a6965-5bc87f.o (93MB 😭 ):

/cvmfs/patatrack.cern.ch/externals/x86_64/rhel8/intel/sycl/nightly/20230613/bin/lld -flavor gnu -m elf64_amdgpu --no-undefined \
     -shared -plugin-opt=-amdgpu-internalize-symbols -plugin-opt=mcpu=gfx900 -plugin-opt=O2 --lto-CGO2 \
     -o /tmp/aperego/CAHitNtupletGeneratorKernelsAlloc-gfx900-4cc973-50fdf9.out \
     CAHitNtupletGeneratorKernelsAlloc-gfx900-6a6965-5bc87f.o

Info:
gcc version: 8.5.0 20210514 (Red Hat 8.5.0-16)
clang++ version: 17.0.0 (https://github.com/intel/llvm 6b7424349ee3592909afde25f9921c4e8b83db10) - sycl-nightly/20230613
rocm version used to build clang++: rocm-5.4.0

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

No branches or pull requests

1 participant