[Openmp-commits] [openmp] Fix Windows OpenMP build (PR #170142)

Robert Imschweiler via Openmp-commits openmp-commits at lists.llvm.org
Mon Dec 1 11:23:15 PST 2025


https://github.com/ro-i updated https://github.com/llvm/llvm-project/pull/170142

>From 4eaf6fc099f0c6fa060ff5bc14c8c045115963f4 Mon Sep 17 00:00:00 2001
From: Robert Imschweiler <robert.imschweiler at amd.com>
Date: Mon, 1 Dec 2025 07:45:39 -0600
Subject: [PATCH 1/3] Revert "remove Fortran support for this patch"

This reverts commit bde0665552087063c12fef48b15d6e112b3ee97f.
---
 openmp/runtime/src/include/omp_lib.F90.var | 18 ++++++
 openmp/runtime/src/include/omp_lib.h.var   | 21 +++++++
 openmp/runtime/src/kmp_ftn_cdecl.cpp       | 30 ----------
 openmp/runtime/src/kmp_ftn_entry.h         | 29 +++++++++-
 openmp/runtime/src/kmp_ftn_os.h            |  8 +++
 openmp/runtime/test/api/omp_device_uid.f90 | 65 ++++++++++++++++++++++
 6 files changed, 139 insertions(+), 32 deletions(-)
 create mode 100644 openmp/runtime/test/api/omp_device_uid.f90

diff --git a/openmp/runtime/src/include/omp_lib.F90.var b/openmp/runtime/src/include/omp_lib.F90.var
index 90d7e49ebf549..3ee7412e63281 100644
--- a/openmp/runtime/src/include/omp_lib.F90.var
+++ b/openmp/runtime/src/include/omp_lib.F90.var
@@ -215,6 +215,8 @@
 
         integer (kind=omp_interop_kind), parameter, public :: omp_interop_none = 0
 
+        integer (kind=omp_integer_kind), parameter, public :: omp_invalid_device = -2
+
         interface
 
 !         ***
@@ -417,6 +419,20 @@
             integer (kind=omp_integer_kind) omp_get_device_num
           end function omp_get_device_num
 
+          function omp_get_uid_from_device(device_num) bind(c)
+            use, intrinsic :: iso_c_binding, only: c_ptr
+            use omp_lib_kinds
+            integer (kind=omp_integer_kind), value :: device_num
+            type(c_ptr) omp_get_uid_from_device
+          end function omp_get_uid_from_device
+
+          function omp_get_device_from_uid(device_uid) bind(c)
+            use, intrinsic :: iso_c_binding, only: c_ptr
+            use omp_lib_kinds
+            type(c_ptr), value :: device_uid
+            integer (kind=omp_integer_kind) omp_get_device_from_uid
+          end function omp_get_device_from_uid
+
           function omp_pause_resource(kind, device_num) bind(c)
             use omp_lib_kinds
             integer (kind=omp_pause_resource_kind), value :: kind
@@ -1099,6 +1115,8 @@
         public :: omp_is_initial_device
         public :: omp_get_initial_device
         public :: omp_get_device_num
+        public :: omp_get_uid_from_device
+        public :: omp_get_device_from_uid
         public :: omp_pause_resource
         public :: omp_pause_resource_all
         public :: omp_get_supported_active_levels
diff --git a/openmp/runtime/src/include/omp_lib.h.var b/openmp/runtime/src/include/omp_lib.h.var
index a50bb018c7cc3..feabd243f264d 100644
--- a/openmp/runtime/src/include/omp_lib.h.var
+++ b/openmp/runtime/src/include/omp_lib.h.var
@@ -291,6 +291,9 @@
       integer(kind=omp_interop_kind)omp_interop_none
       parameter(omp_interop_none=0)
 
+      integer(kind=omp_integer_kind)omp_invalid_device
+      parameter(omp_invalid_device=-2)
+
       interface
 
 !       ***
@@ -486,6 +489,20 @@
           integer (kind=omp_integer_kind) omp_get_device_num
         end function omp_get_device_num
 
+        function omp_get_uid_from_device(device_num) bind(c)
+          import
+          use, intrinsic :: iso_c_binding, only : c_ptr
+          integer (kind=omp_integer_kind), value :: device_num
+          type(c_ptr) omp_get_uid_from_device
+        end function omp_get_uid_from_device
+
+        function omp_get_device_from_uid(device_uid) bind(c)
+          import
+          use, intrinsic :: iso_c_binding, only : c_ptr
+          type(c_ptr), value :: device_uid
+          integer (kind=omp_integer_kind) omp_get_device_from_uid
+        end function omp_get_device_from_uid
+
         function omp_pause_resource(kind, device_num) bind(c)
           import
           integer (kind=omp_pause_resource_kind), value :: kind
@@ -1159,6 +1176,8 @@
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_initial_device
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_devices
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_device_num
+!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_uid_from_device
+!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_device_from_uid
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_pause_resource
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_pause_resource_all
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_supported_active_levels
@@ -1242,6 +1261,8 @@
 !$omp declare target(omp_get_initial_device )
 !$omp declare target(omp_get_num_devices )
 !$omp declare target(omp_get_device_num )
+!$omp declare target(omp_get_uid_from_device )
+!$omp declare target(omp_get_device_from_uid )
 !$omp declare target(omp_pause_resource )
 !$omp declare target(omp_pause_resource_all )
 !$omp declare target(omp_get_supported_active_levels )
diff --git a/openmp/runtime/src/kmp_ftn_cdecl.cpp b/openmp/runtime/src/kmp_ftn_cdecl.cpp
index ee0abbfb4acd0..cf1d429a915c0 100644
--- a/openmp/runtime/src/kmp_ftn_cdecl.cpp
+++ b/openmp/runtime/src/kmp_ftn_cdecl.cpp
@@ -29,36 +29,6 @@ char const __kmp_version_ftncdecl[] =
 #define FTN_STDCALL /* no stdcall */
 #include "kmp_ftn_os.h"
 #include "kmp_ftn_entry.h"
-
-// FIXME: this is a hack to get the UID functions working for C.
-// It will be moved and also made available for Fortran in a follow-up patch.
-extern "C" {
-const char *FTN_STDCALL omp_get_uid_from_device(int device_num)
-    KMP_WEAK_ATTRIBUTE_EXTERNAL;
-const char *FTN_STDCALL omp_get_uid_from_device(int device_num) {
-#if KMP_OS_DARWIN || KMP_OS_WASI || defined(KMP_STUB)
-  return nullptr;
-#else
-  const char *(*fptr)(int);
-  if ((*(void **)(&fptr) = KMP_DLSYM_NEXT("omp_get_uid_from_device")))
-    return (*fptr)(device_num);
-  // Returns the same string as used by libomptarget
-  return "HOST";
-#endif
-}
-int FTN_STDCALL omp_get_device_from_uid(const char *device_uid)
-    KMP_WEAK_ATTRIBUTE_EXTERNAL;
-int FTN_STDCALL omp_get_device_from_uid(const char *device_uid) {
-#if KMP_OS_DARWIN || KMP_OS_WASI || defined(KMP_STUB)
-  return omp_invalid_device;
-#else
-  int (*fptr)(const char *);
-  if ((*(void **)(&fptr) = KMP_DLSYM_NEXT("omp_get_device_from_uid")))
-    return (*fptr)(device_uid);
-  return KMP_EXPAND_NAME(FTN_GET_INITIAL_DEVICE)();
-#endif
-}
-}
 #else
                        "no";
 #endif /* KMP_FTN_ENTRIES */
diff --git a/openmp/runtime/src/kmp_ftn_entry.h b/openmp/runtime/src/kmp_ftn_entry.h
index 2b0063eb23a0a..49c56d2b9a769 100644
--- a/openmp/runtime/src/kmp_ftn_entry.h
+++ b/openmp/runtime/src/kmp_ftn_entry.h
@@ -1543,13 +1543,38 @@ int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_MAX_TASK_PRIORITY)(void) {
 #endif
 }
 
