wsmoses / Tapir-LLVM

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

caused compiler crash when adding cilk_spawn and cilk_sync #87

Closed wheatman closed 5 years ago

wheatman commented 5 years ago

The code can be found at https://github.com/wheatman/extended-csr/tree/another_issue make clean; make should cause the issue

I am still running on aws0 and I am not sure if Tim updated with the past fixes so this might already be fixed.

The change in the code that cause the issue was adding the cilk_spawn and cilk_sync to

  cilk_spawn memset((void*)&vals[new_N/2], 0, new_N*2);
  memset((void*)&dests[new_N/2], NULL_VAL, new_N*2);
  cilk_sync;

The error message is as follows

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 0x00002acbb07f8330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)

4 0x00000000017fdf1f clang::CodeGen::CodeGenFunction::DetachScope::FinishDetach() (/efs/tools/tapir-6/build/bin/clang-6.0+0x17fdf1f)

5 0x00000000017fe7c1 clang::CodeGen::CodeGenFunction::EmitCilkSpawnStmt(clang::CilkSpawnStmt const&) (/efs/tools/tapir-6/build/bin/clang-6.0+0x17fe7c1)

6 0x00000000017029ec clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const, llvm::ArrayRef<clang::Attr const>) (/efs/tools/tapir-6/build/bin/clang-6.0+0x17029ec)

7 0x0000000001702e53 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1702e53)

8 0x000000000173733e clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&, clang::Stmt const*) (/efs/tools/tapir-6/build/bin/clang-6.0+0x173733e)

9 0x00000000017417b0 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/efs/tools/tapir-6/build/bin/clang-6.0+0x17417b0)

10 0x000000000175de68 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/efs/tools/tapir-6/build/bin/clang-6.0+0x175de68)

11 0x000000000176e494 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/efs/tools/tapir-6/build/bin/clang-6.0+0x176e494)

12 0x000000000176f330 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/efs/tools/tapir-6/build/bin/clang-6.0+0x176f330)

13 0x000000000176fbc5 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) [clone .part.5223] (/efs/tools/tapir-6/build/bin/clang-6.0+0x176fbc5)

14 0x0000000001e59b53 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1e59b53)

15 0x0000000001e53801 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1e53801)

16 0x0000000002025496 clang::ParseAST(clang::Sema&, bool, bool) (/efs/tools/tapir-6/build/bin/clang-6.0+0x2025496)

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

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

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

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

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

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

23 0x00002acbb16edf45 __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0

