wsmoses / Tapir-LLVM

Tapir extension to LLVM for optimizing Parallel Programs
Other
132 stars 24 forks source link

tapir bug when having double cilk_for loops #85

Closed wheatman closed 5 years ago

wheatman commented 5 years ago

The code can be found in https://github.com/wheatman/extended-csr/tree/old_stuff/extended-csr2

With the following code cilk_for (uint32_t i = 0; i < n; i++) { cilk_for (uint32_t j = 0; j < n; j++) { // find_value returns 0 if not found. uint32_t value = g->find_value(i, j); if (value != 0) { add_edge(i, j, value); } } }

The compiler crashes with the error at the bottom

If I change either of the cilk_for loops to normal for loops the error goes away

Note this is not an issue on master, but rather with WIP-taskinfo

Referring to a basic block in another function! invoke fastcc void @ZN3OFM7convertEP5Graph.outline.otd2(%class.Graph %0, i32 %41, %class.OFM %1, i32 %123) to label %146 unwind label %283, !dbg !29922 Referring to a basic block in another function! invoke fastcc void @ZN3OFM7convertEP5Graph.outline.otd2(%class.Graph %0, i32 %41, %class.OFM %1, i32 %123) to label %146 unwind label %283, !dbg !29922

0 0x000000000152cbda llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/efs/tools/tapir-6/build/bin/clang-6.0+0x152cbda)

1 0x000000000152ae2e llvm::sys::RunSignalHandlers() (/efs/tools/tapir-6/build/bin/clang-6.0+0x152ae2e)

2 0x000000000152af6a SignalHandler(int) (/efs/tools/tapir-6/build/bin/clang-6.0+0x152af6a)

3 0x00002ba6cd4e0330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)

4 0x00000000010afa7d llvm::BasicBlock::getTerminator() const (/efs/tools/tapir-6/build/bin/clang-6.0+0x10afa7d)

5 0x00000000010f9b1f llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::ChildrenGetter::Get(llvm::BasicBlock, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo) (/efs/tools/tapir-6/build/bin/clang-6.0+0x10f9b1f)

6 0x0000000001101820 unsigned int llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::runDFS<false, bool ()(llvm::BasicBlock, llvm::BasicBlock)>(llvm::BasicBlock, unsigned int, bool ()(llvm::BasicBlock, llvm::BasicBlock*), unsigned int) [clone .constprop.412] (/efs/tools/tapir-6/build/bin/clang-6.0+0x1101820)

7 0x0000000001101aa2 llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::CalculateFromScratch(llvm::DominatorTreeBase<llvm::BasicBlock, false>&, llvm::DomTreeBuilder::SemiNCAInfo<llvm::DominatorTreeBase<llvm::BasicBlock, false> >::BatchUpdateInfo*) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1101aa2)

8 0x0000000001101c81 llvm::DominatorTreeWrapperPass::runOnFunction(llvm::Function&) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1101c81)

9 0x00000000011417da llvm::FPPassManager::runOnFunction(llvm::Function&) (/efs/tools/tapir-6/build/bin/clang-6.0+0x11417da)

10 0x0000000001141873 llvm::FPPassManager::runOnModule(llvm::Module&) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1141873)

11 0x00000000011421c0 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/efs/tools/tapir-6/build/bin/clang-6.0+0x11421c0)

12 0x00000000016c9961 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete >) (/efs/tools/tapir-6/build/bin/clang-6.0+0x16c9961)

13 0x00000000016cb597 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete >) (/efs/tools/tapir-6/build/bin/clang-6.0+0x16cb597)

14 0x0000000001e587ab clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1e587ab)

15 0x0000000002025542 clang::ParseAST(clang::Sema&, bool, bool) (/efs/tools/tapir-6/build/bin/clang-6.0+0x2025542)

16 0x0000000001e58014 clang::CodeGenAction::ExecuteAction() (/efs/tools/tapir-6/build/bin/clang-6.0+0x1e58014)

17 0x0000000001a5fbfe clang::FrontendAction::Execute() (/efs/tools/tapir-6/build/bin/clang-6.0+0x1a5fbfe)

18 0x0000000001a37d6d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1a37d6d)

19 0x0000000001aeb2c4 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1aeb2c4)

20 0x0000000000a75c98 cc1_main(llvm::ArrayRef<char const>, char const, void*) (/efs/tools/tapir-6/build/bin/clang-6.0+0xa75c98)

21 0x0000000000a12401 main (/efs/tools/tapir-6/build/bin/clang-6.0+0xa12401)

