Issue 61411
Summary NVPTX Backend crashes when using atomic thread fence builtins
Labels backend:NVPTX
Assignees
Reporter jhuber6
    Using thread fence atomic builtins causes the backend to crash. Shouldn't we be able to replace these with the NVPTX fence builtins?
```
void foo() {
 __atomic_thread_fence(__ATOMIC_RELEASE);
}
```
```
clang++ foo.cpp --target=nvptx64-nvidia-cuda -march=sm_70
clang++: warning: argument unused during compilation: '--gcc-toolchain=/opt/compiler-explorer/gcc-snapshot' [-Wunused-command-line-argument]
fatal error: error in backend: Cannot select: 0x55aa0f0fcab0: ch = AtomicFence 0x55aa0f013d40, TargetConstant:i64<5>, TargetConstant:i64<1>
  0x55aa0f0fc9d0: i64 = TargetConstant<5>
  0x55aa0f0fca40: i64 = TargetConstant<1>
In function: _Z3foov
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: /opt/compiler-explorer/clang-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics --target=nvptx64-nvidia-cuda -nogpulib -march=sm_70 -g0 -O3 -S <source>
1.	<eof> parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '<source>'.
4.	Running pass 'NVPTX DAG->DAG Pattern Instruction Selection' on function '@_Z3foov'
 #0 0x000055aa072086cf llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3adc6cf)
 #1 0x000055aa072066fc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3ada6fc)
 #2 0x000055aa07159547 llvm::CrashRecoveryContext::HandleExit(int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3a2d547)
 #3 0x000055aa071fe362 llvm::sys::Process::Exit(int, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3ad2362)
 #4 0x000055aa04acbc8f (/opt/compiler-explorer/clang-trunk/bin/clang+++0x139fc8f)
 #5 0x000055aa071623ca llvm::report_fatal_error(llvm::Twine const&, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x3a363ca)
 #6 0x000055aa08228130 llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4afc130)
 #7 0x000055aa0822d472 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4b01472)
 #8 0x000055aa082261e7 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4afa1e7)
 #9 0x000055aa08231c29 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4b05c29)
#10 0x000055aa082349ae llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x4b089ae)
#11 0x000055aa0823709f llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#12 0x000055aa066302f0 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#13 0x000055aa06b48770 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x341c770)
#14 0x000055aa06b488e9 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-trunk/bin/clang+++0x341c8e9)
```
Godbolt link https://godbolt.org/z/TWcdb8GTc.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to