[Openmp-commits] [PATCH] D86804: [OpenMP] Consolidate error handling and debug messages in Libomptarget

Joseph Huber via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Aug 28 14:06:09 PDT 2020


jhuber6 added inline comments.


================
Comment at: openmp/libomptarget/include/Debug.h:43
+// Enables extra runtime information output if env LIBOMPTARGET_INFO > 0
+extern int InfoLevel;
+
----------------
Having these as global variables is irritating. I could replace it with a function called getDebugLevel that returns the value of the environment variable and use that in the debug macros so it wouldn't need to be called manually in the files. Could potentially store a cached result so it doesn't call getenv every time.


================
Comment at: openmp/libomptarget/plugins/cuda/src/rtl.cpp:40
   } while (false)
 #else // OMPTARGET_DEBUG
 #define CUDA_ERR_STRING(err) {}
----------------
I'm still not sure why having DebugLevel not static causes cuGetErrorString to segfault instead of return (null).


================
Comment at: openmp/libomptarget/plugins/ve/src/rtl.cpp:33
 
-#ifdef OMPTARGET_DEBUG
-static int DebugLevel = 0;
-
-#define GETNAME2(name) #name
-#define GETNAME(name) GETNAME2(name)
-#define DP(...)                                                                \
-  do {                                                                         \
-    if (DebugLevel > 0) {                                                      \
-      DEBUGP("Target " GETNAME(TARGET_NAME) " RTL", __VA_ARGS__);              \
-    }                                                                          \
-  } while (false)
-#else // OMPTARGET_DEBUG
-#define DP(...)                                                                \
-  {}
-#endif // OMPTARGET_DEBUG
+#define TARGET_NAME VE
+
----------------
Is this supposed to be called VE?




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86804



More information about the Openmp-commits mailing list