[NVPTX] Crash when doing any `fp128` operations
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
This is the NVPTX version of https://github.com/llvm/llvm-project/issues/121122. Sample:
```llvm
define fp128 @mul128(fp128 %a) {
%r = fmul fp128 %a, 0xL00000000000000004000400000000000
ret fp128 %r
}
define fp128 @abs128(fp128 %a) {
%r = call fp128 @llvm.fabs.f128(fp128 %a)
ret fp128 %r
}
```
Output:
```text
LLVM ERROR: unsupported library call operation
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple=nvptx64
1. Running pass 'Function Pass Manager' on module ''.
2. Running pass 'NVPTX DAG->DAG Pattern Instruction Selection' on function '@mul128'
#0 0x000000000458e058 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x458e058)
#1 0x000000000458ae84 llvm::sys::RunSignalHandlers() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x458ae84)
#2 0x000000000458affa SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007cf275442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x00007cf2754969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x00007cf275442476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x00007cf2754287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x00000000007bae87 llvm::json::operator==(llvm::json::Value const&, llvm::json::Value const&) (.cold) JSON.cpp:0:0
#8 0x00000000044cbb30 llvm::reportFatalInternalError(llvm::StringRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x44cbb30)
#9 0x000000000435fb51 (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x435fb51)
#10 0x000000000442611b llvm::DAGTypeLegalizer::SoftenFloatRes_Binary(llvm::SDNode*, llvm::RTLIB::Libcall) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x442611b)
#11 0x000000000442d3a3 llvm::DAGTypeLegalizer::SoftenFloatResult(llvm::SDNode*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x442d3a3)
#12 0x00000000043aa753 llvm::DAGTypeLegalizer::run() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x43aa753)
#13 0x00000000043ab849 llvm::SelectionDAG::LegalizeTypes() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x43ab849)
#14 0x00000000043084bb llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x43084bb)
#15 0x000000000430c345 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x430c345)
#16 0x000000000430dd43 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x430dd43)
#17 0x0000000001c49463 llvm::NVPTXDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x1c49463)
#18 0x00000000042f7edf llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x42f7edf)
#19 0x00000000032c51c9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#20 0x000000000392f9a6 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x392f9a6)
#21 0x000000000392fd51 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x392fd51)
#22 0x00000000039305bf llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x39305bf)
#23 0x00000000008e9c7a compileModule(char**, llvm::SmallVectorImpl&, llvm::LLVMContext&, std::__cxx11::basic_string, std::allocator>&) llc.cpp:0:0
#24 0x00000000007c0dec main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c0dec)
#25 0x00007cf275429d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#26 0x00007cf275429e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#27 0x00000000008dea05 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8dea05)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
Link: https://llvm.godbolt.org/z/aorzqTWss
Contributor guide
Research direction
Reproduce the crash with llc -mtriple=nvptx64 using the fp128 fmul and llvm.fabs.f128 examples from the issue. Start by tracing NVPTX DAG-to-DAG instruction selection and DAGTypeLegalizer::SoftenFloatRes_Binary, then add focused coverage; done means these fp128 operations no longer abort during NVPTX code generation.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 38/100