-
Notifications
You must be signed in to change notification settings - Fork 257
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
[BUG] Clang crashes with an inline statement in ggml #1928
Comments
Does this reproduce with r26? r25 is no longer supported. If this also crashes with r26, attach reproducers mentioned in the crash message (see below for example) to further investigate.
|
Ok, I'll try with r26. I though r25 was still supported as r26 is in beta according to this. |
Technically it's still supported until r26 comes out, but r26 will be out before we can possibly turn around an r25 fix for this bug. This is explained here: https://github.com/android/ndk/wiki/NDK-Release-Process#support-windows |
For it to be a candidate for r25 even if that weren't the case, it'd need to be a regression from r24, and we also can't determine that without the repro case. There's pretty much never a time that we can help if there's no repro case attached. Ah, I see we got part of the repro stuff, yeah, include the stuff clang creates :) That makes things go much faster. Sorry for misunderstanding! |
I've so far seen this fail with NDK versions:
The C file: https://termbin.com/09jf
|
Thanks! That helps clear things up. Reopening since this is still broken. |
i see this is still a crash in fairly latest (8ba1c38a0d70a8e972f1f011629d6391f8744072) llvm-project. llvm-project/build/bin/clang --target=armv7-none-linux-androideabi24 -fdata-sect
ions -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=ar
mv7-a -mthumb -O2 -g -fPIC -mfpu=neon-fp-armv8 -mno-unaligned-access -funsafe-math-optimizations -pthread -std=gnu1
1 -o ggml.c.o -c ggml.i
fatal error: error in backend: Cannot select: 0x55848e4be0e0: v4f32 = fmaxnum 0x55848fa99830, 0x55848fc54190, ggml.c:3751:117 @[ ggml.c:10520:9 @[ ggml.c:10533:17 @[ ggml.c:15101:17 ] ] ]
0x55848fa99830: v4f32,i32,ch = ARMISD::VLD1_UPD<(load (s128) from %ir.471, align 4, !tbaa !2217)> 0x55848cf24680, 0x55848c7af020, Constant:i32<16>, Constant:i32<1>, ggml.c:3751:118 @[ ggml.c:10520:9 @[ ggml.c:10533:17 @[ ggml.c:15101:17 ] ] ]
0x55848c7af020: i32,ch = CopyFromReg 0x55848cf24680, Register:i32 %147, ggml.c:3751:118 @[ ggml.c:10520:9 @[ ggml.c:10533:17 @[ ggml.c:15101:17 ] ] ]
0x55848e9bba00: i32 = Register %147
0x55848e4be1c0: i32 = Constant<16>
0x55848fa926f0: i32 = Constant<1>
0x55848fc54190: v4f32 = bitcast 0x55848f35da80, ggml.c:3751:123 @[ ggml.c:10520:9 @[ ggml.c:10533:17 @[ ggml.c:15101:17 ] ] ]
0x55848f35da80: v4i32 = ARMISD::VMOVIMM TargetConstant:i32<0>, ggml.c:3751:123 @[ ggml.c:10520:9 @[ ggml.c:10533:17 @[ ggml.c:15101:17 ] ] ]
0x55848fc61f00: i32 = TargetConstant<0>
In function: ggml_compute_forward_unary
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: ../../llvm-project/build/bin/clang --target=armv7-none-linux-androideabi24 -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -march=armv7-a -mthumb -O2 -g -fPIC -mfpu=neon-fp-armv8 -mno-unaligned-access -funsafe-math-optimizations -pthread -std=gnu11 -o ggml.c.o -c ggml.i
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'ggml.c'.
4. Running pass 'ARM Instruction Selection' on function '@ggml_compute_forward_unary'
#0 0x000055848639d037 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (../../llvm-project/build/bin/clang+0x1eec037)
#1 0x000055848639adbe llvm::sys::RunSignalHandlers() (../../llvm-project/build/bin/clang+0x1ee9dbe)
#2 0x000055848631c21f (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
#3 0x000055848631c1db (../../llvm-project/build/bin/clang+0x1e6b1db)
#4 0x0000558486397977 llvm::sys::Process::Exit(int, bool) (../../llvm-project/build/bin/clang+0x1ee6977)
#5 0x0000558485108312 (../../llvm-project/build/bin/clang+0xc57312)
#6 0x000055848632092b llvm::report_fatal_error(llvm::Twine const&, bool) (../../llvm-project/build/bin/clang+0x1e6f92b)
#7 0x00005584870cb050 llvm::SelectionDAGISel::isOrEquivalentToAdd(llvm::SDNode const*) const (../../llvm-project/build/bin/clang+0x2c1a050)
#8 0x00005584870ca53d (../../llvm-project/build/bin/clang+0x2c1953d)
#9 0x00005584854cb29e (anonymous namespace)::ARMDAGToDAGISel::Select(llvm::SDNode*) ARMISelDAGToDAG.cpp:0:0
#10 0x00005584870c1eef llvm::SelectionDAGISel::DoInstructionSelection() (../../llvm-project/build/bin/clang+0x2c10eef)
#11 0x00005584870c1590 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (../../llvm-project/build/bin/clang+0x2c10590)
#12 0x00005584870c0846 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (../../llvm-project/build/bin/clang+0x2c0f846)
#13 0x00005584870be632 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (../../llvm-project/build/bin/clang+0x2c0d632)
#14 0x00005584854c8721 (anonymous namespace)::ARMDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) ARMISelDAGToDAG.cpp:0:0
#15 0x0000558485b32369 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (../../llvm-project/build/bin/clang+0x1681369)
#16 0x0000558485f9be62 llvm::FPPassManager::runOnFunction(llvm::Function&) (../../llvm-project/build/bin/clang+0x1aeae62)
#17 0x0000558485fa30f3 llvm::FPPassManager::runOnModule(llvm::Module&) (../../llvm-project/build/bin/clang+0x1af20f3)
#18 0x0000558485f9ca00 llvm::legacy::PassManagerImpl::run(llvm::Module&) (../../llvm-project/build/bin/clang+0x1aeba00)
#19 0x0000558486539ed3 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (../../llvm-project/build/bin/clang+0x2088ed3)
#20 0x00005584871c6bae clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (../../llvm-project/build/bin/clang+0x2d15bae)
#21 0x00005584880bae54 clang::ParseAST(clang::Sema&, bool, bool) (../../llvm-project/build/bin/clang+0x3c09e54)
#22 0x0000558486c0c109 clang::FrontendAction::Execute() (../../llvm-project/build/bin/clang+0x275b109)
#23 0x0000558486b812d6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (../../llvm-project/build/bin/clang+0x26d02d6)
#24 0x0000558486cc906b clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (../../llvm-project/build/bin/clang+0x281806b)
#25 0x0000558485108031 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (../../llvm-project/build/bin/clang+0xc57031)
#26 0x0000558485105b65 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#27 0x00005584869ef7d9 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::$_1>(long) Job.cpp:0:0
#28 0x000055848631c1c5 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (../../llvm-project/build/bin/clang+0x1e6b1c5)
#29 0x00005584869ef265 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (../../llvm-project/build/bin/clang+0x253e265)
#30 0x00005584869b3cb3 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (../../llvm-project/build/bin/clang+0x2502cb3)
#31 0x00005584869b3eee clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (../../llvm-project/build/bin/clang+0x2502eee)
#32 0x00005584869d17e0 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (../../llvm-project/build/bin/clang+0x25207e0)
#33 0x0000558485105397 clang_main(int, char**, llvm::ToolContext const&) (../../llvm-project/build/bin/clang+0xc54397)
#34 0x0000558485112d21 main (../../llvm-project/build/bin/clang+0xc61d21)
#35 0x00007f4c2a4456ca __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#36 0x00007f4c2a445785 call_init ./csu/../csu/libc-start.c:128:20
#37 0x00007f4c2a445785 __libc_start_main ./csu/../csu/libc-start.c:347:5
#38 0x0000558485102111 _start (../../llvm-project/build/bin/clang+0xc51111)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 18.0.0 (https://github.com/llvm/llvm-project.git c7430a7c6401b86ec5aedb90b9387285dfa04049)
Target: armv7-none-linux-android24
Thread model: posix
InstalledDir: ../../llvm-project/build/bin
clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs. |
Thanks, @appujee! |
fixed in llvm-project llvm/llvm-project@347b3f1 |
Thanks for resolving this in upstream @appujee. http://r.android.com/2753660 and http://r.android.com/2755291 cherry-pick this to AOSP. |
Fix is merged in r26. I think the toolchain we currently have in master is too old for the fix, but it'll be in the r27 toolchain before it goes to beta 1. Leaving this open until then. |
Changes: https://github.com/android/ndk/wiki/Changelog-r26#r26c * Updated LLVM to clang-r487747e. See AndroidVersion.txt and clang_source_info.md in the toolchain directory for version information. * [Issue 1928](android/ndk#1928): Fixed Clang crash in instruction selection for 32-bit armv8 floating point. * [Issue 1953](android/ndk#1953): armeabi-v7a libc++ libraries are once again built as thumb. `AndroidVersion.txt` contains: ``` 17.0.2 based on r487747e ```
Description
When ggml.c in llama.cpp is compiled, this compiler crash occurs:
[Origin](https://github.com/MidstallSoftware/flutter_llama/actions/runs/6126297086/job/16630008946]
Affected versions
r25
Canary version
No response
Host OS
Linux
Host OS version
Ubuntu 22.04 (GitHub CI)
Affected ABIs
armeabi-v7a
Build system
CMake
Other build system
Flutter
minSdkVersion
23
Device API level
No response
The text was updated successfully, but these errors were encountered: