Issue 132982
Summary [flang][openmp] programs with offloading to amdgpu segfault
Labels flang
Assignees
Reporter VeeEM
    Any program with OpenMP offloading compiled with flang for amdgpu seems to segfault currently. clang works fine, only flang is affected.

A program with just a target region is enough to reproduce:
```
program crash
!$omp target
!$omp end target
end program
```

```
flang -fopenmp --offload-arch=gfx1100 crash.f90 
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
$ ./a.out 
Segmentation fault
```
Stacktrace from gdb shows:
```
#0  0x00007ffff3d4fef5 in llvm::omp::target::plugin::AMDGPUKernelTy::launchImpl(llvm::omp::target::plugin::GenericDeviceTy&, unsigned int*, unsigned int*, KernelArgsTy&, KernelLaunchParamsTy, llvm::omp::target::plugin::AsyncInfoWrapperTy&) const
    () from /home/acc/install_llvm2/lib/x86_64-unknown-linux-gnu/libomptarget.so.21.0git
#1 0x00007ffff3d143a5 in llvm::omp::target::plugin::GenericKernelTy::launch(llvm::omp::target::plugin::GenericDeviceTy&, void**, long*, KernelArgsTy&, llvm::omp::target::plugin::AsyncInfoWrapperTy&) const ()
   from /home/acc/install_llvm2/lib/x86_64-unknown-linux-gnu/libomptarget.so.21.0git
#2 0x00007ffff3d1ae04 in llvm::omp::target::plugin::GenericDeviceTy::launchKernel(void*, void**, long*, KernelArgsTy&, __tgt_async_info*) () from /home/acc/install_llvm2/lib/x86_64-unknown-linux-gnu/libomptarget.so.21.0git
#3 0x00007ffff3d1e092 in llvm::omp::target::plugin::GenericPluginTy::launch_kernel(int, void*, void**, long*, KernelArgsTy*, __tgt_async_info*) () from /home/acc/install_llvm2/lib/x86_64-unknown-linux-gnu/libomptarget.so.21.0git
#4 0x00007ffff3becd17 in DeviceTy::launchKernel(void*, void**, long*, KernelArgsTy&, AsyncInfoTy&) () from /home/acc/install_llvm2/lib/x86_64-unknown-linux-gnu/libomptarget.so.21.0git
#5 0x00007ffff3bf847c in target(ident_t*, DeviceTy&, void*, KernelArgsTy&, AsyncInfoTy&) () from /home/acc/install_llvm2/lib/x86_64-unknown-linux-gnu/libomptarget.so.21.0git
#6 0x00007ffff3beff59 in __tgt_target_kernel () from /home/acc/install_llvm2/lib/x86_64-unknown-linux-gnu/libomptarget.so.21.0git
#7 0x000055555555675c in _QQmain ()
#8  0x0000555555556782 in main ()
```

Tested at f7f5aa217a81f2ec036fee765124bd2057531d86.

Machine specs: Ubuntu 24.04.1, rocm 6.3.0, Ryzen 9 9900X, RX 7900 GRE.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to