-// This function will be defined in libomptarget. When libomptarget is not
-// loaded, we assume we are on the host and return KMP_HOST_DEVICE.
+// These functions will be defined in libomptarget. When libomptarget is not
+// loaded, we assume we are on the host.
 // Compiler/libomptarget will handle this if called inside target.
 int FTN_STDCALL FTN_GET_DEVICE_NUM(void) KMP_WEAK_ATTRIBUTE_EXTERNAL;
 int FTN_STDCALL FTN_GET_DEVICE_NUM(void) {
   return KMP_EXPAND_NAME(FTN_GET_INITIAL_DEVICE)();
 }
+const char *FTN_STDCALL FTN_GET_UID_FROM_DEVICE(int device_num)
+    KMP_WEAK_ATTRIBUTE_EXTERNAL;
+const char *FTN_STDCALL FTN_GET_UID_FROM_DEVICE(int device_num) {
+#if KMP_OS_DARWIN || KMP_OS_WASI || defined(KMP_STUB)
+  return nullptr;
+#else
+  const char *(*fptr)(int);
+  if ((*(void **)(&fptr) = KMP_DLSYM_NEXT("omp_get_uid_from_device")))
+    return (*fptr)(device_num);
+  // Returns the same string as used by libomptarget
+  return "HOST";
+#endif
+}
+int FTN_STDCALL FTN_GET_DEVICE_FROM_UID(const char *device_uid)
+    KMP_WEAK_ATTRIBUTE_EXTERNAL;
+int FTN_STDCALL FTN_GET_DEVICE_FROM_UID(const char *device_uid) {
+#if KMP_OS_DARWIN || KMP_OS_WASI || defined(KMP_STUB)
+  return omp_invalid_device;
+#else
+  int (*fptr)(const char *);
+  if ((*(void **)(&fptr) = KMP_DLSYM_NEXT("omp_get_device_from_uid")))
+    return (*fptr)(device_uid);
+  return KMP_EXPAND_NAME(FTN_GET_INITIAL_DEVICE)();
+#endif
+}
 
 // Compiler will ensure that this is only called from host in sequential region
 int FTN_STDCALL KMP_EXPAND_NAME(FTN_PAUSE_RESOURCE)(kmp_pause_status_t kind,
diff --git a/openmp/runtime/src/kmp_ftn_os.h b/openmp/runtime/src/kmp_ftn_os.h
index ae0ed067235e5..c439a058f22b4 100644
--- a/openmp/runtime/src/kmp_ftn_os.h
+++ b/openmp/runtime/src/kmp_ftn_os.h
@@ -140,6 +140,8 @@
 #define FTN_GET_MEMSPACE_NUM_RESOURCES omp_get_memspace_num_resources
 #define FTN_GET_SUBMEMSPACE omp_get_submemspace
 #define FTN_GET_DEVICE_NUM omp_get_device_num
+#define FTN_GET_UID_FROM_DEVICE omp_get_uid_from_device
+#define FTN_GET_DEVICE_FROM_UID omp_get_device_from_uid
 #define FTN_SET_AFFINITY_FORMAT omp_set_affinity_format
 #define FTN_GET_AFFINITY_FORMAT omp_get_affinity_format
 #define FTN_DISPLAY_AFFINITY omp_display_affinity
@@ -289,6 +291,8 @@
 #define FTN_ALLOC omp_alloc_
 #define FTN_FREE omp_free_
 #define FTN_GET_DEVICE_NUM omp_get_device_num_
+#define FTN_GET_UID_FROM_DEVICE omp_get_uid_from_device_
+#define FTN_GET_DEVICE_FROM_UID omp_get_device_from_uid_
 #define FTN_SET_AFFINITY_FORMAT omp_set_affinity_format_
 #define FTN_GET_AFFINITY_FORMAT omp_get_affinity_format_
 #define FTN_DISPLAY_AFFINITY omp_display_affinity_
@@ -436,6 +440,8 @@
 #define FTN_GET_MEMSPACE_NUM_RESOURCES OMP_GET_MEMSPACE_NUM_RESOURCES
 #define FTN_GET_SUBMEMSPACE OMP_GET_SUBMEMSPACE
 #define FTN_GET_DEVICE_NUM OMP_GET_DEVICE_NUM
+#define FTN_GET_UID_FROM_DEVICE OMP_GET_UID_FROM_DEVICE
+#define FTN_GET_DEVICE_FROM_UID OMP_GET_DEVICE_FROM_UID
 #define FTN_SET_AFFINITY_FORMAT OMP_SET_AFFINITY_FORMAT
 #define FTN_GET_AFFINITY_FORMAT OMP_GET_AFFINITY_FORMAT
 #define FTN_DISPLAY_AFFINITY OMP_DISPLAY_AFFINITY
@@ -585,6 +591,8 @@
 #define FTN_ALLOC OMP_ALLOC_
 #define FTN_FREE OMP_FREE_
 #define FTN_GET_DEVICE_NUM OMP_GET_DEVICE_NUM_
+#define FTN_GET_UID_FROM_DEVICE OMP_GET_UID_FROM_DEVICE_
+#define FTN_GET_DEVICE_FROM_UID OMP_GET_DEVICE_FROM_UID_
 #define FTN_SET_AFFINITY_FORMAT OMP_SET_AFFINITY_FORMAT_
 #define FTN_GET_AFFINITY_FORMAT OMP_GET_AFFINITY_FORMAT_
 #define FTN_DISPLAY_AFFINITY OMP_DISPLAY_AFFINITY_
diff --git a/openmp/runtime/test/api/omp_device_uid.f90 b/openmp/runtime/test/api/omp_device_uid.f90
new file mode 100644
index 0000000000000..5f8e7a328a30e
--- /dev/null
+++ b/openmp/runtime/test/api/omp_device_uid.f90
@@ -0,0 +1,65 @@
+! RUN: %flang %flags %openmp_flags -fopenmp-version=60 %s -o %t
+! RUN: %t | FileCheck %s
+
+program test_omp_device_uid_main
+  use omp_lib
+  use, intrinsic :: iso_c_binding
+  implicit none
+  
+  integer(kind=omp_integer_kind) :: num_devices, i, num_failed
+  logical :: success
+
+  num_devices = omp_get_num_devices()
+  num_failed = 0
+  
+  ! Test all devices plus the initial device (num_devices)
+  do i = 0, num_devices
+    success = test_omp_device_uid(i)
+    if (.not. success) then
+      print '("FAIL for device ", I0)', i
+      num_failed = num_failed + 1
+    end if
+  end do
+  
+  if (num_failed /= 0) then
+    print *, "FAIL"
+    stop 1
+  end if
+  
+  print *, "PASS"
+  stop 0
+
+contains
+
+  logical function test_omp_device_uid(device_num)
+    use omp_lib
+    use, intrinsic :: iso_c_binding
+    implicit none
+    integer(kind=omp_integer_kind), intent(in) :: device_num
+    type(c_ptr) :: device_uid
+    integer(kind=omp_integer_kind) :: device_num_from_uid
+
+    device_uid = omp_get_uid_from_device(device_num)
+    
+    ! Check if device_uid is NULL
+    if (.not. c_associated(device_uid)) then
+      print '("FAIL for device ", I0, ": omp_get_uid_from_device returned NULL")', device_num
+      test_omp_device_uid = .false.
+      return
+    end if
+
+    device_num_from_uid = omp_get_device_from_uid(device_uid)
+    if (device_num_from_uid /= device_num) then
+      print '("FAIL for device ", I0, ": omp_get_device_from_uid returned ", I0)', &
+            device_num, device_num_from_uid
+      test_omp_device_uid = .false.
+      return
+    end if
+
+    test_omp_device_uid = .true.
+  end function test_omp_device_uid
+
+end program test_omp_device_uid_main
+
+! CHECK: PASS
+

>From c3a2ecd40a1f3ae3e87bff40152ab9b762d00bb2 Mon Sep 17 00:00:00 2001
From: Robert Imschweiler <robert.imschweiler at amd.com>
Date: Mon, 1 Dec 2025 07:48:47 -0600
Subject: [PATCH 2/3] remove Fortran specific parts

---
 openmp/runtime/src/include/omp_lib.F90.var | 18 ------
 openmp/runtime/src/include/omp_lib.h.var   | 21 -------
 openmp/runtime/test/api/omp_device_uid.f90 | 65 ----------------------
 3 files changed, 104 deletions(-)
 delete mode 100644 openmp/runtime/test/api/omp_device_uid.f90

diff --git a/openmp/runtime/src/include/omp_lib.F90.var b/openmp/runtime/src/include/omp_lib.F90.var
index 3ee7412e63281..90d7e49ebf549 100644
--- a/openmp/runtime/src/include/omp_lib.F90.var
+++ b/openmp/runtime/src/include/omp_lib.F90.var
@@ -215,8 +215,6 @@
 
         integer (kind=omp_interop_kind), parameter, public :: omp_interop_none = 0
 
-        integer (kind=omp_integer_kind), parameter, public :: omp_invalid_device = -2
-
         interface
 
 !         ***
@@ -419,20 +417,6 @@
             integer (kind=omp_integer_kind) omp_get_device_num
           end function omp_get_device_num
 
-          function omp_get_uid_from_device(device_num) bind(c)
-            use, intrinsic :: iso_c_binding, only: c_ptr
-            use omp_lib_kinds
-            integer (kind=omp_integer_kind), value :: device_num
-            type(c_ptr) omp_get_uid_from_device
-          end function omp_get_uid_from_device
-
-          function omp_get_device_from_uid(device_uid) bind(c)
-            use, intrinsic :: iso_c_binding, only: c_ptr
-            use omp_lib_kinds
-            type(c_ptr), value :: device_uid
-            integer (kind=omp_integer_kind) omp_get_device_from_uid
-          end function omp_get_device_from_uid
-
           function omp_pause_resource(kind, device_num) bind(c)
             use omp_lib_kinds
             integer (kind=omp_pause_resource_kind), value :: kind
@@ -1115,8 +1099,6 @@
         public :: omp_is_initial_device
         public :: omp_get_initial_device
         public :: omp_get_device_num
-        public :: omp_get_uid_from_device
-        public :: omp_get_device_from_uid
         public :: omp_pause_resource
         public :: omp_pause_resource_all
         public :: omp_get_supported_active_levels
diff --git a/openmp/runtime/src/include/omp_lib.h.var b/openmp/runtime/src/include/omp_lib.h.var
index feabd243f264d..a50bb018c7cc3 100644
--- a/openmp/runtime/src/include/omp_lib.h.var
+++ b/openmp/runtime/src/include/omp_lib.h.var
@@ -291,9 +291,6 @@
       integer(kind=omp_interop_kind)omp_interop_none
       parameter(omp_interop_none=0)
 
-      integer(kind=omp_integer_kind)omp_invalid_device
-      parameter(omp_invalid_device=-2)
-
       interface
 
 !       ***
@@ -489,20 +486,6 @@
           integer (kind=omp_integer_kind) omp_get_device_num
         end function omp_get_device_num
 
-        function omp_get_uid_from_device(device_num) bind(c)
-          import
-          use, intrinsic :: iso_c_binding, only : c_ptr
-          integer (kind=omp_integer_kind), value :: device_num
-          type(c_ptr) omp_get_uid_from_device
-        end function omp_get_uid_from_device
-
-        function omp_get_device_from_uid(device_uid) bind(c)
-          import
-          use, intrinsic :: iso_c_binding, only : c_ptr
-          type(c_ptr), value :: device_uid
-          integer (kind=omp_integer_kind) omp_get_device_from_uid
-        end function omp_get_device_from_uid
-
         function omp_pause_resource(kind, device_num) bind(c)
           import
           integer (kind=omp_pause_resource_kind), value :: kind
@@ -1176,8 +1159,6 @@
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_initial_device
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_num_devices
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_device_num
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_uid_from_device
-!DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_device_from_uid
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_pause_resource
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_pause_resource_all
 !DIR$ ATTRIBUTES OFFLOAD:MIC :: omp_get_supported_active_levels
@@ -1261,8 +1242,6 @@
 !$omp declare target(omp_get_initial_device )
 !$omp declare target(omp_get_num_devices )
 !$omp declare target(omp_get_device_num )
-!$omp declare target(omp_get_uid_from_device )
-!$omp declare target(omp_get_device_from_uid )
 !$omp declare target(omp_pause_resource )
 !$omp declare target(omp_pause_resource_all )
 !$omp declare target(omp_get_supported_active_levels )
diff --git a/openmp/runtime/test/api/omp_device_uid.f90 b/openmp/runtime/test/api/omp_device_uid.f90
deleted file mode 100644
index 5f8e7a328a30e..0000000000000
--- a/openmp/runtime/test/api/omp_device_uid.f90
+++ /dev/null
@@ -1,65 +0,0 @@
-! RUN: %flang %flags %openmp_flags -fopenmp-version=60 %s -o %t
-! RUN: %t | FileCheck %s
-
-program test_omp_device_uid_main
-  use omp_lib
-  use, intrinsic :: iso_c_binding
-  implicit none
-  
-  integer(kind=omp_integer_kind) :: num_devices, i, num_failed
-  logical :: success
-
-  num_devices = omp_get_num_devices()
-  num_failed = 0
-  
-  ! Test all devices plus the initial device (num_devices)
-  do i = 0, num_devices
-    success = test_omp_device_uid(i)
-    if (.not. success) then
-      print '("FAIL for device ", I0)', i
-      num_failed = num_failed + 1
-    end if
-  end do
-  
-  if (num_failed /= 0) then
-    print *, "FAIL"
-    stop 1
-  end if
-  
-  print *, "PASS"
-  stop 0
-
-contains
-
-  logical function test_omp_device_uid(device_num)
-    use omp_lib
-    use, intrinsic :: iso_c_binding
-    implicit none
-    integer(kind=omp_integer_kind), intent(in) :: device_num
-    type(c_ptr) :: device_uid
-    integer(kind=omp_integer_kind) :: device_num_from_uid
-
-    device_uid = omp_get_uid_from_device(device_num)
-    
-    ! Check if device_uid is NULL
-    if (.not. c_associated(device_uid)) then
-      print '("FAIL for device ", I0, ": omp_get_uid_from_device returned NULL")', device_num
-      test_omp_device_uid = .false.
-      return
-    end if
-
-    device_num_from_uid = omp_get_device_from_uid(device_uid)
-    if (device_num_from_uid /= device_num) then
-      print '("FAIL for device ", I0, ": omp_get_device_from_uid returned ", I0)', &
-            device_num, device_num_from_uid
-      test_omp_device_uid = .false.
-      return
-    end if
-
-    test_omp_device_uid = .true.
-  end function test_omp_device_uid
-
-end program test_omp_device_uid_main
-
-! CHECK: PASS
-

>From 64c9a4fa4fb1161b4e57dbb85e94b1e605f4ace5 Mon Sep 17 00:00:00 2001
From: Robert Imschweiler <robert.imschweiler at amd.com>
Date: Mon, 1 Dec 2025 13:22:51 -0600
Subject: [PATCH 3/3] use KMP_EXPAND_NAME and add versioned symbol

---
 openmp/runtime/src/exports_so.txt      |  2 ++
 openmp/runtime/src/exports_test_so.txt |  2 ++
 openmp/runtime/src/kmp_ftn_entry.h     | 14 ++++++++++----
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/openmp/runtime/src/exports_so.txt b/openmp/runtime/src/exports_so.txt
index 124c80a1422b4..d826882d98804 100644
--- a/openmp/runtime/src/exports_so.txt
+++ b/openmp/runtime/src/exports_so.txt
@@ -105,6 +105,8 @@ OMP_4.5 {
 } OMP_4.0;
 OMP_5.0 {
 } OMP_4.5;
+OMP_6.0 {
+} OMP_5.0;
 
 # sets up GCC GOMP_ version dependency chain
 GOMP_1.0 {
diff --git a/openmp/runtime/src/exports_test_so.txt b/openmp/runtime/src/exports_test_so.txt
index c0a08e6d3b23b..02ef8ecd52b5a 100644
--- a/openmp/runtime/src/exports_test_so.txt
+++ b/openmp/runtime/src/exports_test_so.txt
@@ -36,6 +36,8 @@ OMP_4.5 {
 } OMP_4.0;
 OMP_5.0 {
 } OMP_4.5;
+OMP_6.0 {
+} OMP_5.0;
 
 # sets up GCC GOMP_ version dependency chain
 GOMP_1.0 {
diff --git a/openmp/runtime/src/kmp_ftn_entry.h b/openmp/runtime/src/kmp_ftn_entry.h
index 49c56d2b9a769..89aee4e3ed8a6 100644
--- a/openmp/runtime/src/kmp_ftn_entry.h
+++ b/openmp/runtime/src/kmp_ftn_entry.h
@@ -1550,9 +1550,10 @@ int FTN_STDCALL FTN_GET_DEVICE_NUM(void) KMP_WEAK_ATTRIBUTE_EXTERNAL;
 int FTN_STDCALL FTN_GET_DEVICE_NUM(void) {
   return KMP_EXPAND_NAME(FTN_GET_INITIAL_DEVICE)();
 }
-const char *FTN_STDCALL FTN_GET_UID_FROM_DEVICE(int device_num)
+const char *FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_UID_FROM_DEVICE)(int device_num)
     KMP_WEAK_ATTRIBUTE_EXTERNAL;
-const char *FTN_STDCALL FTN_GET_UID_FROM_DEVICE(int device_num) {
+const char *FTN_STDCALL
+    KMP_EXPAND_NAME(FTN_GET_UID_FROM_DEVICE)(int device_num) {
 #if KMP_OS_DARWIN || KMP_OS_WASI || defined(KMP_STUB)
   return nullptr;
 #else
@@ -1563,9 +1564,10 @@ const char *FTN_STDCALL FTN_GET_UID_FROM_DEVICE(int device_num) {
   return "HOST";
 #endif
 }
-int FTN_STDCALL FTN_GET_DEVICE_FROM_UID(const char *device_uid)
+int FTN_STDCALL KMP_EXPAND_NAME(FTN_GET_DEVICE_FROM_UID)(const char *device_uid)
     KMP_WEAK_ATTRIBUTE_EXTERNAL;
-int FTN_STDCALL FTN_GET_DEVICE_FROM_UID(const char *device_uid) {
+int FTN_STDCALL
+    KMP_EXPAND_NAME(FTN_GET_DEVICE_FROM_UID)(const char *device_uid) {
 #if KMP_OS_DARWIN || KMP_OS_WASI || defined(KMP_STUB)
   return omp_invalid_device;
 #else
@@ -1931,6 +1933,10 @@ KMP_VERSION_SYMBOL(FTN_SET_AFFINITY_FORMAT, 50, "OMP_5.0");
 // KMP_VERSION_SYMBOL(FTN_GET_SUPPORTED_ACTIVE_LEVELS, 50, "OMP_5.0");
 // KMP_VERSION_SYMBOL(FTN_FULFILL_EVENT, 50, "OMP_5.0");
 
+// OMP_6.0 versioned symbols
+KMP_VERSION_SYMBOL(FTN_GET_UID_FROM_DEVICE, 60, "OMP_6.0");
+KMP_VERSION_SYMBOL(FTN_GET_DEVICE_FROM_UID, 60, "OMP_6.0");
+
 #endif // KMP_USE_VERSION_SYMBOLS
 
 #ifdef __cplusplus



More information about the Openmp-commits mailing list