Issue 61521
Summary 16.0.0 Segmentation fault optimizing libomptarget-nvptx-sm_X.bc (same as #61399)
Labels new issue
Assignees
Reporter hpcpony
    I'm getting Segmentation faults trying to build 16.0.0 from source.

```
[user@buildh build.buildh.nocuda]$ cmake \
? -DLLVM_TARGETS_TO_BUILD=X86 \
? -DCMAKE_C_COMPILER=${HOST_GCC}/bin/gcc \
? -DCMAKE_CXX_COMPILER=${HOST_GCC}/bin/g++ \
? -DCMAKE_BUILD_TYPE="Release" \
? -DLIBOMP_ARCH="x86_64" \
? -DLIBOMPTARGET_BUILD_AMDGPU_PLUGIN="OFF" -DLIBOMPTARGET_BUILD_CUDA_PLUGIN="OFF"  \
? -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
? -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;cross-project-tests;flang;libclc;lld;lldb;mlir;openmp;polly;pstl" \
? -DLLVM_ENABLE_RUNTIMES="compiler-rt;libc;libcxx;libcxxabi;libunwind" \
? -DGCC_INSTALL_PREFIX=${HOST_GCC} \
? -DCMAKE_CXX_LINK_FLAGS="-L${HOST_GCC}/lib64 -Wl,-rpath,${HOST_GCC}/lib64"        \
? ../llvm
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
  .
  .
  .
-- Found LIBOMPTARGET_DEP_LIBFFI: /usr/lib64/libffi.so  
-- Could NOT find LIBOMPTARGET_DEP_CUDA_DRIVER (missing: LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES) 
-- Could NOT find LIBOMPTARGET_DEP_VEO (missing: LIBOMPTARGET_DEP_VEO_LIBRARIES LIBOMPTARGET_DEP_VEOSINFO_LIBRARIES LIBOMPTARGET_DEP_VEO_INCLUDE_DIRS) 
-- OMPT target enabled
-- OpenMP tools dir in libomptarget: /scratch/src/llvm-project-16.0.0.src/build.buildh.nocuda/projects/openmp/runtime/src
-- LIBOMPTARGET: Building offloading runtime library libomptarget.
-- LIBOMPTARGET: Not building aarch64 offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Not building AMDGPU offloading plugin: LIBOMPTARGET_BUILD_AMDGPU_PLUGIN is false
-- LIBOMPTARGET: Not building CUDA offloading plugin: LIBOMPTARGET_BUILD_CUDA_PLUGIN is false
-- LIBOMPTARGET: Not building PPC64 offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Not building PPC64le offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Not building nec-aurora plugin: libveo or libveosinfo not found.
-- LIBOMPTARGET: Building x86_64 offloading plugin.
-- LIBOMPTARGET: Not building aarch64 NextGen offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Not building AMDGPU NextGen offloading plugin: LIBOMPTARGET_BUILD_AMDGPU_PLUGIN is false
-- LIBOMPTARGET: Not building CUDA NextGen offloading plugin: LIBOMPTARGET_BUILD_CUDA_PLUGIN is false
-- LIBOMPTARGET: Not building PPC64 NextGen offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Not building PPC64le NextGen offloading plugin: machine not found in the system.
-- LIBOMPTARGET: Building x86_64 NextGen offloading plugin.
-- LIBOMPTARGET: Building DeviceRTL. Using clang from in-tree build
-- LIBOMPTARGET: Building the llvm-omp-device-info tool
-- LIBOMPTARGET: Building the llvm-omp-kernel-replay tool
   .
   .
 .
[ 35%] Built target omptarget-nvptx-sm_37-bc
[ 35%] Scanning dependencies of target omptarget-nvptx-sm_50-bc
[ 35%] Building LLVM bitcode Configuration.cpp-sm_50.bc
[ 35%] Building LLVM bitcode Debug.cpp-sm_50.bc
[ 35%] Building LLVM bitcode Kernel.cpp-sm_50.bc
[ 35%] Building LLVM bitcode LibC.cpp-sm_50.bc
[ 35%] Building LLVM bitcode Mapping.cpp-sm_50.bc
[ 35%] Building LLVM bitcode Misc.cpp-sm_50.bc
[ 35%] Building LLVM bitcode Parallelism.cpp-sm_50.bc
[ 35%] Building LLVM bitcode Reduction.cpp-sm_50.bc
[ 35%] Building LLVM bitcode State.cpp-sm_50.bc
[ 35%] Building LLVM bitcode Synchronization.cpp-sm_50.bc
[ 35%] Building LLVM bitcode Tasking.cpp-sm_50.bc
[ 35%] Building LLVM bitcode Utils.cpp-sm_50.bc
[ 35%] Building LLVM bitcode Workshare.cpp-sm_50.bc
[ 35%] Linking LLVM bitcode libomptarget-nvptx-sm_50.bc
[ 35%] Internalizing LLVM bitcode libomptarget-nvptx-sm_50.bc
[ 35%] Optimizing LLVM bitcode libomptarget-nvptx-sm_50.bc
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: ../../../../bin/opt -O3 -openmp-opt-disable -attributor-enable=module /scratch/src/llvm-project-16.0.0.src/build.buildh.nocuda/projects/openmp/libomptarget/DeviceRTL/internalized_libomptarget-nvptx-sm_50.bc -o /scratch/src/llvm-project-16.0.0.src/build.buildh.nocuda/projects/openmp/libomptarget/DeviceRTL/libomptarget-nvptx-sm_50.bc
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  opt 0x0000000001e024e1 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 225
1  opt             0x0000000001dfff74
2  libpthread.so.0 0x00007f3604cbe630
3  libc.so.6       0x00007f3603ce9f9e
4  opt 0x0000000001d90a2c llvm::StringMapImpl::LookupBucketFor(llvm::StringRef) + 380
5  opt             0x000000000165c1e3 llvm::ValueSymbolTable::createValueName(llvm::StringRef, llvm::Value*) + 243
6  opt             0x00000000016566c6 llvm::Value::setNameImpl(llvm::Twine const&) + 390
7  opt 0x00000000016567f9 llvm::Value::setName(llvm::Twine const&) + 9
8  opt 0x0000000001f62296 llvm::PredicateInfoBuilder::materializeStack(unsigned int&, llvm::SmallVectorImpl<llvm::ValueDFS>&, llvm::Value*) + 2886
9  opt 0x0000000001f6b402 llvm::PredicateInfoBuilder::renameUses(llvm::SmallVectorImpl<llvm::Value*>&) + 3474
10 opt             0x0000000001f6c0d1 llvm::PredicateInfoBuilder::buildPredicateInfo() + 2497
11 opt 0x0000000001f6c3b3 llvm::PredicateInfo::PredicateInfo(llvm::Function&, llvm::DominatorTree&, llvm::AssumptionCache&) + 291
12 opt 0x00000000017d935b
13 opt             0x00000000017d9b6e
14 opt 0x00000000017dbeaa llvm::IPSCCPPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) + 346
15 opt 0x000000000216083e
16 opt             0x000000000162df2f llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module>>::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) + 911
17 opt 0x0000000000813a34 llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool) + 5796
18 opt             0x00000000007627e1 main + 10161
19 libc.so.6 0x00007f3603ba1555 __libc_start_main + 245
20 opt 0x0000000000806d46
/bin/sh: line 1: 21945 Segmentation fault ../../../../bin/opt -O3 -openmp-opt-disable -attributor-enable=module /scratch/src/llvm-project-16.0.0.src/build.buildh.nocuda/projects/openmp/libomptarget/DeviceRTL/internalized_libomptarget-nvptx-sm_50.bc -o /scratch/src/llvm-project-16.0.0.src/build.buildh.nocuda/projects/openmp/libomptarget/DeviceRTL/libomptarget-nvptx-sm_50.bc
gmake[2]: *** [projects/openmp/libomptarget/DeviceRTL/libomptarget-nvptx-sm_50.bc] Error 139
gmake[1]: *** [projects/openmp/libomptarget/DeviceRTL/CMakeFiles/omptarget-nvptx-sm_50-bc.dir/all] Error 2
gmake: *** [all] Error 2
```

If I try to run the "opt" line by hand I do not get a Segmentation fault.

```
[user@buildh DeviceRTL]$ ../../../../bin/opt -O3 -openmp-opt-disable -attributor-enable=module /scratch/src/llvm-project-16.0.0.src/build.buildh.nocuda/projects/openmp/libomptarget/DeviceRTL/internalized_libomptarget-nvptx-sm_50.bc -o /scratch/src/llvm-project-16.0.0.src/build.buildh.nocuda/projects/openmp/libomptarget/DeviceRTL/libomptarget-nvptx-sm_50.bc
```

I tried this 4 different times (select combinations of 2 different hosts, 2 different compiler gcc 11.3.0, 12.2.0, with and without LIBOMPTARGET_BUILD_X).  They all get the Segmentation fault, but it happens on different versions of libomptarget-nvptx-sm_X.bc (X = 35, 37, 50, 70).

I'd be happy to just turn off anything related to NVidia  (and GPUs in general) because I don't have any of that hardware or software anyway.

OS: CentOS 7.9.2009
gcc: 11.3.0
cmake: 3.23.2
/bin/sh: 4.2.46(2)-release
gmake: 3.82

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to