[all-commits] [llvm/llvm-project] 6572a6: [OpenMP] Add Fortran support for omp_* functions n...

Robert Imschweiler via All-commits all-commits at lists.llvm.org
Tue Dec 2 13:54:18 PST 2025


  Branch: refs/heads/users/ro-i/openmp-device-uid-fortran
  Home:   https://github.com/llvm/llvm-project
  Commit: 6572a68467c6dfccb168ef45e5e44dc77200a3b0
      https://github.com/llvm/llvm-project/commit/6572a68467c6dfccb168ef45e5e44dc77200a3b0
  Author: Robert Imschweiler <robert.imschweiler at amd.com>
  Date:   2025-12-02 (Tue, 02 Dec 2025)

  Changed paths:
    M openmp/runtime/CMakeLists.txt
    M openmp/runtime/src/CMakeLists.txt
    M openmp/runtime/src/exports_so.txt
    M openmp/runtime/src/include/omp_lib.F90.var
    M openmp/runtime/src/include/omp_lib.h.var
    M openmp/runtime/src/kmp_ftn_cdecl.cpp
    M openmp/runtime/src/kmp_ftn_entry.h
    M openmp/runtime/src/kmp_ftn_extra.cpp
    A openmp/runtime/src/kmp_ftn_support.f90
    A openmp/runtime/test/api/omp_device_uid.f
    A openmp/runtime/test/api/omp_device_uid.f90
    M openmp/runtime/test/lit.cfg

  Log Message:
  -----------
  [OpenMP] Add Fortran support for omp_* functions needing adapters

Taking omp_get_uid_from_device and omp_get_device_from_uid as examples.

OpenMP 6.0 defines these functions as follows:
```
const char *omp_get_uid_from_device(int device_num);

character(:) function omp_get_uid_from_device(device_num)
  pointer :: omp_get_uid_from_device
  integer, intent(in) :: device_num
```
and
```
int omp_get_device_from_uid(const char *uid);

integer function omp_get_device_from_uid(uid)
  character(len=*), intent(in) :: uid
```

As a result, we cannot directly map the Fortran API declarations to the
C API declarations. We need some adapter code to do the conversion.

However, this means that we cannot just define the two functions as
omp_* in kmp_ftn_entry.h without clashing with the adapter code.

The current situation is less than ideal, as demonstrated by this draft
PR, which shall serve as a base for discussing different solution
approaches.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list