Comments (3)
Is CIR ready to compile real world workloads?
Actually clangir fails to compile the most trivial C++20 coroutine example I could make, see https://godbolt.org/z/36K7WE4n1. Besides, clangir is also missing a lot of features that the original clang CodeGen supports. So I think it's not yet ready for real-world workloads.
from clangir.
I tried to use CIR to compile my coroutine library (https://github.com/alibaba/async_simple) but it crashed. I am not sure if I missed something.
Reproducer:
git clone [email protected]:alibaba/async_simple.git
cd async_simple
mkdir build && cd build
CXX=clang++ CC=clang cmake ../ -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-fclangir-enable -fclangir-lifetime-check -fclangir-idiom-recognizer -Wno-unused-command-line-argument"
make
the crash log is:
NYI
UNREACHABLE executed at /home/chuanqi.xcq/cir-project/clang/lib/CIR/CodeGen/CIRGenTypes.cpp:74!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/chuanqi.xcq/cir-project/build/bin/clang++ -I/home/chuanqi.xcq/async_simple -fclangir-enable -fclangir-lifetime-check -fclangir-idiom-recognizer -Wno-unused-command-line-argument -std=c++20 -D_GLIBCXX_USE_CXX11_ABI=1 -Wno-deprecated-register -Wno-mismatched-new-delete -Wno-deprecated-declarations -D_FILE_OFFSET_BITS=64 -fPIC -Wall -Werror -D__STDC_LIMIT_MACROS -g -Wno-uninitialized -m64 -DTARGET_64 -O2 -DNDEBUG -std=gnu++20 -MD -MT async_simple/CMakeFiles/async_simple_static.dir/uthread/internal/thread.cc.o -MF CMakeFiles/async_simple_static.dir/uthread/internal/thread.cc.o.d -o CMakeFiles/async_simple_static.dir/uthread/internal/thread.cc.o -c /home/chuanqi.xcq/async_simple/async_simple/uthread/internal/thread.cc
1. <eof> parser at end of file
2. /home/chuanqi.xcq/async_simple/async_simple/uthread/internal/thread.cc:29:11: LLVM IR generation of declaration 'async_simple'
#0 0x0000000002351148 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x2351148)
#1 0x000000000234ee2c llvm::sys::CleanupOnSignal(unsigned long) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x234ee2c)
#2 0x000000000229d218 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007ffff7fb5100 __restore_rt sigaction.c:0:0
#4 0x00007ffff7683605 raise (/lib64/libc.so.6+0x3d605)
#5 0x00007ffff766c8a2 abort (/lib64/libc.so.6+0x268a2)
#6 0x00000000022a639a (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x22a639a)
#7 0x0000000003776277 cir::CIRGenTypes::getRecordTypeName[abi:cxx11](clang::RecordDecl const*, llvm::StringRef) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x3776277)
#8 0x00000000037767af cir::CIRGenTypes::convertRecordDeclType(clang::RecordDecl const*) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x37767af)
#9 0x000000000377945d cir::CIRGenTypes::ConvertType(clang::QualType) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x377945d)
#10 0x000000000377b9ba cir::CIRGenTypes::convertTypeForMem(clang::QualType, bool) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x377b9ba)
#11 0x0000000003785fec (anonymous namespace)::CIRRecordLowering::lower(bool) CIRRecordLayoutBuilder.cpp:0:0
#12 0x0000000003788919 cir::CIRGenTypes::computeRecordLayout(clang::RecordDecl const*, mlir::cir::StructType*) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x3788919)
#13 0x00000000037765bd cir::CIRGenTypes::convertRecordDeclType(clang::RecordDecl const*) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x37765bd)
#14 0x000000000377659d cir::CIRGenTypes::convertRecordDeclType(clang::RecordDecl const*) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x377659d)
#15 0x000000000377945d cir::CIRGenTypes::ConvertType(clang::QualType) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x377945d)
#16 0x000000000377b9ba cir::CIRGenTypes::convertTypeForMem(clang::QualType, bool) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x377b9ba)
#17 0x0000000003785fec (anonymous namespace)::CIRRecordLowering::lower(bool) CIRRecordLayoutBuilder.cpp:0:0
#18 0x0000000003788919 cir::CIRGenTypes::computeRecordLayout(clang::RecordDecl const*, mlir::cir::StructType*) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x3788919)
#19 0x00000000037765bd cir::CIRGenTypes::convertRecordDeclType(clang::RecordDecl const*) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x37765bd)
#20 0x000000000377945d cir::CIRGenTypes::ConvertType(clang::QualType) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x377945d)
#21 0x000000000377b9ba cir::CIRGenTypes::convertTypeForMem(clang::QualType, bool) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x377b9ba)
#22 0x0000000003785fec (anonymous namespace)::CIRRecordLowering::lower(bool) CIRRecordLayoutBuilder.cpp:0:0
#23 0x0000000003788919 cir::CIRGenTypes::computeRecordLayout(clang::RecordDecl const*, mlir::cir::StructType*) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x3788919)
#24 0x00000000037765bd cir::CIRGenTypes::convertRecordDeclType(clang::RecordDecl const*) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x37765bd)
#25 0x0000000003777338 cir::CIRGenTypes::convertRecordDeclType(clang::RecordDecl const*) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x3777338)
#26 0x000000000377945d cir::CIRGenTypes::ConvertType(clang::QualType) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x377945d)
#27 0x0000000003771a14 cir::CIRGenModule::buildGlobalVarDefinition(clang::VarDecl const*, bool) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x3771a14)
#28 0x00000000037730e6 cir::CIRGenModule::buildGlobal(clang::GlobalDecl) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x37730e6)
#29 0x0000000003773551 cir::CIRGenModule::buildTopLevelDecl(clang::Decl*) (.part.0) CIRGenModule.cpp:0:0
#30 0x00000000037739b5 cir::CIRGenModule::buildDeclContext(clang::DeclContext const*) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x37739b5)
#31 0x0000000003773619 cir::CIRGenModule::buildTopLevelDecl(clang::Decl*) (.part.0) CIRGenModule.cpp:0:0
#32 0x00000000037739b5 cir::CIRGenModule::buildDeclContext(clang::DeclContext const*) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x37739b5)
#33 0x0000000003773619 cir::CIRGenModule::buildTopLevelDecl(clang::Decl*) (.part.0) CIRGenModule.cpp:0:0
#34 0x00000000037739b5 cir::CIRGenModule::buildDeclContext(clang::DeclContext const*) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x37739b5)
#35 0x0000000003773619 cir::CIRGenModule::buildTopLevelDecl(clang::Decl*) (.part.0) CIRGenModule.cpp:0:0
#36 0x000000000375fc49 cir::CIRGenerator::HandleTopLevelDecl(clang::DeclGroupRef) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x375fc49)
#37 0x00000000036b053f cir::CIRGenConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x36b053f)
#38 0x00000000057a3a14 clang::ParseAST(clang::Sema&, bool, bool) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x57a3a14)
#39 0x00000000036b2518 cir::CIRGenAction::ExecuteAction() (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x36b2518)
#40 0x0000000002e399b9 clang::FrontendAction::Execute() (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x2e399b9)
#41 0x0000000002db7aee clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x2db7aee)
#42 0x0000000002f191fc clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x2f191fc)
#43 0x0000000000fd1896 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0xfd1896)
#44 0x0000000000fc935a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#45 0x0000000002c0ab79 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#46 0x000000000229d6c4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x229d6c4)
#47 0x0000000002c0b16f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#48 0x0000000002bd2b95 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x2bd2b95)
#49 0x0000000002bd35fd clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x2bd35fd)
#50 0x0000000002bdb545 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0x2bdb545)
#51 0x0000000000fcee0c clang_main(int, char**, llvm::ToolContext const&) (/home/chuanqi.xcq/cir-project/build/bin/clang+++0xfcee0c)
#52 0x0000000000f1c2f4 main (/home/chuanqi.xcq/cir-project/build/bin/clang+++0xf1c2f4)
Is CIR ready to compile real world workloads?
from clangir.
Thanks for trying it out @ChuanqiXu9, like @Lancern said, it's not ready for real-world workloads just yet, we're still figuring out how to build small benchmarks and lowering them to LLVM.
from clangir.
Related Issues (20)
- Should mark private visibility for extern symbols.
- Vector related arith missing `nsw` on addition HOT 2
- Revisit insertion point being restored by an InsertionGuard in `buildSwitchBody()` HOT 1
- [Umbrella] Switch stmt CIRGen issues
- Single-operand vector shuffling HOT 1
- [ThroughMLIR] cir-opt can not work when lowering ForOp to scf HOT 4
- Add a test for arrays of 3-component extended vectors
- Crash with try statement HOT 1
- [GSoC] Add OpenCL support to compile GPU kernels
- Reinstate #668 and #678 HOT 2
- Verify ZdlPv -> ZdlPvm in `test/CIR/CodeGen/dtors.cpp`
- Verify gep uses moving to i64
- Replace uses of `isa`/`dyn_cast`/`cast`/... member functions HOT 2
- Data layout modeling for CIR types
- Add support for `__atomic_thread_fence` HOT 3
- Add canonicalization passes for cir.complex.create
- Problem with emitting MLIR from CIR: `cir.func` gets `dsolocal` attribute HOT 4
- Non-constant memory order in atomic built-ins HOT 3
- Keep higher level abstraction for runtime memory orders on atomics
- `emit-cir-flat` is a bit broken HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clangir.