llvm / llvm/llvm-project

[flang][openmp] Complex function returns and arguments error when offloading to NVPTX even when not used on device

Open
#219,791 1 comment 0 reactions 0 assignees View on GitHub
flang:openmp
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Compiling

```fortran
function complex_add(a,b)
complex, value :: a, b
complex :: complex_add
complex_add = a + b
end
```

with these arguments

```
$ flang -fopenmp --offload-arch=sm_89 -c complex_return.f90
```

leads to this error

```
loc("/home/acc/Documents/flang_root/llvm-project/complex_return.f90":1:1): error: /home/acc/Documents/flang_root/llvm-project/flang/lib/Optimizer/CodeGen/Target.cpp:1525: not yet implemented: handle complex return types
LLVM ERROR: aborting
```

I did a bisect and found that this started happening after a5bb77f7e1240f7b06937578cc1c0c9d29e79e98. Looks like removing host-only functions later causes the todo to be hit when it was previously not.

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the shown complex_return.f90 source and the flang -fopenmp --offload-arch=sm_89 command. Read flang/lib/Optimizer/CodeGen/Target.cpp around line 1525 and inspect commit a5bb77f7e1240f7b06937578cc1c0c9d29e79e98, focusing on host-only function removal. Done means this host-only complex function no longer triggers the unimplemented complex return error during offloading.

Written by the indexing model from the issue text.

Assessment

Tech stack
fortran
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.