Open
Description
I have a recent flang
built from sources:
flang version 21.0.0git (https://github.com/llvm/llvm-project.git b68e8f1de71a65b21910aff4aea75fc1ca6bf6e0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/llvm/llvm-project/install/bin
The following simple function does not compile correctly when targeting Nvidia GPUs:
MODULE exptest_m
IMPLICIT NONE
CONTAINS
PURE REAL FUNCTION test(inp)
!$omp declare target
REAL, INTENT(IN) :: inp
test = exp(inp)
END FUNCTION test
END MODULE exptest_m
When compiling this (flang -fopenmp -fopenmp-version=52 -fopenmp-targets=nvptx64 -c -v exptest.F90
) I get:
$ flang -fopenmp -fopenmp-version=52 -fopenmp-targets=nvptx64 -c -v exptest.F90
flang version 21.0.0git (https://github.com/llvm/llvm-project.git b68e8f1de71a65b21910aff4aea75fc1ca6bf6e0)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/llvm/llvm-project/install/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/13
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/14
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/14
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /opt/nvidia/hpc_sdk/Linux_x86_64/25.5/cuda/12.9, version
"/opt/llvm/llvm-project/install/bin/flang" -fc1 -triple x86_64-unknown-linux-gnu -emit-llvm-bc -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -fopenmp -fopenmp-version=52 -resource-dir /opt/llvm/llvm-project/install/lib/clang/21 -fopenmp-targets=nvptx64-nvidia-cuda -mframe-pointer=all -o /tmp/exptest-6f48ce.bc -x f95 exptest.F90
warning: OpenMP support for version 52 in flang is still incomplete
"/opt/llvm/llvm-project/install/bin/flang" -fc1 -triple nvptx64-nvidia-cuda -S -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -target-cpu sm_89 -fopenmp -fopenmp-version=52 -resource-dir /opt/llvm/llvm-project/install/lib/clang/21 -fopenmp-host-ir-file-path /tmp/exptest-6f48ce.bc -fopenmp-is-target-device -mframe-pointer=all -o /tmp/exptest-sm_89-0be563.s -x f95 exptest.F90
warning: OpenMP support for version 52 in flang is still incomplete
"/opt/nvidia/hpc_sdk/Linux_x86_64/25.5/cuda/12.9/bin/ptxas" -m64 -O0 -v --gpu-name sm_89 --output-file /tmp/exptest-sm_89-504956.o /tmp/exptest-sm_89-0be563.s -c
ptxas /tmp/exptest-sm_89-0be563.s, line 34; error : Label expected for argument 0 of instruction 'call'
ptxas /tmp/exptest-sm_89-0be563.s, line 34; fatal : Call target not recognized
ptxas fatal : Ptx assembly aborted due to errors
flang-21: error: ptxas command failed with exit code 255 (use -v to see invocation)
Replacing exp
with cos
or sin
also triggers a core dump from flang
, but since the core dump is a very different symptom I will create another issue for that.