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

compiler crash when using pgo #30

Closed
wheatman opened this issue Dec 7, 2020 · 2 comments
Closed

compiler crash when using pgo #30

wheatman opened this issue Dec 7, 2020 · 2 comments

Comments

@wheatman
Copy link
Contributor

wheatman commented Dec 7, 2020

tapir seems to crash whenever I try and compile something that uses profiles and has a cilk_for loop in it.
I used the following small example

#include <cilk/cilk.h>

int main() {
  int sum = 0;
  cilk_for(int i = 0; i < 1000000; i++) { sum += i; }

  return sum;
}

I compiled it as follows

../OpenCilk-9.0.1-Linux/bin/clang++  -g  -fopencilk  -lopencilk -fprofile-instr-generate -o profile del.cpp
./profile
../OpenCilk-9.0.1-Linux//bin/llvm-profdata merge -output=code.profdata default.profraw
../OpenCilk-9.0.1-Linux/bin/clang++  -g  -fopencilk  -lopencilk -fprofile-instr-use=code.profdata -o opt del.cpp

The version I am running is

../OpenCilk-9.0.1-Linux/bin/clang++ --version
clang version 9.0.1 (git@github.com:CilkHub/opencilk-project.git 48265098754b785d1b06cb08d8e22477a003efcd)
Target: x86_64-unknown-linux-gnu
Thread model: posix

The full backtrace is

clang-9: /home/gridsan/tschardl/opencilk-project/clang/lib/CodeGen/CodeGenPGO.cpp:1053: llvm::MDNode* clang::CodeGen::CodeGenFunction::createProfileWeightsForLoop(const clang::Stmt*, uint64_t): Assertion `CondCount.hasValue() && "missing expected loop condition count"' failed.
Stack dump:
0. Program arguments: /home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name del.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -fprofile-instrument-use-path=code.profdata -resource-dir /home/wheatman/OpenCilk-9.0.1-Linux/lib/clang/9.0.1 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/x86_64-linux-gnu/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/x86_64-linux-gnu/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/backward -internal-isystem /usr/local/include -internal-isystem /home/wheatman/OpenCilk-9.0.1-Linux/lib/clang/9.0.1/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/wheatman/PMA -ferror-limit 19 -fmessage-length 0 -fopencilk -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -faddrsig -o /tmp/del-e9abb3.o -x c++ del.cpp

  1.  <eof> parser at end of file
    
  2.  del.cpp:3:5: LLVM IR generation of declaration 'main'
    
  3.  del.cpp:3:5: Generating code for declaration 'main'
    

#0 0x0000564f81acb62a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x1aa462a)
#1 0x0000564f81ac92d4 llvm::sys::RunSignalHandlers() (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x1aa22d4)
#2 0x0000564f81ac9412 SignalHandler(int) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x1aa2412)
#3 0x00007fa40070e980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
#4 0x00007fa3ff568fb7 raise /build/glibc-S7xCS9/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
#5 0x00007fa3ff56a921 abort /build/glibc-S7xCS9/glibc-2.27/stdlib/abort.c:81:0
#6 0x00007fa3ff55a48a __assert_fail_base /build/glibc-S7xCS9/glibc-2.27/assert/assert.c:89:0
#7 0x00007fa3ff55a502 (/lib/x86_64-linux-gnu/libc.so.6+0x30502)
#8 0x0000564f81de032f clang::CodeGen::CodeGenFunction::createProfileWeightsForLoop(clang::Stmt const*, unsigned long) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x1db932f)
#9 0x0000564f81ed0450 clang::CodeGen::CodeGenFunction::EmitCilkForStmt(clang::CilkForStmt const&, llvm::ArrayRef<clang::Attr const*>) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x1ea9450)
#10 0x0000564f81d55db7 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x1d2edb7)
#11 0x0000564f81d5635c clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x1d2f35c)
#12 0x0000564f81d91437 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x1d6a437)
#13 0x0000564f81da102d clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x1d7a02d)
#14 0x0000564f81dd91bf clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x1db21bf)
#15 0x0000564f81dd6a85 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x1dafa85)
#16 0x0000564f81dd716b clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x1db016b)
#17 0x0000564f81ddd2a9 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.5677) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x1db62a9)
#18 0x0000564f82760e4d (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x2739e4d)
#19 0x0000564f827553c1 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x272e3c1)
#20 0x0000564f831c5304 clang::ParseAST(clang::Sema&, bool, bool) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x319e304)
#21 0x0000564f8275cd48 clang::CodeGenAction::ExecuteAction() (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x2735d48)
#22 0x0000564f821d8869 clang::FrontendAction::Execute() (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x21b1869)
#23 0x0000564f8219c441 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x2175441)
#24 0x0000564f82283eff clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0x225ceff)
#25 0x0000564f80ba2fbf cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0xb7bfbf)
#26 0x0000564f80b447e9 main (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0xb1d7e9)
#27 0x00007fa3ff54bbf7 __libc_start_main /build/glibc-S7xCS9/glibc-2.27/csu/../csu/libc-start.c:344:0
#28 0x0000564f80b9e7aa _start (/home/wheatman/OpenCilk-9.0.1-Linux/bin/clang-9+0xb777aa)
clang-9: error: unable to execute command: Aborted
clang-9: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 9.0.1 (git@github.com:CilkHub/opencilk-project.git 4826509)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/wheatman/PMA/../OpenCilk-9.0.1-Linux/bin
clang-9: note: diagnostic msg: PLEASE submit a bug report to https://github.com/OpenCilk/opencilk-project/issues and include the crash backtrace, preprocessed source, and associated run script.
clang-9: note: diagnostic msg:


PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-9: note: diagnostic msg: /tmp/del-4803b7.cpp
clang-9: note: diagnostic msg: /tmp/del-4803b7.sh
clang-9: note: diagnostic msg:


del-4803b7.sh.txt
del-4803b7.cpp.txt

@neboat
Copy link
Collaborator

neboat commented Dec 7, 2020

Thanks for the bug report. I can take a look.

neboat added a commit to neboat/opencilk-project that referenced this issue Dec 12, 2020
neboat added a commit that referenced this issue Dec 25, 2020
@neboat
Copy link
Collaborator

neboat commented Mar 6, 2021

This issue has been resolved in version 1.0.

@neboat neboat closed this as completed Mar 6, 2021
neboat added a commit to neboat/opencilk-project that referenced this issue Jun 13, 2022
neboat added a commit to neboat/opencilk-project that referenced this issue Nov 28, 2023
kennyzzhang pushed a commit to kennyzzhang/opencilk-project that referenced this issue Feb 2, 2024
neboat added a commit to neboat/opencilk-project that referenced this issue Jan 15, 2025
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