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

caused compiler crash when adding cilk_spawn and cilk_sync #87

Closed
wheatman opened this issue May 8, 2019 · 2 comments
Closed

caused compiler crash when adding cilk_spawn and cilk_sync #87

wheatman opened this issue May 8, 2019 · 2 comments

Comments

@wheatman
Copy link

wheatman commented May 8, 2019

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:
0. 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

  1. ./OFM_no_locks.cpp:797:1: current parser token 'void'
  2. ./OFM_no_locks.cpp:744:11: LLVM IR generation of declaration 'OFM::double_list_par'
  3. ./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)
    Add reattach instruction #1 0x000000000152ae2e llvm::sys::RunSignalHandlers() (/efs/tools/tapir-6/build/bin/clang-6.0+0x152ae2e)
    Cilk For Continue Broken #2 0x000000000152af6a SignalHandler(int) (/efs/tools/tapir-6/build/bin/clang-6.0+0x152af6a)
    No error or warning emitted when using break inside cilk for. #3 0x00002b95b6bb0330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
    Add support for x = spawn foo() syntax #4 0x00000000017fdf1f clang::CodeGen::CodeGenFunction::DetachScope::FinishDetach() (/efs/tools/tapir-6/build/bin/clang-6.0+0x17fdf1f)
    Ensure Clang loop pragma's work on Parallel Loops #5 0x00000000017fe7c1 clang::CodeGen::CodeGenFunction::EmitCilkSpawnStmt(clang::CilkSpawnStmt const&) (/efs/tools/tapir-6/build/bin/clang-6.0+0x17fe7c1)
    Inline Functions: Move allocas to earliest detach point rather than don't move at all #6 0x00000000017029ec clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/efs/tools/tapir-6/build/bin/clang-6.0+0x17029ec)
    cilk_for sometimes doesn't work with clang #7 0x0000000001702e53 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1702e53)
    nested cilk_for does not compile #8 0x000000000173733e clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&, clang::Stmt const*) (/efs/tools/tapir-6/build/bin/clang-6.0+0x173733e)
    Nested cilk_for results in nonsense assertion failures #9 0x00000000017417b0 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/efs/tools/tapir-6/build/bin/clang-6.0+0x17417b0)
    Assertion `NewVal && "not a replaced load?"' failed. #10 0x000000000175de68 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/efs/tools/tapir-6/build/bin/clang-6.0+0x175de68)
    Two minor fixes #11 0x000000000176e494 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/efs/tools/tapir-6/build/bin/clang-6.0+0x176e494)
    [LowerToCilk] Fix memory leak. #12 0x000000000176f330 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/efs/tools/tapir-6/build/bin/clang-6.0+0x176f330)
    LoopSpawning causes incorrect behavior if the loop body makes use of LimitVar #13 0x000000000176fbc5 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) [clone .part.5223] (/efs/tools/tapir-6/build/bin/clang-6.0+0x176fbc5)
    Should I be able to pass nullptr for ExitBlocks into CloneIntoFunction() and CreateHelper()? #14 0x0000000001e59b53 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1e59b53)
    [Outline] Accept null ExitBlocks in CloneIntoFunction(). #15 0x0000000001e53801 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1e53801)
    [Outline] Accept null ExitBlocks in findInputsOutputs(). #16 0x0000000002025496 clang::ParseAST(clang::Sema&, bool, bool) (/efs/tools/tapir-6/build/bin/clang-6.0+0x2025496)
    Rhino LICM #17 0x0000000001e58014 clang::CodeGenAction::ExecuteAction() (/efs/tools/tapir-6/build/bin/clang-6.0+0x1e58014)
    OpenMP Backend for Tapir #18 0x0000000001a5fbfe clang::FrontendAction::Execute() (/efs/tools/tapir-6/build/bin/clang-6.0+0x1a5fbfe)
    [DO NOT MERGE] Re-enable -fdetach flag #19 0x0000000001a37d6d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1a37d6d)
    [LoopSpawning] Adding support for LoopSpawning to extract a grainsize… #20 0x0000000001aeb2c4 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/efs/tools/tapir-6/build/bin/clang-6.0+0x1aeb2c4)
    Omp fix #21 0x0000000000a75c98 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/efs/tools/tapir-6/build/bin/clang-6.0+0xa75c98)
    LoopSpawning reports that it did not transform anything if verifyFunction() fails. #22 0x0000000000a12401 main (/efs/tools/tapir-6/build/bin/clang-6.0+0xa12401)
    Basic parallel loop vectorization #23 0x00002b95b7aa5f45 __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
    Updating clang submodule #24 0x0000000000a71357 _start (/efs/tools/tapir-6/build/bin/clang-6.0+0xa71357)
    Stack dump:
  4. 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
  5. ./OFM_no_locks.cpp:797:1: current parser token 'void'
  6. ./OFM_no_locks.cpp:744:11: LLVM IR generation of declaration 'OFM::double_list_par'
  7. ./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 065b7e7)
    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 065b7e7)
    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
Copy link
Author

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
Copy link
Collaborator

neboat commented Jun 2, 2019

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

@neboat neboat closed this as completed Jun 2, 2019
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

2 participants