[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 12:23:10 PDT 2020
jhuber6 added a comment.
First iteration. There's a few bugs I need to work out and I want to make sure I'm doing the correct approach.
================
Comment at: openmp/libomptarget/include/omptargetmessage.h:1
+//===-- omptargetmessage.h - Target independent OpenMP target RTL -- C++ --===//
+//
----------------
Is this the right location for this file? As I understand this will be visible to the rest of Clang.
================
Comment at: openmp/libomptarget/plugins/amdgpu/src/rtl.cpp:105
#endif
+#define DEBUG_PREFIX "Target " GETNAME(TARGET_NAME) " RTL"
----------------
I elected to just have a definition that's used for the debug message.
================
Comment at: openmp/libomptarget/plugins/cuda/src/rtl.cpp:25
-#ifndef TARGET_NAME
-#define TARGET_NAME CUDA
-#endif
+int DebugLevel = 0;
----------------
This is the source of a really bizarre error. This used to be static but since the symbol DebugLevel is extern in omptargetmessage.h it cannot be static here. If you print out debug messages, after Libomptarget has been unregistered you'll get some errors from CUDA saying that an error returned from cuCtxSetCurrent about three times. If DebugLevel is declared static the cuda error string will be printed out as (null). If it's not static like here it'll cause a segmentation fault. Any ideas? I feel like these errors shouldn't be emitted in the first place because they occur after Libomptarget has been unregistered.
```
Target CUDA RTL --> Error returned from cuCtxSetCurrent
Target CUDA RTL --> Segmentation fault (core dumped)
```
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