[Openmp-commits] [openmp] [OpenMP] Add Fortran support routines for dyn_groupprivate (OpenMP 6.1) (PR #211630)
Michael Klemm via Openmp-commits
openmp-commits at lists.llvm.org
Thu Oct 1 02:28:12 PDT 2026
================
@@ -551,6 +551,97 @@ FTN_GET_SUBMEMSPACE(omp_memspace_handle_t KMP_DEREF memspace,
#endif
}
+// The C (KMP_FTN_PLAIN) versions of the dynamic groupprivate information
+// routines are defined in kmp_csupport.cpp, so only the Fortran entry points
+// are generated here. The offset and access_group arguments are optional in
+// Fortran and are passed as null pointers when omitted; the defaults are a zero
+// offset and omp_access_cgroup.
+//
+// The dynamic-groupprivate-information routines report on the dynamic
+// groupprivate block that is instantiated by a dyn_groupprivate clause. When an
+// offload runtime is loaded it provides a device-aware definition; forward to
+// it so that Fortran code observes the same block as C/C++. When no offload
+// runtime is available the lookup resolves to the host entry in
+// kmp_csupport.cpp, which reports that no block exists (a null pointer, a size
+// of zero and a null memory space).
+#if KMP_FTN_ENTRIES != KMP_FTN_PLAIN
+void *FTN_STDCALL FTN_GET_DYN_GPRIVATE_PTR(size_t *offset,
+ omp_access_t *access_group) {
+#if KMP_OS_DARWIN || KMP_OS_WASI || defined(KMP_STUB)
+ return NULL;
+#else
+ void *(*fptr)(size_t, omp_access_t);
+ if ((*(void **)(&fptr) = KMP_DLSYM_NEXT("omp_get_dyn_gprivate_ptr"))) {
+ size_t off = offset ? *offset : 0;
+ omp_access_t ag = access_group ? *access_group : omp_access_cgroup;
+ return (*fptr)(off, ag);
+ }
+ return NULL;
----------------
mjklemm wrote:
That's a very good catch, indeed!
https://github.com/llvm/llvm-project/pull/211630
More information about the Openmp-commits
mailing list