[Openmp-commits] [PATCH] D96182: [OpenMP] Enable omp_get_num_devices() on Windows

Joachim Protze via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Feb 10 00:03:15 PST 2021


protze.joachim added a comment.

Two comments, that are not directly related to this patch, but could be addressed while we are here.



================
Comment at: openmp/runtime/src/kmp_ftn_entry.h:968
 // libomptarget, if loaded, provides this function
 int FTN_STDCALL FTN_GET_INITIAL_DEVICE(void) KMP_WEAK_ATTRIBUTE_EXTERNAL;
 int FTN_STDCALL FTN_GET_INITIAL_DEVICE(void) {
----------------
Why is there no `KMP_EXPAND_NAME` macro applied to this function?



================
Comment at: openmp/runtime/src/kmp_ftn_entry.h:974-982
   int (*fptr)();
-  if ((*(void **)(&fptr) = dlsym(RTLD_NEXT, "omp_get_initial_device"))) {
+  if ((*(void **)(&fptr) = KMP_DLSYM_NEXT("omp_get_initial_device"))) {
+    return (*fptr)();
+  } else if ((*(void **)(&fptr) = KMP_DLSYM("__tgt_get_num_devices"))) {
     return (*fptr)();
   } else { // liboffload & libomptarget don't exist
     // same as omp_get_num_devices()
----------------
Conceptually, we could really just call the omp_get_num_devices function from above.
I would at least expect that the functions are called in a consistent order.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96182/new/

https://reviews.llvm.org/D96182



More information about the Openmp-commits mailing list