24 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-llvm-bc -flto -flto-unit -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test_no_locks.cpp -static-define -mrelocation-model static -mthread-model posix -menable-no-infs -menable-no-nans -menable-unsafe-fp-math -fno-signed-zeros -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 -fma4 -target-feature -vpclmulqdq -target-feature -prfchw -target-feature +bmi2 -target-feature -xsavec -target-feature +fsgsbase -target-feature +popcnt -target-feature +aes -target-feature -avx512bitalg -target-feature -xsaves -target-feature -avx512er -target-feature -avx512vnni -target-feature -avx512vpopcntdq -target-feature -clwb -target-feature -avx512f -target-feature -clzero -target-feature -pku -target-feature +mmx -target-feature -lwp -target-feature -xop -target-feature -rdseed -target-feature -ibt -target-feature -sse4a -target-feature -avx512bw -target-feature -clflushopt -target-feature +xsave -target-feature -avx512vbmi2 -target-feature -avx512vl -target-feature -avx512cd -target-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 -momit-leaf-frame-pointer -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/ -internal-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/../../../../include/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-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wall -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /efs/home/wheatman/extended-csr -ferror-limit 19 -fmessage-length 0 -fcilkplus -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o /tmp/test_no_locks-e983a5.o -x c++ test_no_locks.cpp
  2. ./OFM_no_locks.cpp:797:1: current parser token 'void'
  3. ./OFM_no_locks.cpp:744:11: LLVM IR generation of declaration 'OFM::double_list_par'
  4. ./OFM_no_locks.cpp:744:11: Generating code for declaration 'OFM::double_list_par'

    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 0x00002b95b6bb0330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)

    4 0x00000000017fdf1f clang::CodeGen::CodeGenFunction::DetachScope::FinishDetach() (/efs/tools/tapir-6/build/bin/clang-6.0+0x17fdf1f)

    5 0x00000000017fe7c1 clang::CodeGen::CodeGenFunction::EmitCilkSpawnStmt(clang::CilkSpawnStmt const&) (/efs/tools/tapir-6/build/bin/clang-6.0+0x17fe7c1)

    6 0x00000000017029ec clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const, llvm::ArrayRef<clang::Attr const>) (/efs/tools/tapir-6/build/bin/clang-6.0+0x17029ec)

    7 0x0000000001702e53 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1702e53)

    8 0x000000000173733e clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&, clang::Stmt const*) (/efs/tools/tapir-6/build/bin/clang-6.0+0x173733e)

    9 0x00000000017417b0 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/efs/tools/tapir-6/build/bin/clang-6.0+0x17417b0)

    10 0x000000000175de68 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/efs/tools/tapir-6/build/bin/clang-6.0+0x175de68)

    11 0x000000000176e494 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/efs/tools/tapir-6/build/bin/clang-6.0+0x176e494)

    12 0x000000000176f330 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/efs/tools/tapir-6/build/bin/clang-6.0+0x176f330)

    13 0x000000000176fbc5 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) [clone .part.5223] (/efs/tools/tapir-6/build/bin/clang-6.0+0x176fbc5)

    14 0x0000000001e59b53 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1e59b53)

    15 0x0000000001e53801 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1e53801)

    16 0x0000000002025496 clang::ParseAST(clang::Sema&, bool, bool) (/efs/tools/tapir-6/build/bin/clang-6.0+0x2025496)

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

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

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

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

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

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

    23 0x00002b95b7aa5f45 __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0

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

    Stack dump:

  5. Program arguments: /efs/tools/tapir-6/build/bin/clang-6.0 -cc1 -triple x86_64-unknown-linux-gnu -emit-llvm-bc -flto -flto-unit -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test_no_locks.cpp -static-define -mrelocation-model static -mthread-model posix -menable-no-infs -menable-no-nans -menable-unsafe-fp-math -fno-signed-zeros -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 -fma4 -target-feature -vpclmulqdq -target-feature -prfchw -target-feature +bmi2 -target-feature -xsavec -target-feature +fsgsbase -target-feature +popcnt -target-feature +aes -target-feature -avx512bitalg -target-feature -xsaves -target-feature -avx512er -target-feature -avx512vnni -target-feature -avx512vpopcntdq -target-feature -clwb -target-feature -avx512f -target-feature -clzero -target-feature -pku -target-feature +mmx -target-feature -lwp -target-feature -xop -target-feature -rdseed -target-feature -ibt -target-feature -sse4a -target-feature -avx512bw -target-feature -clflushopt -target-feature +xsave -target-feature -avx512vbmi2 -target-feature -avx512vl -target-feature -avx512cd -target-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 -momit-leaf-frame-pointer -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/ -internal-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/../../../../include/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-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wall -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /efs/home/wheatman/extended-csr -ferror-limit 19 -fmessage-length 0 -fcilkplus -fcsi -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o /tmp/test_no_locks-163ed2.o -x c++ test_no_locks.cpp
  6. ./OFM_no_locks.cpp:797:1: current parser token 'void'
  7. ./OFM_no_locks.cpp:744:11: LLVM IR generation of declaration 'OFM::double_list_par'
  8. ./OFM_no_locks.cpp:744:11: Generating code for declaration 'OFM::double_list_par' clang-6.0: error: unable to execute command: Segmentation fault (core dumped) 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 065b7e7497c8d91495a19b31c6f144919cb77221) 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: error: unable to execute command: Segmentation fault (core dumped) 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 065b7e7497c8d91495a19b31c6f144919cb77221) 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/test_no_locks-b17b09.cpp clang-6.0: note: diagnostic msg: /tmp/test_no_locks-b17b09.sh clang-6.0: note: diagnostic msg:


make[1]: [.run.cilkscale] Error 254 make[1]: Waiting for unfinished jobs.... 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/test_no_locks-f6363a.cpp clang-6.0: note: diagnostic msg: /tmp/test_no_locks-f6363a.sh clang-6.0: note: diagnostic msg:


make[1]: [run] Error 254 make: [all] Error 2

wheatman commented 5 years ago

Some more details. It seems to be caused by the fact that I am spawning a built in directly. If I use my own version of memcpy, or if I wrap the memcpy in brackets

cilk_spawn {memcpy(...);}

The issue goes away.

neboat commented 5 years ago

Thanks for the bug report. The Tapir-Clang commit e6e26a6 seems to fix this issue.