22 0x00002ba6ce3d5f45 __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0

23 0x0000000000a71357 _start (/efs/tools/tapir-6/build/bin/clang-6.0+0xa71357)

Stack dump:

  1. Program arguments: /efs/tools/tapir-6/build/bin/clang-6.0 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-va lue-names -main-file-name test2.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -menable-no-infs -menable-no-nans -menable-unsafe-fp-math -fno-signed-zer os -mreassociate -freciprocal-math -fno-trapping-math -ffp-contract=fast -ffast-math -ffinite-math-only -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array - target-cpu haswell -target-feature +sse2 -target-feature +cx16 -target-feature -tbm -target-feature -avx512ifma -target-feature -gfni -target-feature -sha -target-feature -fm a4 -target-feature -vpclmulqdq -target-feature -prfchw -target-feature +bmi2 -target-feature -xsavec -target-feature +fsgsbase -target-feature +popcnt -target-feature +aes -t arget-feature -avx512bitalg -target-feature -xsaves -target-feature -avx512er -target-feature -avx512vnni -target-feature -avx512vpopcntdq -target-feature -clwb -target-featu re -avx512f -target-feature -clzero -target-feature -pku -target-feature +mmx -target-feature -lwp -target-feature -xop -target-feature -rdseed -target-feature -ibt -target-f eature -sse4a -target-feature -avx512bw -target-feature -clflushopt -target-feature +xsave -target-feature -avx512vbmi2 -target-feature -avx512vl -target-feature -avx512cd -t arget-feature +avx -target-feature -vaes -target-feature -rtm -target-feature +fma -target-feature +bmi -target-feature +rdrnd -target-feature -mwaitx -target-feature +sse4.1 -target-feature +sse4.2 -target-feature +avx2 -target-feature +sse -target-feature +lzcnt -target-feature +pclmul -target-feature -prefetchwt1 -target-feature +f16c -target- feature +ssse3 -target-feature -sgx -target-feature -shstk -target-feature +cmov -target-feature -avx512vbmi -target-feature +movbe -target-feature +xsaveopt -target-feature -avx512dq -target-feature -adx -target-feature -avx512pf -target-feature +sse3 -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -resource-dir /efs/tools/tapir-6/build/lib/clang/6.0.0 -c-isystem /efs/tools/tapir-6/build/lib/clang/5.0.0/include/ -cxx-isystem /efs/tools/tapir-6/build/lib/clang/5.0.0/include/ -interna l-isystem /usr/lib/gcc/x86_64-linux-gnu/5.4.1/../../../../include/c++/5.4.1 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/5.4.1/../../../../include/x86_64-linux-gnu/c++/5.4 .1 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/5.4.1/../../../../include/x86_64-linux-gnu/c++/5.4.1 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/5.4.1/../../../../incl ude/c++/5.4.1/backward -internal-isystem /usr/local/include -internal-isystem /efs/tools/tapir-6/build/lib/clang/6.0.0/include -internal-externc-isystem /usr/include/x86_64-l inux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wall -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /efs/home/wheatman/extended -csr/extended-csr2 -ferror-limit 19 -fmessage-length 174 -fcilkplus -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o /tmp/test2-a58efc.o -x c++ t est2.cpp
  2. parser at end of file
  3. Code generation
  4. Running pass 'Function Pass Manager' on module 'test2.cpp'.
  5. Running pass 'Dominator Tree Construction' on function '@ZN3OFM7convertEP5Graph.outline.otd1' clang-6.0: error: unable to execute command: Segmentation fault clang-6.0: error: clang frontend command failed due to signal (use -v to see invocation) clang version 6.0.0 (https://github.com/wsmoses/Tapir-Clang.git 190c083a326a7bee7dcf773d3ddd3e2e9240b719) (https://github.com/wsmoses/Tapir-LLVM.git 065b7e7497c8d91495a19b31c 6f144919cb77221) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /efs/tools/tapir-6/build/bin clang-6.0: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script. clang-6.0: note: diagnostic msg:

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang-6.0: note: diagnostic msg: /tmp/test2-7a40dd.cpp clang-6.0: note: diagnostic msg: /tmp/test2-7a40dd.sh clang-6.0: note: diagnostic msg:


make: *** [run] Error 254 test2-7a40dd.sh.txt test2-7a40dd.cpp.txt

neboat commented 5 years ago

I've tracked down this one to a buggy behavior arising from patterns with exception-handling code that only seem to appear with -O0 compilation. Running regressions now.

neboat commented 5 years ago

The latest version of the WIP-taskinfo branch seems to fix this issue.