[Openmp-commits] [PATCH] D93727: [OpenMP] Add using bit flags to select Libomptarget Information

George Rokos via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Wed Dec 23 14:27:23 PST 2020


grokos added inline comments.


================
Comment at: openmp/libomptarget/include/Debug.h:49
+  // Print kernel information from target device plugins
+  OMP_INFOTYPE_PLUGIN_KERNEL = 0x0010,
+};
----------------
Is 0x0008 reserved for something else?


================
Comment at: openmp/libomptarget/include/Debug.h:54
+  static uint32_t InfoLevel = 0;
+  static bool initialized = false;
+  if (initialized)
----------------
I would suggest you declare `initialized` as `std::once_flag` and call `std::call_once()` to initialize `InfoLevel`. This is guaranteed to be thread-safe (unlike the implementation posted here) while also making sure that `InfoLevel` is initialized exactly once. We initialize RTLs in `RTLsTy::RegisterLib()` in the very same way.


================
Comment at: openmp/libomptarget/src/interface.cpp:237
   }
 
 #ifdef OMPTARGET_DEBUG
----------------
Wouldn't we want to have
```
  if (getInfoLevel() & OMP_INFOTYPE_KERNEL_ARGS)
    printKernelArguments(loc, device_id, arg_num, arg_sizes, arg_types,
                         arg_names);
```
here as well? It is useful to see what arguments we have if something goes wrong at a `target exit data` directive or upon exiting a `target data` scope.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93727



More information about the Openmp-commits mailing list