[flang-commits] [flang] [llvm] [flang-rt] Enable more runtime functions for the GPU target (PR #183649)

Michael Kruse via flang-commits flang-commits at lists.llvm.org
Fri Feb 27 07:40:32 PST 2026


Meinersbur wrote:

> > LGTM
> > We could still extract `executionEnvironment` into a separate file, but since it works as-is, this could be done afterwards. For now, this should unblock the gpu built since #182918
> 
> That's curious, I guess this is something that differs from C where `malloc(0)` is an implementation defined failure AFAIK. Obviously, doing the actual allocations on the GPU is quite expensive. AMDGPU has a general purpose `malloc`. I never got around to enabling it from NVPTX despite it working there too because I figured someone from NVIDIA should do that if they wanted it, right now it goes to NVIDIA's malloc.

I am currently seeing this error with the OpenMP V&V tests. 
```
ld.lld: error: undefined symbol: Fortran::runtime::executionEnvironment
>>> referenced by /tmp/test_target_teams_distribute_firstprivate.F90.o.amdgcn.gfx90a-53f739.img.lto.o:(Fortran::runtime::FinalizeTicket::Begin(Fortran::runtime::WorkQueue&))
>>> referenced by /tmp/test_target_teams_distribute_firstprivate.F90.o.amdgcn.gfx90a-53f739.img.lto.o:(Fortran::runtime::FinalizeTicket::Begin(Fortran::runtime::WorkQueue&))
>>> referenced by /tmp/test_target_teams_distribute_firstprivate.F90.o.amdgcn.gfx90a-53f739.img.lto.o:(Fortran::runtime::DerivedAssignTicket<false>::Continue(Fortran::runtime::WorkQueue&))
```
#182918 was poinpointed by @ergawy. I didn't test whether it actually fixes the problem, I assumed you were seeing the same thing.

https://github.com/llvm/llvm-project/pull/183649


More information about the flang-commits mailing list